mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
uca category support and other changes
This commit is contained in:
@@ -17,9 +17,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.bldrs; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.core.consoles.*; import gplx.core.envs.*;
|
||||
import gplx.xowa.apps.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.xmls.*; import gplx.xowa.bldrs.cfgs.*; import gplx.xowa.langs.bldrs.*;
|
||||
import gplx.xowa.apps.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.xmls.*; import gplx.xowa.langs.bldrs.*;
|
||||
import gplx.xowa.bldrs.wkrs.*;
|
||||
import gplx.langs.jsons.*;
|
||||
import gplx.xowa.addons.bldrs.app_cfgs.*;
|
||||
public class Xob_bldr implements Gfo_invk {
|
||||
private boolean pause_at_end = false; private long prv_prog_time; private Xob_xml_parser dump_parser;
|
||||
public Xob_bldr(Xoae_app app) {
|
||||
|
||||
@@ -36,7 +36,7 @@ public class Xob_page_wkr_cmd implements Xob_cmd {
|
||||
gplx.core.ios.streams.Io_stream_rdr src_rdr = wiki.Import_cfg().Src_rdr();
|
||||
fil = Io_buffer_rdr.new_(src_rdr, optRdrBfrSize);
|
||||
fil_len = fil.Fil_len();
|
||||
if (src_rdr.Tid() == gplx.core.ios.streams.Io_stream_.Tid_bzip2) fil_len = (fil_len * 100) / 18; // HACK: no way to get actual file progress; assume 18% compression
|
||||
if (src_rdr.Tid() == gplx.core.ios.streams.Io_stream_tid_.Tid__bzip2) fil_len = (fil_len * 100) / 18; // HACK: no way to get actual file progress; assume 18% compression
|
||||
// fil.Seek(bldr.Opts().ResumeAt());
|
||||
int prv_pos = 0;
|
||||
while (true) {
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.bldrs.cfgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*;
|
||||
import gplx.core.strings.*;
|
||||
public class Xoac_wiki_cfg_bldr_cmd {
|
||||
public Xoac_wiki_cfg_bldr_cmd(String key, String text) {this.key = key; this.text = text;}
|
||||
public String Key() {return key;} private String key;
|
||||
public String Text() {return text;} private String text;
|
||||
public String Exec(String_bldr sb, String wiki, String src) {
|
||||
String sect_txt_bgn = sb.Add("// ").Add(key).Add(".bgn\n").To_str_and_clear();
|
||||
String sect_txt_end = sb.Add("// ").Add(key).Add(".end\n").To_str_and_clear();
|
||||
String sect_txt_all = sb.Add(sect_txt_bgn).Add(text + "\n").Add(sect_txt_end).To_str_and_clear(); // NOTE: always add \n; convenience for single line cmds
|
||||
return src + sect_txt_all;
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.bldrs.cfgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*;
|
||||
public class Xoac_wiki_cfg_bldr_fil implements Gfo_invk {
|
||||
public Xoac_wiki_cfg_bldr_fil(String wiki) {this.wiki = wiki;}
|
||||
public String Wiki() {return wiki;} private String wiki;
|
||||
public int Itms_count() {return list.Count();}
|
||||
public Xoac_wiki_cfg_bldr_cmd Itms_get_at(int i) {return (Xoac_wiki_cfg_bldr_cmd)list.Get_at(i);}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_new_cmd_)) {Itms_add(m.ReadStr("id"), m.ReadStr("text"));}
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
} private static final String Invk_new_cmd_ = "new_cmd_";
|
||||
public Xoac_wiki_cfg_bldr_cmd Itms_add(String key, String text) {
|
||||
Xoac_wiki_cfg_bldr_cmd rv = new Xoac_wiki_cfg_bldr_cmd(key, text);
|
||||
list.Add(rv);
|
||||
return rv;
|
||||
}
|
||||
List_adp list = List_adp_.New();
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.bldrs.cfgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*;
|
||||
import gplx.core.strings.*;
|
||||
public class Xob_wiki_cfg_bldr implements Gfo_invk {
|
||||
public Xob_wiki_cfg_bldr(Xob_bldr bldr) {this.app = bldr.App();} private Xoae_app app;
|
||||
public void Exec() {
|
||||
int len = hash.Count();
|
||||
for (int i = 0; i < len; i++) {
|
||||
Xoac_wiki_cfg_bldr_fil fil = (Xoac_wiki_cfg_bldr_fil)hash.Get_at(i);
|
||||
Exec_fil(fil);
|
||||
}
|
||||
}
|
||||
private void Exec_fil(Xoac_wiki_cfg_bldr_fil fil) {
|
||||
String wiki_key = fil.Wiki();
|
||||
Io_url cfg_file = app.Fsys_mgr().Cfg_wiki_core_dir().GenSubFil(wiki_key + ".gfs");
|
||||
String cfg_text = Io_mgr.Instance.LoadFilStr_args(cfg_file).MissingIgnored_().Exec();
|
||||
int len = fil.Itms_count();
|
||||
String_bldr sb = String_bldr_.new_();
|
||||
for (int i = 0; i < len; i++) {
|
||||
Xoac_wiki_cfg_bldr_cmd cmd = fil.Itms_get_at(i);
|
||||
cfg_text = cmd.Exec(sb, wiki_key, cfg_text);
|
||||
}
|
||||
Io_mgr.Instance.SaveFilStr(cfg_file, cfg_text);
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_get)) return Itms_get_or_new(m.ReadStr("v"));
|
||||
else if (ctx.Match(k, Invk_run)) Exec();
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
} private static final String Invk_get = "get", Invk_run = "run";
|
||||
public void Clear() {hash.Clear();}
|
||||
public Xoac_wiki_cfg_bldr_fil Itms_get_or_new(String wiki) {
|
||||
Xoac_wiki_cfg_bldr_fil rv = (Xoac_wiki_cfg_bldr_fil)hash.Get_by(wiki);
|
||||
if (rv == null) {
|
||||
rv = new Xoac_wiki_cfg_bldr_fil(wiki);
|
||||
hash.Add(wiki, rv);
|
||||
}
|
||||
return rv;
|
||||
} private Ordered_hash hash = Ordered_hash_.New();
|
||||
}
|
||||
@@ -1,179 +0,0 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.bldrs.cfgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*;
|
||||
import org.junit.*; import gplx.core.strings.*;
|
||||
public class Xob_wiki_cfg_bldr_tst {
|
||||
Xob_wiki_cfg_bldr_fxt fxt = new Xob_wiki_cfg_bldr_fxt();
|
||||
@Before public void init() {fxt.Clear();}
|
||||
@Test public void Exec() {
|
||||
fxt .Init_cmd("en.wikipedia.org", "key0", "en.val0")
|
||||
.Init_cmd("en.wikipedia.org", "key1", "en.val1")
|
||||
.Init_cmd("fr.wikipedia.org", "key0", "fr.val0")
|
||||
.Init_cmd("fr.wikipedia.org", "key1", "fr.val1")
|
||||
.Expd_txt("en.wikipedia.org", String_.Concat_lines_nl
|
||||
( "// key0.bgn"
|
||||
, "en.val0"
|
||||
, "// key0.end"
|
||||
, "// key1.bgn"
|
||||
, "en.val1"
|
||||
, "// key1.end"
|
||||
))
|
||||
.Expd_txt("fr.wikipedia.org", String_.Concat_lines_nl
|
||||
( "// key0.bgn"
|
||||
, "fr.val0"
|
||||
, "// key0.end"
|
||||
, "// key1.bgn"
|
||||
, "fr.val1"
|
||||
, "// key1.end"
|
||||
))
|
||||
.Test()
|
||||
;
|
||||
fxt .Clear()
|
||||
.Init_cmd("en.wikipedia.org", "key2", "en.val2")
|
||||
.Expd_txt("en.wikipedia.org", String_.Concat_lines_nl
|
||||
( "// key0.bgn"
|
||||
, "en.val0"
|
||||
, "// key0.end"
|
||||
, "// key1.bgn"
|
||||
, "en.val1"
|
||||
, "// key1.end"
|
||||
, "// key2.bgn"
|
||||
, "en.val2"
|
||||
, "// key2.end"
|
||||
));
|
||||
}
|
||||
// @Test public void Lang_names_run() {
|
||||
// Io_url dir = Io_url_.new_dir_("/var/www/mediawiki/languages/messages/");
|
||||
// Io_url[] fils = Io_mgr.Instance.QueryDir_args(dir).ExecAsUrlAry();
|
||||
// int fils_len = fils.length;
|
||||
// String_bldr sb = String_bldr_.new_();
|
||||
// for (int i = 0; i < fils_len; i++) {
|
||||
// Io_url fil = fils[i];
|
||||
// String lang_code = String_.Lower(String_.Replace(fil.NameOnly(), "Messages", ""));
|
||||
// String txt = Io_mgr.Instance.LoadFilStr(fil);
|
||||
// String[] lines = String_.Split(txt, '\n');
|
||||
// String line = lines[1];
|
||||
// line = String_.Replace(line, "/** ", "");
|
||||
// int pos = String_.FindBwd(line, " (");
|
||||
// if (pos == String_.Find_none) continue; // en; en_rtl have no "language" line
|
||||
// if ( String_.Has_at_bgn(lang_code, "be_")
|
||||
// || String_.Has_at_bgn(lang_code, "crh_")
|
||||
// || String_.Has_at_bgn(lang_code, "kk_")
|
||||
// || String_.Has_at_bgn(lang_code, "ku_")
|
||||
// || String_.Has_at_bgn(lang_code, "sr_")
|
||||
// || String_.In(lang_code, "de_formal", "nb", "nl_informal", "nn", "no")
|
||||
// ) {
|
||||
// int new_pos = String_.FindBwd(line, " (", pos - 1);
|
||||
// if (new_pos != String_.Find_none)
|
||||
// pos = new_pos;
|
||||
// }
|
||||
// line = Replace_by_pos(line, pos, pos + 2, "|");
|
||||
// int line_len = String_.Len(line);
|
||||
// if (line_len > 0)
|
||||
// line = String_.MidByLen(line, 0, line_len - 1);
|
||||
// String[] terms = String_.Split(line, '|');
|
||||
// sb.Add(lang_code).Add("|").Add(String_.Trim(terms[0])).Add("|").Add(String_.Trim(terms[1])).Add("\n");
|
||||
// }
|
||||
// Tfds.Dbg(sb.To_str_and_clear());
|
||||
// }
|
||||
@Test public void Ns_aliases() {
|
||||
Io_mgr.Instance.InitEngine_mem();
|
||||
Io_mgr.Instance.SaveFilStr("mem/en.wikipedia.org/w/api.php?action=query&format=xml&meta=siteinfo&siprop=namespacealiases", String_.Concat_lines_nl
|
||||
( "<api>"
|
||||
, "<query>"
|
||||
, "<namespacealiases>"
|
||||
, "<ns id=\"4\" xml:space=\"preserve\">WP"
|
||||
, "</ns>"
|
||||
, "<ns id=\"5\" xml:space=\"preserve\">WT"
|
||||
, "</ns>"
|
||||
, "<ns id=\"6\" xml:space=\"preserve\">Image"
|
||||
, "</ns>"
|
||||
, "<ns id=\"7\" xml:space=\"preserve\">Image talk"
|
||||
, "</ns>"
|
||||
, "</namespacealiases>"
|
||||
, "</query>"
|
||||
, "</api>"
|
||||
));
|
||||
String[] wikis = new String[] {"en.wikipedia.org"}; String protocol = "mem/";
|
||||
Tfds.Eq_str_lines(Query_ns(protocol, gplx.core.ios.IoEngine_.MemKey, wikis), String_.Concat_lines_nl
|
||||
( "app.bldr.wiki_cfg_bldr.get('en.wikipedia.org').new_cmd_('wiki.ns_mgr.aliases', 'ns_mgr.add_alias_bulk(\""
|
||||
, "4|WP"
|
||||
, "5|WT"
|
||||
, "6|Image"
|
||||
, "7|Image_talk"
|
||||
, "\");');"
|
||||
));
|
||||
}
|
||||
String Query_ns(String protocol, String trg_engine_key, String[] wikis) {
|
||||
String_bldr sb = String_bldr_.new_();
|
||||
int wikis_len = wikis.length;
|
||||
for (int i = 0; i < wikis_len; i++) {
|
||||
String wiki = wikis[i];
|
||||
if (String_.Len_eq_0(wiki)) continue;
|
||||
try {
|
||||
String api = protocol + wiki + "/w/api.php?action=query&format=xml&meta=siteinfo&siprop=namespacealiases";
|
||||
String xml = String_.new_u8(Io_mgr.Instance.DownloadFil_args("", null).Trg_engine_key_(trg_engine_key).Exec_as_bry(api));
|
||||
if (xml == null) continue; // not found
|
||||
gplx.langs.xmls.XmlDoc xdoc = gplx.langs.xmls.XmlDoc_.parse(xml);
|
||||
gplx.langs.xmls.XmlNde xnde = gplx.langs.xmls.Xpath_.SelectFirst(xdoc.Root(), "query/namespacealiases");
|
||||
sb.Add("app.bldr.wiki_cfg_bldr.get('").Add(wiki).Add("').new_cmd_('wiki.ns_mgr.aliases', 'ns_mgr.add_alias_bulk(\"\n");
|
||||
int xndes_len = xnde.SubNdes().Count();
|
||||
for (int j = 0; j < xndes_len; j++) {
|
||||
gplx.langs.xmls.XmlNde ns_nde = xnde.SubNdes().Get_at(j);
|
||||
if (!String_.Eq(ns_nde.Name(), "ns")) continue;
|
||||
int id = Int_.parse(ns_nde.Atrs().FetchValOr("id", "-1"));
|
||||
String name = String_.Replace(String_.Replace(ns_nde.Text_inner(), " ", "_"), "'", "''");
|
||||
sb.Add(Int_.To_str(id)).Add("|").Add(String_.Trim(name)).Add_char_nl();
|
||||
}
|
||||
sb.Add("\");');\n");
|
||||
}
|
||||
catch(Exception e) {sb.Add("// fail: " + wiki + " " + Err_.Message_gplx_full(e)).Add_char_nl();}
|
||||
}
|
||||
return sb.To_str_and_clear();
|
||||
}
|
||||
}
|
||||
class Xob_wiki_cfg_bldr_fxt {
|
||||
public Xob_wiki_cfg_bldr_fxt Clear() {
|
||||
if (app == null) {
|
||||
app = Xoa_app_fxt.Make__app__edit();
|
||||
wiki_cfg_bldr = app.Bldr().Wiki_cfg_bldr();
|
||||
}
|
||||
wiki_cfg_bldr.Clear();
|
||||
hash.Clear();
|
||||
return this;
|
||||
} private Xoae_app app; Xob_wiki_cfg_bldr wiki_cfg_bldr; Ordered_hash hash = Ordered_hash_.New();
|
||||
public Xob_wiki_cfg_bldr_fxt Init_cmd(String wiki, String key, String text) {
|
||||
wiki_cfg_bldr.Itms_get_or_new(wiki).Itms_add(key, text);
|
||||
return this;
|
||||
}
|
||||
public Xob_wiki_cfg_bldr_fxt Expd_txt(String wiki, String text) {
|
||||
hash.Add(wiki, Keyval_.new_(wiki, text));
|
||||
return this;
|
||||
}
|
||||
public void Test() {
|
||||
wiki_cfg_bldr.Exec();
|
||||
int len = hash.Count();
|
||||
for (int i = 0; i < len; i++) {
|
||||
Keyval kv = (Keyval)hash.Get_at(i);
|
||||
String wiki = kv.Key();
|
||||
String expd = (String)kv.Val();
|
||||
String actl = Io_mgr.Instance.LoadFilStr(app.Fsys_mgr().Cfg_wiki_core_dir().GenSubFil(wiki + ".gfs"));
|
||||
Tfds.Eq_str_lines(expd, actl);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,7 +107,7 @@ public class Xob_make_cmd_site implements Io_make_cmd {
|
||||
fil_wtr.Add_idx_direct(itm_len, Byte_.Zero);
|
||||
Io_stream_wtr wtr = null;
|
||||
try {
|
||||
wtr = Io_stream_wtr_.file_(fil_wtr.Fil_url());
|
||||
wtr = Io_stream_wtr_.New__raw(fil_wtr.Fil_url());
|
||||
wtr.Open();
|
||||
fil_wtr.FlushIdx(wtr);
|
||||
wtr.Write(bry, itm_bgn, itm_end);
|
||||
|
||||
@@ -30,9 +30,9 @@ public class Xob_unzip_wkr {
|
||||
}
|
||||
public void Decompress(Io_url src, Io_url trg) {
|
||||
String src_ext = src.Ext();
|
||||
if (String_.Eq(src_ext, gplx.core.ios.streams.Io_stream_.Ext_bz2)) process = decompress_bz2;
|
||||
else if (String_.Eq(src_ext, gplx.core.ios.streams.Io_stream_.Ext_zip)) process = decompress_zip;
|
||||
else if (String_.Eq(src_ext, gplx.core.ios.streams.Io_stream_.Ext_gz)) process = decompress_gz;
|
||||
if (String_.Eq(src_ext, gplx.core.ios.streams.Io_stream_tid_.Ext__bz2)) process = decompress_bz2;
|
||||
else if (String_.Eq(src_ext, gplx.core.ios.streams.Io_stream_tid_.Ext__zip)) process = decompress_zip;
|
||||
else if (String_.Eq(src_ext, gplx.core.ios.streams.Io_stream_tid_.Ext__gz)) process = decompress_gz;
|
||||
else throw Err_.new_unhandled(src_ext);
|
||||
Io_url trg_owner_dir = trg.OwnerDir();
|
||||
Io_mgr.Instance.CreateDirIfAbsent(trg_owner_dir);
|
||||
|
||||
@@ -240,7 +240,6 @@ public class Xoa_css_extractor {
|
||||
int prv_pos = 0;
|
||||
int css_find_bgn_len = Css_find_bgn.length;
|
||||
byte[] protocol_prefix_bry = Bry_.new_u8(protocol_prefix);
|
||||
Gfo_url gfo_url = new Gfo_url();
|
||||
while (true) {
|
||||
int url_bgn = Bry_find_.Find_fwd(raw, Css_find_bgn, prv_pos); if (url_bgn == Bry_find_.Not_found) break; // nothing left; stop
|
||||
url_bgn += css_find_bgn_len;
|
||||
@@ -249,7 +248,7 @@ public class Xoa_css_extractor {
|
||||
css_url_bry = Bry_.Replace(css_url_bry, Css_amp_find, Css_amp_repl); // & -> &
|
||||
css_url_bry = url_encoder.Decode(css_url_bry); // %2C -> %7C -> |
|
||||
css_url_bry = Xoa_css_extractor.Url_root_fix(wiki_domain, css_url_bry);
|
||||
url_parser.Parse(gfo_url, css_url_bry, 0, css_url_bry.length);
|
||||
Gfo_url gfo_url = url_parser.Parse(css_url_bry, 0, css_url_bry.length);
|
||||
if ( gfo_url.Protocol_tid() == Gfo_protocol_itm.Tid_relative_1 // if rel url, add protocol_prefix DATE:2015-08-01
|
||||
|| (Env_.Mode_testing() && gfo_url.Protocol_tid() == Gfo_protocol_itm.Tid_unknown)) // TEST:
|
||||
css_url_bry = Bry_.Add(protocol_prefix_bry, css_url_bry);
|
||||
|
||||
@@ -21,7 +21,7 @@ import gplx.xowa.bldrs.wms.dumps.*;
|
||||
public class Xoi_dump_mgr implements Gfo_invk {
|
||||
public String[] Server_urls() {return server_urls;} private String[] server_urls = String_.Ary(Xowm_dump_file_.Server_your_org, Xowm_dump_file_.Server_wmf_https, Xowm_dump_file_.Server_c3sl, Xowm_dump_file_.Server_masaryk); // promote your.org to primary url; DATE:2016-08-07
|
||||
public String[] Custom_cmds() {return custom_cmds;} private String[] custom_cmds = String_.Ary(Xoi_cmd_wiki_download.Key_wiki_download, Xoi_cmd_wiki_import.KEY);
|
||||
public byte Data_storage_format() {return data_storage_format;} public Xoi_dump_mgr Data_storage_format_(byte v) {data_storage_format = v; return this;} private byte data_storage_format = gplx.core.ios.streams.Io_stream_.Tid_gzip;
|
||||
public byte Data_storage_format() {return data_storage_format;} public Xoi_dump_mgr Data_storage_format_(byte v) {data_storage_format = v; return this;} private byte data_storage_format = gplx.core.ios.streams.Io_stream_tid_.Tid__gzip;
|
||||
public long Db_text_max() {return db_text_max;} private long db_text_max = (long)3000 * Io_mgr.Len_mb;
|
||||
public long Db_categorylinks_max() {return db_categorylinks_max;} private long db_categorylinks_max = (long)3600 * Io_mgr.Len_mb;
|
||||
public long Db_wikidata_max() {return db_wikidata_max;} private long db_wikidata_max = (long)3600 * Io_mgr.Len_mb;
|
||||
@@ -38,8 +38,8 @@ public class Xoi_dump_mgr implements Gfo_invk {
|
||||
else if (ctx.Match(k, Invk_server_urls_)) server_urls = m.ReadStrAryIgnore("v", ",", "\n");
|
||||
else if (ctx.Match(k, Invk_custom_cmds)) return String_.Concat_with_str(",", custom_cmds);
|
||||
else if (ctx.Match(k, Invk_custom_cmds_)) custom_cmds = String_.Ary_filter(m.ReadStrAry("v", ","), Xoi_cmd_mgr.Wiki_cmds_valid);
|
||||
else if (ctx.Match(k, Invk_data_storage_format)) return Io_stream_.Obsolete_to_str(data_storage_format);
|
||||
else if (ctx.Match(k, Invk_data_storage_format_)) data_storage_format = Io_stream_.Obsolete_to_tid(m.ReadStr("v"));
|
||||
else if (ctx.Match(k, Invk_data_storage_format)) return Io_stream_tid_.Obsolete_to_str(data_storage_format);
|
||||
else if (ctx.Match(k, Invk_data_storage_format_)) data_storage_format = Io_stream_tid_.Obsolete_to_tid(m.ReadStr("v"));
|
||||
else if (ctx.Match(k, Invk_data_storage_format_list)) return Options_data_storage_format_list;
|
||||
else if (ctx.Match(k, Invk_db_text_max)) return db_text_max / Io_mgr.Len_mb;
|
||||
else if (ctx.Match(k, Invk_db_text_max_)) db_text_max = m.ReadLong("v") * Io_mgr.Len_mb;
|
||||
|
||||
@@ -32,7 +32,7 @@ public class Xosql_dump_parser {
|
||||
try {
|
||||
// init bfrs, rdr
|
||||
Bry_bfr val_bfr = Bry_bfr_.New();
|
||||
rdr = Io_buffer_rdr.new_(Io_stream_rdr_.new_by_url_(src_fil), src_rdr_bfr_len);
|
||||
rdr = Io_buffer_rdr.new_(Io_stream_rdr_.New_by_url(src_fil), src_rdr_bfr_len);
|
||||
byte[] bfr = rdr.Bfr(); int bfr_len = rdr.Bfr_len(), fld_idx = 0, cur_pos = 0;
|
||||
|
||||
this.tbl_flds = Identify_flds(cbk_flds, bfr);
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.bldrs.wiki_cfgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*;
|
||||
import org.junit.*; import gplx.core.strings.*;
|
||||
import gplx.langs.xmls.*;
|
||||
import gplx.xowa.bldrs.cfgs.*;
|
||||
import gplx.xowa.addons.bldrs.app_cfgs.*;
|
||||
public class Xoi_wiki_props_api_tst {
|
||||
private Xoi_wiki_props_fxt fxt = new Xoi_wiki_props_fxt();
|
||||
@Before public void init() {} // private Xob_subpage_tst_fxt fxt = new] Xob_subpage_tst_fxt();
|
||||
|
||||
@@ -49,12 +49,12 @@ public class Xob_import_cfg {
|
||||
return Io_stream_rdr_process.new_(process.Exe_url(), src_fil_bz2, process.Xto_process_bldr_args(src_fil_bz2.Raw()));
|
||||
}
|
||||
else
|
||||
return Io_stream_rdr_.bzip2_(src_fil_bz2);
|
||||
return Io_stream_rdr_.New__bzip2(src_fil_bz2);
|
||||
}
|
||||
else {
|
||||
Chk_file_ext(wiki.Appe(), src_fil_xml, ".xml", "bz2");
|
||||
src_fil = src_fil_xml; src_rdr_len = Io_mgr.Instance.QueryFil(src_fil_xml).Size();
|
||||
return Io_stream_rdr_.file_(src_fil_xml);
|
||||
return Io_stream_rdr_.New__raw(src_fil_xml);
|
||||
}
|
||||
}
|
||||
private static void Chk_file_ext(Xoae_app app, Io_url fil, String expd_ext, String alt_ext) {
|
||||
|
||||
@@ -23,7 +23,7 @@ public class Xob_xml_page_bldr {
|
||||
public Io_buffer_rdr XtoByteStreamRdr(int bfr_len) {
|
||||
Io_url url = Io_url_.mem_fil_("mem/byteStreamRdr.txt");
|
||||
Io_mgr.Instance.SaveFilBry(url, bfr.To_bry_and_clear());
|
||||
return Io_buffer_rdr.new_(gplx.core.ios.streams.Io_stream_rdr_.file_(url), bfr_len);
|
||||
return Io_buffer_rdr.new_(gplx.core.ios.streams.Io_stream_rdr_.New__raw(url), bfr_len);
|
||||
}
|
||||
public Bry_bfr Bfr() {return bfr;} Bry_bfr bfr = Bry_bfr_.New();
|
||||
public Xob_xml_page_bldr Upd(String find, String repl) {
|
||||
|
||||
Reference in New Issue
Block a user