mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
Cfg: Convert rest of pages
This commit is contained in:
@@ -93,10 +93,8 @@ class Xoi_cmd_search2_build extends Xoi_cmd_base {
|
||||
public Xoi_cmd_search2_build(Xoi_setup_mgr install_mgr, String wiki_key) {this.Ctor(install_mgr, wiki_key);}
|
||||
@Override public String Async_key() {return KEY;} public static final String KEY = "wiki.search2.build";
|
||||
@Override public void Process_async_init(Xoae_app app, Xowe_wiki wiki, Xob_bldr bldr) {
|
||||
if (app.Setup_mgr().Dump_mgr().Wiki_storage_type_is_sql()) {
|
||||
wiki.Db_mgr_as_sql().Category_version_update(false);
|
||||
gplx.xowa.addons.wikis.searchs.bldrs.Srch_bldr_mgr_.Setup(wiki);
|
||||
}
|
||||
wiki.Db_mgr_as_sql().Category_version_update(false);
|
||||
gplx.xowa.addons.wikis.searchs.bldrs.Srch_bldr_mgr_.Setup(wiki);
|
||||
}
|
||||
@Override public void Process_async_done(Xoae_app app, Xowe_wiki wiki, Xob_bldr bldr) {
|
||||
app.Usr_dlg().Prog_many("", "", "search2 setup done");
|
||||
|
||||
@@ -20,24 +20,34 @@ import gplx.core.ios.*; import gplx.core.ios.streams.*;
|
||||
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 boolean Import_bz2_by_stdout() {return import_bz2_by_stdout;} private boolean import_bz2_by_stdout = true;
|
||||
|
||||
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_.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;
|
||||
public byte Wiki_storage_type() {return wiki_storage_type;} private byte wiki_storage_type = Wiki_storage_type_sqlite;
|
||||
public boolean Wiki_storage_type_is_sql() {return wiki_storage_type == Wiki_storage_type_sqlite;}
|
||||
public String Db_ns_map() {return db_ns_map;} private String db_ns_map = "Template~Module";
|
||||
public boolean Css_wiki_update() {return css_wiki_update;} private boolean css_wiki_update = true;
|
||||
public boolean Css_commons_download() {return css_commons_download;} private boolean css_commons_download = true; // changed from false to true; DATE:2014-10-19
|
||||
public boolean Delete_xml_file() {return delete_xml_file;} private boolean delete_xml_file = true;
|
||||
public byte Search_version() {return search_version;} private byte search_version = gplx.xowa.addons.wikis.searchs.specials.Srch_special_page.Version_2;
|
||||
public boolean Import_bz2_by_stdout() {return import_bz2_by_stdout;} private boolean import_bz2_by_stdout = true;
|
||||
public int Page_rank_iterations() {return page_rank_iteration_max;} private int page_rank_iteration_max = 0;
|
||||
public void Init_by_wiki(Xow_wiki wiki) {
|
||||
wiki.App().Cfg().Bind_many_app(this
|
||||
, Cfg__server_urls, Cfg__download_xowa_commons, Cfg__delete_xml_file
|
||||
, Cfg__custom_wiki_commands, Cfg__bz2__stdout_enabled
|
||||
, Cfg__page_rank__iteration_max
|
||||
);
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_server_urls)) return String_.Concat_with_str(",\n", server_urls);
|
||||
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);
|
||||
if (ctx.Match(k, Cfg__server_urls)) server_urls = m.ReadStrAryIgnore("v", ",", "\n");
|
||||
else if (ctx.Match(k, Cfg__download_xowa_commons)) css_commons_download = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Cfg__delete_xml_file)) delete_xml_file = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Cfg__custom_wiki_commands)) custom_cmds = String_.Ary_filter(m.ReadStrAry("v", ","), Xoi_cmd_mgr.Wiki_cmds_valid);
|
||||
else if (ctx.Match(k, Cfg__bz2__stdout_enabled)) import_bz2_by_stdout = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Cfg__page_rank__iteration_max)) page_rank_iteration_max = m.ReadInt("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;
|
||||
@@ -49,50 +59,32 @@ public class Xoi_dump_mgr implements Gfo_invk {
|
||||
else if (ctx.Match(k, Invk_db_wikidata_max_)) db_wikidata_max = m.ReadLong("v") * Io_mgr.Len_mb;
|
||||
else if (ctx.Match(k, Invk_db_ns_map)) return db_ns_map;
|
||||
else if (ctx.Match(k, Invk_db_ns_map_)) db_ns_map = m.ReadStr("v");
|
||||
else if (ctx.Match(k, Invk_wiki_storage_type)) return Wiki_storage_type_str(wiki_storage_type);
|
||||
else if (ctx.Match(k, Invk_wiki_storage_type_)) wiki_storage_type = Wiki_storage_type_parse(m.ReadStr("v"));
|
||||
else if (ctx.Match(k, Invk_wiki_storage_type_list)) return Options_storage_type_list;
|
||||
else if (ctx.Match(k, Invk_css_wiki_update)) return Yn.To_str(css_wiki_update);
|
||||
else if (ctx.Match(k, Invk_css_wiki_update_)) css_wiki_update = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_css_commons_download)) return Yn.To_str(css_commons_download);
|
||||
else if (ctx.Match(k, Invk_css_commons_download_)) css_commons_download = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_delete_xml_file)) return Yn.To_str(delete_xml_file);
|
||||
else if (ctx.Match(k, Invk_delete_xml_file_)) delete_xml_file = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_search_version)) return Options_search_version_str(search_version);
|
||||
else if (ctx.Match(k, Invk_search_version_)) search_version = Options_search_version_parse(m.ReadStr("v"));
|
||||
else if (ctx.Match(k, Invk_search_version_list)) return Options_search_version_list;
|
||||
else if (ctx.Match(k, Invk_import_bz2_by_stdout)) return Yn.To_str(import_bz2_by_stdout);
|
||||
else if (ctx.Match(k, Invk_import_bz2_by_stdout_)) import_bz2_by_stdout = m.ReadYn("v");
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static final String Invk_server_urls = "server_urls", Invk_server_urls_ = "server_urls_", Invk_custom_cmds = "custom_cmds", Invk_custom_cmds_ = "custom_cmds_"
|
||||
, Invk_data_storage_format = "data_storage_format", Invk_data_storage_format_ = "data_storage_format_", Invk_data_storage_format_list = "data_storage_format_list"
|
||||
private static final String Invk_data_storage_format = "data_storage_format", Invk_data_storage_format_ = "data_storage_format_", Invk_data_storage_format_list = "data_storage_format_list"
|
||||
, Invk_db_text_max = "db_text_max", Invk_db_text_max_ = "db_text_max_", Invk_db_categorylinks_max = "db_categorylinks_max", Invk_db_categorylinks_max_ = "db_categorylinks_max_", Invk_db_wikidata_max = "db_wikidata_max", Invk_db_wikidata_max_ = "db_wikidata_max_"
|
||||
, Invk_db_ns_map = "db_ns_map", Invk_db_ns_map_ = "db_ns_map_"
|
||||
, Invk_wiki_storage_type = "wiki_storage_type", Invk_wiki_storage_type_ = "wiki_storage_type_", Invk_wiki_storage_type_list = "wiki_storage_type_list"
|
||||
, Invk_css_wiki_update = "css_wiki_update", Invk_css_wiki_update_ = "css_wiki_update_"
|
||||
, Invk_css_commons_download = "css_commons_download", Invk_css_commons_download_ = "css_commons_download_"
|
||||
, Invk_delete_xml_file = "delete_xml_file", Invk_delete_xml_file_ = "delete_xml_file_"
|
||||
, Invk_search_version = "search_version", Invk_search_version_ = "search_version_", Invk_search_version_list = "search_version_list"
|
||||
, Invk_import_bz2_by_stdout = "import_bz2_by_stdout", Invk_import_bz2_by_stdout_ = "import_bz2_by_stdout_"
|
||||
, Invk_search_version = "search_version", Invk_search_version_ = "search_version_", Invk_search_version_list = "search_version_list"
|
||||
;
|
||||
private static Keyval[] Options_data_storage_format_list = Keyval_.Ary(Keyval_.new_(".xdat", "text"), Keyval_.new_(".gz", "gzip"), Keyval_.new_(".bz2", "bzip2")); // removed .zip; DATE:2014-05-13; updated aliases; DATE:2014-06-20
|
||||
static final byte Wiki_storage_type_xdat = 1, Wiki_storage_type_sqlite = 2;
|
||||
private static final Keyval[] Options_storage_type_list = Keyval_.Ary(Keyval_.new_("sqlite"), Keyval_.new_("xdat")); // DEPRECATED: Keyval_.new_("xdat"); DATE:2015-03-30
|
||||
public static String Wiki_storage_type_str(byte v) {
|
||||
switch (v) {
|
||||
case Xoi_dump_mgr.Wiki_storage_type_xdat : return "xdat";
|
||||
case Xoi_dump_mgr.Wiki_storage_type_sqlite : return "sqlite";
|
||||
default : throw Err_.new_unhandled(v);
|
||||
}
|
||||
}
|
||||
public static byte Wiki_storage_type_parse(String v) {
|
||||
if (String_.Eq(v, "xdat")) return Xoi_dump_mgr.Wiki_storage_type_xdat;
|
||||
else if (String_.Eq(v, "sqlite")) return Xoi_dump_mgr.Wiki_storage_type_sqlite;
|
||||
else throw Err_.new_unhandled(v);
|
||||
}
|
||||
|
||||
private static final Keyval[] Options_search_version_list = Keyval_.Ary(Keyval_.new_("1"), Keyval_.new_("2"));
|
||||
public static String Options_search_version_str(byte v) {return Byte_.To_str(v);}
|
||||
public static byte Options_search_version_parse(String v) {return Byte_.parse(v);}
|
||||
|
||||
private static final String
|
||||
Cfg__server_urls = "xowa.wiki.import.general.dump_servers"
|
||||
, Cfg__download_xowa_commons = "xowa.wiki.import.general.download_xowa_common"
|
||||
, Cfg__delete_xml_file = "xowa.wiki.import.general.delete_xml_file"
|
||||
, Cfg__custom_wiki_commands = "xowa.wiki.import.general.custom_wiki_commands"
|
||||
, Cfg__bz2__stdout_enabled = "xowa.wiki.import.bz2.stdout_enabled"
|
||||
, Cfg__page_rank__iteration_max = "xowa.wiki.import.page_rank.iteration_max"
|
||||
;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user