1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00
This commit is contained in:
gnosygnu
2016-01-17 23:18:07 -05:00
parent 096045614c
commit 235228976e
314 changed files with 4458 additions and 2694 deletions

View File

@@ -28,8 +28,7 @@ public class Xofw_wiki_wkr_base implements Xofw_wiki_finder {
Xof_repo_pair repo_pair = (Xof_repo_pair)repo_pairs.Get_at(i);
byte[] wiki_key = repo_pair.Src().Wiki_domain();
if (repo_pair.Src().Wmf_api()) continue;
Xowe_wiki repo_wiki = wiki_mgr.Get_by_key_or_null(wiki_key);
if (repo_wiki == null) {continue;}
Xowe_wiki repo_wiki = (Xowe_wiki)wiki_mgr.Get_by_or_null(wiki_key); if (repo_wiki == null) {continue;}
Xoa_ttl ttl = Xoa_ttl.parse(repo_wiki, ttl_bry);
Xow_ns file_ns = repo_wiki.Ns_mgr().Ns_file();
boolean found = repo_wiki.Db_mgr().Load_mgr().Load_by_ttl(tmp_db_page, file_ns, ttl.Page_db());
@@ -50,8 +49,7 @@ public class Xofw_wiki_wkr_base implements Xofw_wiki_finder {
for (int i = 0; i < repo_pairs_len; i++) {
Xof_repo_pair repo_pair = (Xof_repo_pair)repo_pairs.Get_at(i);
byte[] src_wiki_key = repo_pair.Src().Wiki_domain();
Xowe_wiki src_wiki = wiki_mgr.Get_by_key_or_null(src_wiki_key);
if (src_wiki == null) continue; // src_wiki defined as repo_pair in cfg, but it has not been downloaded; continue; EX: commons set up but not downloaded
Xowe_wiki src_wiki = (Xowe_wiki)wiki_mgr.Get_by_or_null(src_wiki_key); if (src_wiki == null) continue; // src_wiki defined as repo_pair in cfg, but it has not been downloaded; continue; EX: commons set up but not downloaded
boolean found = src_wiki.Db_mgr().Load_mgr().Load_by_ttl(tmp_db_page, file_ns, ttl_db_key);
if (!found) continue; // ttl does not exist in src_wiki; continue; EX: file does not exist in commons, but exists in en_wiki
byte[] redirect = Get_redirect(src_wiki, file_ns, tmp_db_page);

View File

@@ -70,7 +70,7 @@ public class Xowe_repo_mgr implements Xow_repo_mgr, GfoInvkAble {
public Xof_repo_pair[] Repos_ary() {if (repos_ary == null) repos_ary = (Xof_repo_pair[])repos.To_ary(Xof_repo_pair.class); return repos_ary;} private Xof_repo_pair[] repos_ary;
public boolean Xfer_by_meta(Xof_xfer_itm xfer_itm, Xof_xfer_queue queue) {
byte[] ttl = xfer_itm.Lnki_ttl();
Xof_meta_itm meta_itm = xfer_itm.Meta_itm();
Xof_meta_itm meta_itm = xfer_itm.Dbmeta_itm();
boolean chk_all = false;
byte[] src_wiki_key = wiki.Domain_bry();
if (meta_itm.State_new()) {
@@ -107,9 +107,9 @@ public class Xowe_repo_mgr implements Xow_repo_mgr, GfoInvkAble {
byte[] trg_wiki_key = Bry_.Empty;
if (repo_idx != Xof_meta_itm.Repo_unknown) {
trg_wiki_key = wiki.File_mgr().Repo_mgr().Repos_get_at(repo_idx).Wiki_domain();
trg_wiki = wiki.Appe().Wiki_mgr().Get_by_key_or_make(trg_wiki_key);
trg_wiki = wiki.Appe().Wiki_mgr().Get_by_or_make(trg_wiki_key);
}
Xof_meta_itm redirect_meta = trg_wiki.File_mgr().Meta_mgr().Get_itm_or_new(redirect, md5);
Xof_meta_itm redirect_meta = trg_wiki.File_mgr().Dbmeta_mgr().Get_itm_or_new(redirect, md5);
if (tmp_rslt.Redirect() == Xop_redirect_mgr.Redirect_null_bry) {
if (redirect_meta.State_new()) {
if (repo_idx == Xof_meta_itm.Repo_unknown) {
@@ -152,8 +152,8 @@ public class Xowe_repo_mgr implements Xow_repo_mgr, GfoInvkAble {
boolean make = xfer_mgr.Make_file(wiki);
if (make) {
xfer_itm.Trg_repo_itm_(pair.Trg());
if (second_chance && xfer_itm.Meta_itm().Vrtl_repo() == 0) // second_chance and item found; change vrtl_repo from commons back to same; EX: tarball and [[Image:Rembrandt De aartsengel verlaat Tobias en zijn gezin. 1637.jpg|120px]]
xfer_itm.Meta_itm().Vrtl_repo_(Xof_meta_itm.Repo_same);
if (second_chance && xfer_itm.Dbmeta_itm().Vrtl_repo() == 0) // second_chance and item found; change vrtl_repo from commons back to same; EX: tarball and [[Image:Rembrandt De aartsengel verlaat Tobias en zijn gezin. 1637.jpg|120px]]
xfer_itm.Dbmeta_itm().Vrtl_repo_(Xof_meta_itm.Repo_same);
return true; // file was made; return; if not continue looking at other repos
}
}
@@ -211,7 +211,7 @@ public class Xowe_repo_mgr implements Xow_repo_mgr, GfoInvkAble {
for (int i = 0; i < len; i++) {
Xof_repo_pair pair = (Xof_repo_pair)repos.Get_at(i);
if (i != repo_idx) { // try other wikis
file.Meta_itm().Orig_exists_(Xof_meta_itm.Exists_unknown); // always reset orig exists; this may have been flagged to missing above and should be cleared
file.Dbmeta_itm().Orig_exists_(Xof_meta_itm.Exists_unknown); // always reset orig exists; this may have been flagged to missing above and should be cleared
make_pass = Xfer_file_exec(file, pair, i);
if (make_pass) break;
}
@@ -220,7 +220,7 @@ public class Xowe_repo_mgr implements Xow_repo_mgr, GfoInvkAble {
}
private boolean Xfer_file_exec(Xof_xfer_itm file, Xof_repo_pair pair, int repo_idx) {
xfer_mgr.Atrs_by_itm(file, pair.Src(), pair.Trg());
Xof_meta_itm meta_itm = xfer_mgr.Meta_itm();
Xof_meta_itm meta_itm = xfer_mgr.Dbmeta_itm();
boolean rv = xfer_mgr.Make_file(wiki);
if (rv) {
meta_itm.Vrtl_repo_(repo_idx); // update repo_idx to whatever is found