mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v3.1.1.1
This commit is contained in:
@@ -54,6 +54,9 @@ public class Xob_cmd_keys {
|
||||
, Key_wbase_pid = "wbase.pid" // "text.wdata.pid"
|
||||
, Key_wbase_db = "wbase.db" // "wiki.wdata_db"
|
||||
, Key_site_meta = "util.site_meta"
|
||||
, Key_diff_build = "diff.build"
|
||||
, Key_diff_merge = "diff.merge"
|
||||
|
||||
, Key_tdb_text_init = "tdb.text.init" // "core.init"
|
||||
, Key_tdb_make_page = "tdb.text.page" // "core.make_page"
|
||||
, Key_tdb_make_id = "core.make_id"
|
||||
|
||||
@@ -89,7 +89,7 @@ public class Xob_wiki_cfg_bldr_tst {
|
||||
// String[] terms = String_.Split(line, '|');
|
||||
// sb.Add(lang_code).Add("|").Add(String_.Trim(terms[0])).Add("|").Add(String_.Trim(terms[1])).Add("\n");
|
||||
// }
|
||||
// Tfds.Write(sb.To_str_and_clear());
|
||||
// Tfds.Dbg(sb.To_str_and_clear());
|
||||
// }
|
||||
@Test public void Ns_aliases() {
|
||||
Io_mgr.Instance.InitEngine_mem();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -22,11 +22,11 @@ public class Uca_trie_tst {
|
||||
@Test public void Basic() {
|
||||
Uca_trie_fxt fxt = new Uca_trie_fxt();
|
||||
fxt.Clear();
|
||||
fxt.Init_trie_itm("a", Bry_.new_ints(10, 11));
|
||||
fxt.Init_trie_itm("b", Bry_.new_ints(20, 21));
|
||||
fxt.Init_trie_itm("c", Bry_.new_ints(30, 31));
|
||||
fxt.Test_decode(Bry_.new_ints(10, 11), "a");
|
||||
fxt.Test_decode(Bry_.new_ints(10, 11, 20, 21, 30, 31), "abc");
|
||||
fxt.Init_trie_itm("a", Bry_.New_by_ints(10, 11));
|
||||
fxt.Init_trie_itm("b", Bry_.New_by_ints(20, 21));
|
||||
fxt.Init_trie_itm("c", Bry_.New_by_ints(30, 31));
|
||||
fxt.Test_decode(Bry_.New_by_ints(10, 11), "a");
|
||||
fxt.Test_decode(Bry_.New_by_ints(10, 11, 20, 21, 30, 31), "abc");
|
||||
}
|
||||
}
|
||||
class Uca_trie_fxt {
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
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.cmds.diffs; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.cmds.*;
|
||||
public class Xob_diff_build_cmd implements Xob_cmd {
|
||||
private final Xob_bldr bldr; private final Xowe_wiki wiki;
|
||||
private String prev_url, curr_url, diff_url; private int commit_interval;
|
||||
public Xob_diff_build_cmd(Xob_bldr bldr, Xowe_wiki wiki) {this.bldr = bldr; this.wiki = wiki;}
|
||||
public String Cmd_key() {return Xob_cmd_keys.Key_diff_build;}
|
||||
public void Cmd_run() {
|
||||
new Xob_diff_build_wkr(bldr, wiki, prev_url, curr_url, diff_url, commit_interval).Exec();
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk__prev_url_)) prev_url = m.ReadStr("v");
|
||||
else if (ctx.Match(k, Invk__curr_url_)) curr_url = m.ReadStr("v");
|
||||
else if (ctx.Match(k, Invk__diff_url_)) diff_url = m.ReadStr("v");
|
||||
else if (ctx.Match(k, Invk__commit_interval_)) commit_interval = m.ReadInt("v");
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
public void Cmd_init(Xob_bldr bldr) {}
|
||||
public void Cmd_bgn(Xob_bldr bldr) {}
|
||||
public void Cmd_end() {}
|
||||
public void Cmd_term() {}
|
||||
private static final String Invk__prev_url_ = "prev_url_", Invk__curr_url_ = "curr_url_", Invk__diff_url_ = "diff_url_", Invk__commit_interval_ = "commit_interval_";
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
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.cmds.diffs; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.cmds.*;
|
||||
import gplx.core.brys.*; import gplx.core.brys.fmtrs.*;
|
||||
import gplx.dbs.*; import gplx.dbs.diffs.*; import gplx.dbs.diffs.builds.*;
|
||||
class Xob_diff_build_wkr {
|
||||
private final Gfdb_diff_bldr diff_bldr = new Gfdb_diff_bldr();
|
||||
private Db_conn prev_conn, curr_conn, diff_conn;
|
||||
public Xob_diff_build_wkr(Xob_bldr bldr, Xowe_wiki wiki, String prev_url, String curr_url, String diff_url, int commit_interval) {
|
||||
Bry_fmt url_fmt = Bry_fmt.New("").Args_(New_url_args(wiki));
|
||||
Bry_bfr tmp_bfr = Bry_bfr.new_();
|
||||
prev_conn = New_conn(wiki, url_fmt, prev_url, tmp_bfr);
|
||||
curr_conn = New_conn(wiki, url_fmt, curr_url, tmp_bfr);
|
||||
diff_conn = New_conn(wiki, url_fmt, diff_url, tmp_bfr);
|
||||
// get Gfdb_diff_tbl; format urls
|
||||
Tfds.Write(prev_conn, curr_conn, diff_conn);
|
||||
}
|
||||
public void Exec() {
|
||||
diff_bldr.Init(null); // diff_db_wkr
|
||||
diff_bldr.Compare(null, null); // lhs_tbl, rhs_tbl
|
||||
}
|
||||
public static Db_conn New_conn(Xow_wiki wiki, Bry_fmt fmtr, String url_fmt, Bry_bfr tmp_bfr) {
|
||||
fmtr.Fmt_(url_fmt).Bld_bfr_many(tmp_bfr);
|
||||
Db_conn conn = Db_conn_pool.Instance.Get_or_new(tmp_bfr.To_str_and_clear());
|
||||
return conn;
|
||||
}
|
||||
private static Bfr_fmt_arg[] New_url_args(Xow_wiki wiki) {
|
||||
return null;
|
||||
}
|
||||
//prev_url='~{.dump_dir}-prev/~{.dump_core}';
|
||||
//curr_url='~{.dump_dir}/~{.dump_core}';
|
||||
//diff_url='~{.dump_dir}/~{.dump_domain}-diff.xowa';
|
||||
}
|
||||
// class Bfr_arg__dump_dir : Bfr_arg {
|
||||
// public void Bfr_arg__add(Bry_bfr bfr) {
|
||||
// // dump_dir = bfr.Add("C:\xowa\wiki\en.wikipedia.org");
|
||||
// // dump_core = en.wikipedia.org-core.xowa
|
||||
// // dump_domain = en.wikipedia.org
|
||||
// }
|
||||
// }
|
||||
@@ -35,8 +35,8 @@ public class Xob_diff_regy_make_cmd extends Xob_itm_basic_base implements Xob_cm
|
||||
}
|
||||
private void Make_join_indexes(Db_conn make_db_provider) {
|
||||
try {
|
||||
Sqlite_engine_.Idx_create(make_db_provider, Xob_diff_regy_tbl.Idx_fsdb_regy__join);
|
||||
Sqlite_engine_.Idx_create(make_db_provider, Xob_diff_regy_tbl.Idx_xfer_regy__join);
|
||||
make_db_provider.Ddl_create_idx(Db_meta_idx.new_normal_by_name("fsdb_regy", "fsdb_regy__join", "fsdb_name", "fsdb_is_orig", "fsdb_repo", "fsdb_w", "fsdb_time", "fsdb_page"));
|
||||
make_db_provider.Ddl_create_idx(Db_meta_idx.new_normal_by_name("xfer_regy", "xfer_regy__join", "lnki_ttl", "file_is_orig", "orig_repo", "file_w", "lnki_time", "lnki_page"));
|
||||
}
|
||||
catch (Exception exc) {
|
||||
app.Usr_dlg().Warn_many("", "", "error while making indexes: err=~{0}", Err_.Message_gplx_full(exc));
|
||||
@@ -110,8 +110,8 @@ class Xob_diff_regy_tbl {
|
||||
, ", diff_size bigint NOT NULL"
|
||||
, ");"
|
||||
);
|
||||
public static final Db_idx_itm Idx_fsdb_regy__join = Db_idx_itm.sql_("CREATE INDEX fsdb_regy__join ON fsdb_regy (fsdb_name, fsdb_is_orig, fsdb_repo, fsdb_w, fsdb_time, fsdb_page);");
|
||||
public static final Db_idx_itm Idx_xfer_regy__join = Db_idx_itm.sql_("CREATE INDEX xfer_regy__join ON xfer_regy (lnki_ttl , file_is_orig, orig_repo, file_w, lnki_time, lnki_page);");
|
||||
// public static final Db_idx_itm Idx_fsdb_regy__join = Db_idx_itm.sql_("CREATE INDEX fsdb_regy__join ON fsdb_regy (fsdb_name, fsdb_is_orig, fsdb_repo, fsdb_w, fsdb_time, fsdb_page);");
|
||||
// public static final Db_idx_itm Idx_xfer_regy__join = Db_idx_itm.sql_("CREATE INDEX xfer_regy__join ON xfer_regy (lnki_ttl , file_is_orig, orig_repo, file_w, lnki_time, lnki_page);");
|
||||
public static final Db_idx_itm Idx_diff_regy__load = Db_idx_itm.sql_("CREATE INDEX diff_regy__load ON diff_regy (diff_status, diff_db_id, diff_is_orig, diff_fil_id, diff_thm_id);");
|
||||
public static final String
|
||||
Make_diff_regy = String_.Concat_lines_nl
|
||||
|
||||
@@ -65,7 +65,7 @@ public class Xob_lnki_temp_wkr extends Xob_dump_mgr_base implements Xopg_redlink
|
||||
property_wkr = this.Property_wkr(); // set member reference
|
||||
property_wkr = log_mgr.Make_wkr_property();
|
||||
wiki.Appe().Wiki_mgr().Wdata_mgr().Enabled_(wdata_enabled);
|
||||
if (!xtn_ref_enabled) gplx.xowa.xtns.cite.References_nde.Enabled = false;
|
||||
if (!xtn_ref_enabled) gplx.xowa.xtns.cites.References_nde.Enabled = false;
|
||||
gplx.xowa.xtns.gallery.Gallery_xnde.Log_wkr = log_mgr.Make_wkr().Save_src_str_(Bool_.Y);
|
||||
gplx.xowa.xtns.imaps.Imap_xnde.Log_wkr = log_mgr.Make_wkr();
|
||||
gplx.xowa.parsers.xndes.Xop_xnde_wkr.Timeline_log_wkr = log_mgr.Make_wkr();
|
||||
|
||||
@@ -39,7 +39,7 @@ public class Xob_search_sql_wkr extends Xob_search_base implements Io_make_cmd {
|
||||
byte[] bry = rdr.Bfr();
|
||||
byte[] cur_word = Bry_.Mid(bry, rdr.Key_pos_bgn(), rdr.Key_pos_end());
|
||||
if (!Bry_.Eq(cur_word, prv_word)) {
|
||||
search_word_tbl.Insert_cmd_by_batch(++search_id, cur_word, page_count);
|
||||
search_word_tbl.Insert_cmd_by_batch(++search_id, prv_word, page_count);
|
||||
prv_word = cur_word;
|
||||
page_count = 0;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class Xob_redirect_cmd extends Xob_dump_mgr_base {
|
||||
public Xob_redirect_cmd(Xob_bldr bldr, Xowe_wiki wiki) {this.Cmd_ctor(bldr, wiki); this.Reset_db_y_();}
|
||||
@Override public String Cmd_key() {return Xob_cmd_keys.Key_wiki_redirect;}
|
||||
@Override public int[] Init_ns_ary() {return Int_.Ary(Xow_ns_.Tid__file);} // restrict to file ns
|
||||
@Override public byte Init_redirect() {return Bool_.Y_byte;} // restrict to redirects
|
||||
@Override public byte Init_redirect() {return Bool_.Y_byte;} // restrict to redirects
|
||||
@Override protected void Init_reset(Db_conn conn) {
|
||||
Db_cfg_tbl cfg_tbl = new Db_cfg_tbl(conn, "xowa_cfg");
|
||||
cfg_tbl.Delete_all();
|
||||
|
||||
@@ -46,10 +46,10 @@ public class Xoi_cmd_wiki_tst {
|
||||
for (int j = 0; j < 5; ++j) {
|
||||
latest_html = Io_mgr.Instance.DownloadFil_args("", Io_url_.Empty).Exec_as_bry(url);
|
||||
if (latest_html != null) break;
|
||||
Tfds.Write("fail|" + url);
|
||||
Tfds.Dbg("fail|" + url);
|
||||
if (j == 4) return;
|
||||
}
|
||||
Tfds.Write("pass|" + url);
|
||||
Tfds.Dbg("pass|" + url);
|
||||
parser.Parse(latest_html);
|
||||
Xowm_dump_file dump_file = new Xowm_dump_file(domain_str, "latest", Xowm_dump_type_.Str__pages_articles);
|
||||
dump_file.Server_url_(Xowm_dump_file_.Server_wmf_https);
|
||||
|
||||
@@ -28,7 +28,7 @@ public class Wmf_latest_parser_tst {
|
||||
// @Test public void Smoke() {
|
||||
// Wmf_latest_parser parser = new Wmf_latest_parser();
|
||||
// parser.Parse(Io_mgr.Instance.LoadFilBry("C:\\wmf_latest.html"));
|
||||
// Tfds.Write(String_.Concat_lines_nl(Wmf_latest_parser_fxt.Xto_str_ary(parser.To_ary())));
|
||||
// Tfds.Dbg(String_.Concat_lines_nl(Wmf_latest_parser_fxt.Xto_str_ary(parser.To_ary())));
|
||||
// }
|
||||
}
|
||||
class Wmf_latest_parser_fxt {
|
||||
|
||||
Reference in New Issue
Block a user