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

'v3.8.5.1'

This commit is contained in:
gnosygnu
2016-08-29 23:31:58 -04:00
parent e4a2af026b
commit 232838c732
292 changed files with 4502 additions and 1838 deletions

View File

@@ -25,6 +25,7 @@ public class Xow_db_file_ {
, Tid__html_solo = 10, Tid__html_data = 11
, Tid__file_solo = 12, Tid__file_core = 13, Tid__file_data = 14, Tid__file_user = 15
, Tid__search_link = 16, Tid__random = 17, Tid__css = 18
, Tid__html_user = 19
;
private static final String
Key__core = "core", Key__text = "text", Key__cat = "xtn.category", Key__search_core = "xtn.search.core", Key__wbase = "core.wbase"
@@ -33,6 +34,7 @@ public class Xow_db_file_ {
, Key__html_solo = "html.solo", Key__html_data = "html"
, Key__file_solo = "file.solo", Key__file_core = "file.core", Key__file_data = "file.data", Key__file_user = "file.user"
, Key__search_link = "xtn.search.link", Key__random = "xtn.random", Key__css = "xtn.css"
, Key__html_user = "html.user"
;
public static String To_key(byte v) {
switch (v) {
@@ -54,6 +56,7 @@ public class Xow_db_file_ {
case Tid__search_link: return Key__search_link;
case Tid__random: return Key__random;
case Tid__css: return Key__css;
case Tid__html_user: return Key__html_user;
default: throw Err_.new_unhandled(v);
}
}

View File

@@ -91,6 +91,13 @@ public class Xow_db_mgr {
}
return null;
}
public Xow_db_file Dbs__assert_by_tid(byte tid) {
Xow_db_file rv = Dbs__get_by_tid_or_null(tid);
if (rv == null) {
rv = Dbs__make_by_tid(tid);
}
return rv;
}
public Ordered_hash Dbs__get_hash_by_tid(int tid) {return hash_by_tids.Get_by_tid_or_null((byte)tid);}
public Xow_db_file Dbs__make_by_tid(byte tid) {
int tid_idx = Get_tid_idx(hash_by_tids, tid);
@@ -132,10 +139,10 @@ public class Xow_db_mgr {
case Xow_db_file_.Tid__text_solo:
case Xow_db_file_.Tid__core : {db__core = db; if (props.Layout_text().Tid_is_all_or_few()) db__cat_core = db__text = db; break;}
case Xow_db_file_.Tid__text : {db__text = db; break;}
case Xow_db_file_.Tid__html_data : {db__html = db; break;}
case Xow_db_file_.Tid__wbase : {if (db__wbase == null) db__wbase = db; break;}
case Xow_db_file_.Tid__html_data : {db__html = db; break;}
case Xow_db_file_.Tid__wbase : {if (db__wbase == null) db__wbase = db; break;}
case Xow_db_file_.Tid__cat_core :
case Xow_db_file_.Tid__cat : {if (db__cat_core == null) db__cat_core = db; break;}
case Xow_db_file_.Tid__cat : {if (db__cat_core == null) db__cat_core = db; break;}
}
}
private void Dbs__add(Xow_db_file db_file) {

View File

@@ -33,7 +33,7 @@ public class Xowd_page_itm {
public int Html_db_id() {return html_db_id;} private int html_db_id;
public int Redirect_id() {return redirect_id;} private int redirect_id;
public DateAdp Modified_on() {return modified_on;} public Xowd_page_itm Modified_on_(DateAdp v) {modified_on = v; return this;} private DateAdp modified_on;
public boolean Exists() {return exists;} public Xowd_page_itm Exists_(boolean v) {exists = v; return this;} private boolean exists;
public boolean Exists() {return exists;} private boolean exists;
public int Score() {return score;} private int score;
public Xow_ns Ns() {return ns;} private Xow_ns ns;
public Object Xtn() {return xtn;} public Xowd_page_itm Xtn_(Object v) {this.xtn = v; return this;} private Object xtn;
@@ -45,27 +45,43 @@ public class Xowd_page_itm {
id_val = null;
return this;
}
public void Init_by_sql(int id, int ns_id, byte[] ttl_page_db, DateAdp modified_on, boolean redirected, int text_len, int random_int, int text_db_id, int html_db_id, int redirect_id, int score) {
this.id = id;
this.ns_id = ns_id;
this.ttl_page_db = ttl_page_db;
this.modified_on = modified_on;
this.redirected = redirected;
this.text_len = text_len;
this.random_int = random_int;
this.text_db_id = text_db_id;
this.html_db_id = html_db_id;
this.redirect_id = redirect_id;
this.score = score;
public void Init_by_load__idx(int id, int ns_id, byte[] ttl_page_db, int text_len) {
this.exists = true; // COMMENT: DATE:2016-08-28
this.id = id;
this.ns_id = ns_id;
this.ttl_page_db = ttl_page_db;
this.text_len = text_len;
}
public void Init_by_load__all(int id, int ns_id, byte[] ttl_page_db, DateAdp modified_on, boolean redirected, int text_len, int random_int, int text_db_id, int html_db_id, int redirect_id, int score) {
// same as Init_by_load__idx; COMMENT: DATE:2016-08-28
this.exists = true;
this.id = id;
this.ns_id = ns_id;
this.ttl_page_db = ttl_page_db;
this.text_len = text_len;
// other props
this.redirected = redirected;
this.text_db_id = text_db_id;
this.modified_on = modified_on;
this.random_int = random_int;
this.html_db_id = html_db_id;
this.redirect_id = redirect_id;
this.score = score;
}
public void Init_by_tdb(int id, int text_db_id, int tdb_row_idx, boolean redirected, int text_len, int ns_id, byte[] ttl_page_db) {
this.id = id;
this.text_db_id = text_db_id;
this.tdb_row_idx = tdb_row_idx;
this.redirected = redirected;
this.text_len = text_len;
this.ns_id = ns_id;
this.ttl_page_db = ttl_page_db;
// same as Init_by_load__idx; COMMENT: DATE:2016-08-28
this.exists = true;
this.id = id;
this.ns_id = ns_id;
this.ttl_page_db = ttl_page_db;
this.text_len = text_len;
// other props
this.redirected = redirected;
this.text_db_id = text_db_id;
this.tdb_row_idx = tdb_row_idx;
}
public Xowd_page_itm Ttl_(Xow_ns ns, byte[] ttl_page_db) {
this.ns = ns;

View File

@@ -191,10 +191,7 @@ public class Xowd_page_tbl implements Rls_able {
while (rdr.Move_next()) {
if (cancelable.Canceled()) return;
Xowd_page_itm page = new Xowd_page_itm();
page.Id_ (rdr.Read_int(fld_id));
page.Ns_id_ (rdr.Read_int(fld_ns));
page.Ttl_page_db_ (rdr.Read_bry_by_str(fld_title));
page.Text_len_ (rdr.Read_int(fld_len));
this.Read_page__idx(page, rdr);
rv.Add(page);
}
} finally {rdr.Rls();}
@@ -279,19 +276,19 @@ public class Xowd_page_tbl implements Rls_able {
rslt_count.Val_(rslt_idx);
}
public void Read_page__idx(Xowd_page_itm page, Db_rdr rdr) {
page.Id_ (rdr.Read_int(fld_id));
page.Ns_id_ (rdr.Read_int(fld_ns));
page.Ttl_page_db_ (rdr.Read_bry_by_str(fld_title));
page.Text_len_ (rdr.Read_int(fld_len));
page.Init_by_load__idx
( rdr.Read_int(fld_id)
, rdr.Read_int(fld_ns)
, rdr.Read_bry_by_str(fld_title)
, rdr.Read_int(fld_len)
);
}
public void Read_page__all(Xowd_page_itm page, Db_rdr rdr) {
int html_db_id = rdr.Read_int(fld_html_db_id);
int redirected_id = rdr.Read_int(fld_redirect_id);
// handle page_score defaulting to page_len
int page_len = rdr.Read_int(fld_len);
int page_score = page_len;
if (fld_score != Dbmeta_fld_itm.Key_null)
page_score = rdr.Read_int(fld_score);
page.Init_by_sql
int page_score = fld_score == Dbmeta_fld_itm.Key_null ? page_len : rdr.Read_int(fld_score);
page.Init_by_load__all
( rdr.Read_int(fld_id)
, rdr.Read_int(fld_ns)
, rdr.Read_bry_by_str(fld_title)
@@ -300,8 +297,8 @@ public class Xowd_page_tbl implements Rls_able {
, page_len
, rdr.Read_int(fld_random_int)
, rdr.Read_int(fld_text_db_id)
, html_db_id
, redirected_id
, rdr.Read_int(fld_html_db_id)
, rdr.Read_int(fld_redirect_id)
, page_score
);
}

View File

@@ -36,5 +36,5 @@ class Xowd_page_tbl__id extends Xowd_page_tbl__in_wkr__base {
stmt.Val_int(page.Id());
}
}
@Override public Xowd_page_itm Read_data_to_page(Xowd_page_itm rdr_page) {return (Xowd_page_itm)hash.Get_by(rdr_page.Id_val());}
@Override protected Xowd_page_itm Get_page_or_null(Xowd_page_itm rdr_page) {return (Xowd_page_itm)hash.Get_by(rdr_page.Id_val());}
}

View File

@@ -24,7 +24,7 @@ abstract class Xowd_page_tbl__in_wkr__base extends Db_in_wkr__base {
public void Ctor(Xowd_page_tbl tbl, String tbl_name, String fld_in_name) {this.tbl = tbl; this.tbl_name = tbl_name; this.fld_in_name = fld_in_name;}
public String In_fld_name() {return fld_in_name;}
protected abstract Criteria In_filter(Object[] part_ary);
public abstract Xowd_page_itm Read_data_to_page(Xowd_page_itm rdr_page);
protected abstract Xowd_page_itm Get_page_or_null(Xowd_page_itm rdr_page);
public boolean Fill_idx_fields_only() {return fill_idx_fields_only;} public void Fill_idx_fields_only_(boolean v) {fill_idx_fields_only = v;} private boolean fill_idx_fields_only;
@Override protected Db_qry Make_qry(int bgn, int end) {
Object[] part_ary = In_ary(end - bgn);
@@ -32,21 +32,21 @@ abstract class Xowd_page_tbl__in_wkr__base extends Db_in_wkr__base {
( this.Tbl_name()
, In_filter(part_ary)
, fill_idx_fields_only ? tbl.Flds_select_idx() : tbl.Flds_select_all()
)
;
);
}
@Override protected void Read_data(Cancelable cancelable, Db_rdr rdr) {
Xowd_page_itm temp = new Xowd_page_itm();
Xowd_page_itm load = new Xowd_page_itm();
while (rdr.Move_next()) {
if (cancelable.Canceled()) return;
if (fill_idx_fields_only)
tbl.Read_page__idx(temp, rdr);
tbl.Read_page__idx(load, rdr);
else
tbl.Read_page__all(temp, rdr);
Xowd_page_itm page = Read_data_to_page(temp);
tbl.Read_page__all(load, rdr);
// get page reference from list; copy load values into it; COMMENT:2016-08-28
Xowd_page_itm page = this.Get_page_or_null(load);
if (page == null) continue; // page not found
temp.Exists_(true);
page.Copy(temp);
page.Copy(load);
}
}
}

View File

@@ -37,5 +37,5 @@ class Xowd_page_tbl__ttl extends Xowd_page_tbl__in_wkr__base {
stmt.Val_bry_as_str(page.Ttl_page_db());
}
}
@Override public Xowd_page_itm Read_data_to_page(Xowd_page_itm rdr_page) {return (Xowd_page_itm)hash.Get_by(rdr_page.Ttl_page_db());}
@Override protected Xowd_page_itm Get_page_or_null(Xowd_page_itm rdr_page) {return (Xowd_page_itm)hash.Get_by(rdr_page.Ttl_page_db());}
}

View File

@@ -42,7 +42,7 @@ class Xowd_page_tbl__ttl_ns extends Xowd_page_tbl__in_wkr__base {
stmt.Crt_bry_as_str(page_tbl.Fld_page_title(), page.Ttl_page_db());
}
}
@Override public Xowd_page_itm Read_data_to_page(Xowd_page_itm rdr_page) {
@Override protected Xowd_page_itm Get_page_or_null(Xowd_page_itm rdr_page) {
Xow_ns ns = ns_mgr.Ids_get_or_null(rdr_page.Ns_id());
if (ns == null) return null; // NOTE: ns seems to "randomly" be null when threading during redlinks; guard against null; DATE:2014-01-03
byte[] ttl_wo_ns = rdr_page.Ttl_page_db();