1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

'v3.7.2.1'

This commit is contained in:
gnosygnu
2016-07-10 23:35:32 -04:00
parent f5f48bb9b1
commit b333db45f8
366 changed files with 4468 additions and 3460 deletions

View File

@@ -19,7 +19,6 @@ package gplx.xowa.files; import gplx.*; import gplx.xowa.*;
import gplx.core.threads.*; import gplx.core.ios.*; import gplx.core.ios.streams.*;
import gplx.fsdb.*; import gplx.fsdb.meta.*; import gplx.fsdb.data.*; import gplx.xowa.files.fsdb.*;
import gplx.xowa.files.repos.*; import gplx.xowa.files.origs.*; import gplx.xowa.files.bins.*; import gplx.xowa.files.caches.*; import gplx.xowa.guis.cbks.js.*;
import gplx.xowa.htmls.core.makes.imgs.*;
public class Xof_file_wkr implements Gfo_thread_wkr {
private final Xof_orig_mgr orig_mgr; private final Xof_bin_mgr bin_mgr; private final Fsm_mnt_mgr mnt_mgr; private final Xou_cache_mgr cache_mgr;
private final Gfo_usr_dlg usr_dlg; private final Xow_repo_mgr repo_mgr; private final Xog_js_wkr js_wkr;
@@ -83,7 +82,7 @@ public class Xof_file_wkr implements Gfo_thread_wkr {
fsdb.File_size_(file.Size());
}
Js_img_mgr.Update_img(page, js_wkr, fsdb);
cache_mgr.Update(fsdb);
if (cache_mgr != null) cache_mgr.Update(fsdb); // cache_mgr null during tests;
return true;
} catch (Exception e) {
usr_dlg.Warn_many("", "", "file.unknown: err=~{0}", Err_.Message_gplx_full(e));

View File

@@ -108,7 +108,7 @@ public class Xou_cache_mgr {
}
conn.Txn_end();
}
catch (Exception e) {conn.Txn_cxl(); throw e;}
catch (Exception e) {conn.Txn_cxl(); throw Err_.new_exc(e, "cache", "unknown error while saving cache; err=~{0}", Err_.Message_gplx_log(e));}
}
}
public void Reduce(long reduce_to) {

View File

@@ -69,7 +69,7 @@ class Xof_file_fxt {
itm.Init_at_lnki(arg.Exec_tid(), wiki.Domain_itm().Abrv_xo(), ttl_bry, arg.Lnki_type(), arg.Lnki_upright(), arg.Lnki_w(), arg.Lnki_h(), arg.Lnki_time(), Xof_lnki_page.Null, Xof_patch_upright_tid_.Tid_all);
List_adp itms_list = List_adp_.New(); itms_list.Add(itm);
orig_mgr.Find_by_list(Ordered_hash_.New_bry(), itms_list, Xof_exec_tid.Tid_wiki_page);
Xoa_ttl ttl = Xoa_ttl.parse(wiki, Xow_ns_.Tid__main, ttl_bry);
Xoa_ttl ttl = Xoa_ttl.Parse(wiki, Xow_ns_.Tid__main, ttl_bry);
Xoae_page page = Xoae_page.New(wiki, ttl);
fsdb_mgr.Fsdb_search_by_list(itms_list, wiki, page, Xog_js_wkr_.Noop);
if (arg.Rslt_orig_exists() != Bool_.__byte) Tfds.Eq(arg.Rslt_orig_exists() == Bool_.Y_byte, itm.Orig_exists(), "orig_exists");

View File

@@ -26,13 +26,13 @@ class Xof_wiki_finder { // UNUSED
}
public Xoae_page Get_page(int ns, byte[] ttl_bry) {
Xoae_page rv = Get_page__by_wiki(wiki_0, ns, ttl_bry);
if (rv.Missing())
if (rv.Db().Page().Exists_n())
rv = Get_page__by_wiki(wiki_1, ns, ttl_bry);
return rv;
}
private Xoae_page Get_page__by_wiki(Xowe_wiki wiki, int ns_id, byte[] ttl_bry) {
Xoa_ttl ttl = Xoa_ttl.parse(wiki, ns_id, ttl_bry) ;
Xoa_url url = Xoa_url.new_(wiki.Domain_bry(), ttl_bry);
Xoa_ttl ttl = Xoa_ttl.Parse(wiki, ns_id, ttl_bry) ;
Xoa_url url = Xoa_url.New(wiki, ttl);
return wiki.Data_mgr().Load_page_and_parse(url, ttl);
}
private int qry_count, qry_count_max = 1000;
@@ -53,7 +53,7 @@ class Xof_wiki_finder { // UNUSED
itm.Orig_ttl_(ttl_bry);
if (db_page.Redirected()) {
Xoae_page page = Get_page__by_wiki(wiki, ns_id, ttl_bry);
Xoa_ttl redirect_ttl = wiki.Redirect_mgr().Extract_redirect_loop(page.Data_raw());
Xoa_ttl redirect_ttl = wiki.Redirect_mgr().Extract_redirect_loop(page.Db().Text().Text_bry());
itm.Orig_redirect_(redirect_ttl);
++qry_count;
if (qry_count >= qry_count_max) {

View File

@@ -29,7 +29,7 @@ public class Xofw_wiki_wkr_base implements Xofw_wiki_finder {
byte[] wiki_key = repo_pair.Src().Wiki_domain();
if (repo_pair.Src().Wmf_api()) 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);
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());
if (!found) {continue;}
@@ -41,7 +41,7 @@ public class Xofw_wiki_wkr_base implements Xofw_wiki_finder {
file.Orig_repo_id_(-1);
}
public boolean Locate(Xofw_file_finder_rslt rv, List_adp repo_pairs, byte[] ttl_bry) {
Xoa_ttl ttl = Xoa_ttl.parse(wiki, ttl_bry); // NOTE: parse(ttl_bry) should be the same across all wikis; i.e.: there should be no aliases/namespaces
Xoa_ttl ttl = Xoa_ttl.Parse(wiki, ttl_bry); // NOTE: parse(ttl_bry) should be the same across all wikis; i.e.: there should be no aliases/namespaces
Xow_ns file_ns = wiki.Ns_mgr().Ns_file(); // NOTE: file_ns should also be the same across all wikis; being used for data_mgr.Parse below
byte[] ttl_db_key = ttl.Page_db();
rv.Init(ttl_db_key);

View File

@@ -20,23 +20,35 @@ import gplx.xowa.apps.fsys.*; import gplx.xowa.files.exts.*;
import gplx.xowa.wikis.domains.*;
public class Xow_repo_mgr_ {
public static void Assert_repos(Xoae_app app, Xowe_wiki wiki) {
Xoa_repo_mgr repo_mgr = app.File_mgr().Repo_mgr();
Xoa_fsys_mgr app_fsys_mgr = app.Fsys_mgr();
Xof_rule_mgr ext_rule_mgr = app.File_mgr().Ext_rules();
byte[] domain_bry = wiki.Domain_bry();
Xof_repo_itm repo_itm = repo_mgr.Get_by(domain_bry);
if (repo_itm == null) { // no repo for wiki exists; create it;
repo_itm = new Xof_repo_itm(domain_bry, app_fsys_mgr, ext_rule_mgr, domain_bry);
repo_mgr.Add(repo_itm);
}
Xowe_repo_mgr pair_mgr = wiki.File_mgr().Repo_mgr();
if (pair_mgr.Repos_len() == 0) { // no pairs defined; add at least 1
Xof_repo_itm repo_src = repo_mgr.Get_by(File_repo_xowa_null);
if (repo_src == null) {
repo_itm = new Xof_repo_itm(File_repo_xowa_null, app_fsys_mgr, ext_rule_mgr, Xow_domain_tid_.Bry__home);
synchronized (app) { // LOCK:app-level; DATE:2016-07-07
Xoa_repo_mgr repo_mgr = app.File_mgr().Repo_mgr();
Xoa_fsys_mgr app_fsys_mgr = app.Fsys_mgr();
Xof_rule_mgr ext_rule_mgr = app.File_mgr().Ext_rules();
byte[] domain_bry = wiki.Domain_bry();
Xof_repo_itm repo_itm = repo_mgr.Get_by(domain_bry);
if (repo_itm == null) { // no repo for wiki exists; create it;
repo_itm = new Xof_repo_itm(domain_bry, app_fsys_mgr, ext_rule_mgr, domain_bry);
repo_itm.Root_str_(wiki.Fsys_mgr().Root_dir().Raw()); // NOTE: needed for mass_parse; ordinarily called by xowa.gfs; DATE:2016-07-07
repo_mgr.Add(repo_itm);
}
pair_mgr.Add_repo(File_repo_xowa_null, domain_bry);
Xowe_repo_mgr pair_mgr = wiki.File_mgr().Repo_mgr();
if (pair_mgr.Repos_len() == 0) { // no pairs defined; add at least 1
Xof_repo_itm repo_src = repo_mgr.Get_by(File_repo_xowa_null);
if (repo_src == null) {
repo_itm = new Xof_repo_itm(File_repo_xowa_null, app_fsys_mgr, ext_rule_mgr, Xow_domain_tid_.Bry__home);
repo_mgr.Add(repo_itm);
}
pair_mgr.Add_repo(File_repo_xowa_null, domain_bry);
// add commons; needed for mass_parse, else multiple "repo_mgr.invalid_repo" when common files exist in user_cache; DATE:2016-07-07
Xof_repo_itm commons_repo = repo_mgr.Get_by(Xow_domain_itm_.Bry__commons);
if (commons_repo == null) {
commons_repo = new Xof_repo_itm(Xow_domain_itm_.Bry__commons, app_fsys_mgr, ext_rule_mgr, domain_bry);
commons_repo.Root_str_(app.Fsys_mgr().Wiki_dir().GenSubDir(Xow_domain_itm_.Str__commons).Raw()); // NOTE: needed for mass_parse; ordinarily called by xowa.gfs; DATE:2016-07-07
repo_mgr.Add(commons_repo);
}
pair_mgr.Add_repo(Xow_domain_itm_.Bry__commons, Xow_domain_itm_.Bry__commons);
}
}
}
private static byte[] File_repo_xowa_null = Bry_.new_a7("xowa_repo_null");

View File

@@ -69,7 +69,7 @@ public class Xof_xfer_queue_base_fxt {
public void ini_page_create_en_wiki(String ttl) {Init_page_create(en_wiki, ttl, "");}
public void ini_page_create_en_wiki_redirect(String ttl, String redirect) {Init_page_create(en_wiki, ttl, "#REDIRECT [[" + redirect + "]]");}
public void Init_page_create(Xowe_wiki wiki, String ttl, String txt) {
Xoa_ttl page_ttl = Xoa_ttl.parse(wiki, Bry_.new_u8(ttl));
Xoa_ttl page_ttl = Xoa_ttl.Parse(wiki, Bry_.new_u8(ttl));
byte[] page_raw = Bry_.new_u8(txt);
wiki.Db_mgr().Save_mgr().Data_create(page_ttl, page_raw);
}