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

Add page title to log message when category does not exist in page (dynamicPageList)

This commit is contained in:
gnosygnu
2016-10-18 09:29:51 -04:00
parent 01e45caa5a
commit c032eba49c
6 changed files with 23 additions and 19 deletions

View File

@@ -21,6 +21,7 @@ import gplx.langs.htmls.*; import gplx.xowa.htmls.*;
import gplx.xowa.parsers.*; import gplx.xowa.parsers.xndes.*;
import gplx.xowa.wikis.nss.*;
class Dpl_itm {
public byte[] Page_ttl() {return page_ttl;} private byte[] page_ttl;
public List_adp Ctg_includes() {return ctg_includes;} private List_adp ctg_includes;
public List_adp Ctg_excludes() {return ctg_excludes;} private List_adp ctg_excludes;
public int Count() {return count;} private int count = Int_.Min_value;
@@ -42,6 +43,7 @@ class Dpl_itm {
public byte Stable_pages() {return stable_pages;} private byte stable_pages;
private Xop_ctx sub_ctx; private Xop_tkn_mkr sub_tkn_mkr; private Xop_root_tkn sub_root;
public void Parse(Xowe_wiki wiki, Xop_ctx ctx, byte[] page_ttl, byte[] src, Xop_xnde_tkn xnde) { // parse kvps in xnde; EX:<dpl>category=abc\nredirects=y\n</dpl>
this.page_ttl = page_ttl;
sub_ctx = Xop_ctx.New__sub__reuse_page(ctx);
sub_tkn_mkr = sub_ctx.Tkn_mkr();
sub_root = sub_tkn_mkr.Root(Bry_.Empty);

View File

@@ -89,12 +89,12 @@ class Dpl_page_finder {
List_adp del_list = List_adp_.New();
int ns_filter = itm.Ns_filter();
Ordered_hash exclude_pages = Ordered_hash_.New();
Find_excludes(exclude_pages, wiki, load_mgr, tmp_page, tmp_id, itm.Ctg_excludes());
Find_excludes(exclude_pages, wiki, load_mgr, itm.Page_ttl(), tmp_page, tmp_id, itm.Ctg_excludes());
for (int i = 0; i < includes_len; i++) { // loop over includes
byte[] include = (byte[])includes.Get_at(i);
cur_regy.Clear(); del_list.Clear();
Find_pages_in_ctg(cur_regy, wiki, load_mgr, tmp_page, tmp_id, include);
Find_pages_in_ctg(cur_regy, wiki, load_mgr, itm.Page_ttl(), tmp_page, tmp_id, include);
Del_old_pages_not_in_cur(i, tmp_id, old_regy, cur_regy, del_list);
Add_cur_pages_also_in_old(i, tmp_id, old_regy, cur_regy, new_regy, exclude_pages, ns_filter);
old_regy = new_regy;
@@ -108,16 +108,16 @@ class Dpl_page_finder {
wiki.Db_mgr().Load_mgr().Load_by_ids(Cancelable_.Never, rv, 0, pages_len);
rv.Sort_by(Xowd_page_itm_sorter.IdAsc);
}
private static void Find_excludes(Ordered_hash exclude_pages, Xowe_wiki wiki, Xodb_load_mgr load_mgr, Xowd_page_itm tmp_page, Int_obj_ref tmp_id, List_adp exclude_ctgs) {
private static void Find_excludes(Ordered_hash exclude_pages, Xowe_wiki wiki, Xodb_load_mgr load_mgr, byte[] page_ttl, Xowd_page_itm tmp_page, Int_obj_ref tmp_id, List_adp exclude_ctgs) {
if (exclude_ctgs == null) return;
int exclude_ctgs_len = exclude_ctgs.Count();
for (int i = 0; i < exclude_ctgs_len; i++) {
byte[] exclude_ctg = (byte[])exclude_ctgs.Get_at(i);
Find_pages_in_ctg(exclude_pages, wiki, load_mgr, tmp_page, tmp_id, exclude_ctg);
Find_pages_in_ctg(exclude_pages, wiki, load_mgr, page_ttl, tmp_page, tmp_id, exclude_ctg);
}
}
private static void Find_pages_in_ctg(Ordered_hash rv, Xowe_wiki wiki, Xodb_load_mgr load_mgr, Xowd_page_itm tmp_page, Int_obj_ref tmp_id, byte[] ctg_ttl) {
Xoctg_catpage_ctg ctg = wiki.Ctg__catpage_mgr().Get_or_load_or_null(Xoctg_catpage_url.New__blank(), wiki.Ttl_parse(gplx.xowa.wikis.nss.Xow_ns_.Tid__category, ctg_ttl), -1);
private static void Find_pages_in_ctg(Ordered_hash rv, Xowe_wiki wiki, Xodb_load_mgr load_mgr, byte[] page_ttl, Xowd_page_itm tmp_page, Int_obj_ref tmp_id, byte[] ctg_ttl) {
Xoctg_catpage_ctg ctg = wiki.Ctg__catpage_mgr().Get_or_load_or_null(page_ttl, Xoctg_catpage_url.New__blank(), wiki.Ttl_parse(gplx.xowa.wikis.nss.Xow_ns_.Tid__category, ctg_ttl), -1);
if (ctg == null) return;
// loop grps to get grp