mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.11.1.1
This commit is contained in:
@@ -16,7 +16,7 @@ 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.wikis.dbs; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
|
||||
import gplx.core.primitives.*; import gplx.core.brys.*; import gplx.core.flds.*; import gplx.xowa.bldrs.cmds.ctgs.*; import gplx.xowa.wikis.ctgs.*; import gplx.xowa.specials.search.*;
|
||||
import gplx.core.primitives.*; import gplx.core.brys.*; import gplx.core.flds.*; import gplx.xowa.bldrs.cmds.ctgs.*; import gplx.xowa.wikis.ctgs.*; import gplx.xowa.specials.search.*; import gplx.core.encoders.*;
|
||||
import gplx.xowa.wikis.nss.*;
|
||||
import gplx.xowa.wikis.data.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
import gplx.xowa.wikis.tdbs.*; import gplx.xowa.wikis.tdbs.hives.*; import gplx.xowa.wikis.tdbs.xdats.*;
|
||||
@@ -34,7 +34,7 @@ public class Xodb_load_mgr_txt implements Xodb_load_mgr {
|
||||
public void Load_page(Xowd_page_itm rv, Xow_ns ns, boolean timestamp_enabled) {Load_page(rv, rv.Text_db_id(), rv.Tdb_row_idx(), ns, timestamp_enabled, tmp_xdat_file, tmp_xdat_itm);}
|
||||
public void Load_page(Xowd_page_itm rv, int txt_fil_idx, int txt_row_idx, Xow_ns ns, boolean timestamp_enabled, Xob_xdat_file xdat_file, Xob_xdat_itm xdat_itm) {
|
||||
Io_url file = fsys_mgr.Url_ns_fil(Xotdb_dir_info_.Tid_page, ns.Id(), txt_fil_idx);
|
||||
byte[] bry = gplx.ios.Io_stream_rdr_.Load_all(file); int bry_len = bry.length;
|
||||
byte[] bry = gplx.core.ios.Io_stream_rdr_.Load_all(file); int bry_len = bry.length;
|
||||
xdat_file.Clear().Parse(bry, bry_len, file).GetAt(xdat_itm, txt_row_idx);
|
||||
Load_page_parse(rv, bry, bry_len, xdat_itm.Itm_bgn(), xdat_itm.Itm_end(), timestamp_enabled);
|
||||
}
|
||||
@@ -60,7 +60,7 @@ public class Xodb_load_mgr_txt implements Xodb_load_mgr {
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (cancelable.Canceled()) return;
|
||||
Xowd_page_itm itm = (Xowd_page_itm)list.Get_at(i + bgn);
|
||||
Base85_utl.XtoStrByAry(itm.Id(), id_bry, 0, 5);
|
||||
Base85_.Set_bry(itm.Id(), id_bry, 0, 5);
|
||||
int cur_fil_idx = this.Find_file_idx_by_site(Xotdb_dir_info_.Tid_id, id_bry);
|
||||
if (cur_fil_idx != prv_fil_idx) {
|
||||
if (!this.Load_xdat_file(cancelable, tmp_xdat_file, Xotdb_dir_info_.Tid_id, cur_fil_idx)) continue; // file not found; ignore
|
||||
@@ -115,13 +115,13 @@ public class Xodb_load_mgr_txt implements Xodb_load_mgr {
|
||||
byte[] raw = rdr.Src();
|
||||
int itm_bgn = xdat_itm.Itm_bgn(), itm_end = xdat_itm.Itm_end();
|
||||
int pos = Bry_find_.Find_fwd(raw, Byte_ascii.Pipe, itm_bgn, raw.length);
|
||||
if (pos == Bry_.NotFound) throw wiki.Appe().Usr_dlg().Fail_many(GRP_KEY, "invalid_search_file", "search file is invalid");
|
||||
if (pos == Bry_find_.Not_found) throw wiki.Appe().Usr_dlg().Fail_many(GRP_KEY, "invalid_search_file", "search file is invalid");
|
||||
pos += Int_.Const_dlm_len; // pipe
|
||||
|
||||
while (pos < itm_end) {
|
||||
int page_id = Base85_utl.XtoIntByAry(raw, pos, pos + 4);
|
||||
int page_id = Base85_.To_int_by_bry(raw, pos, pos + 4);
|
||||
pos += 6; // 5 + 1 for semic;
|
||||
int page_len = Base85_utl.XtoIntByAry(raw, pos, pos + 4);
|
||||
int page_len = Base85_.To_int_by_bry(raw, pos, pos + 4);
|
||||
rv.Add(Xowd_page_itm.new_srch(page_id, page_len));
|
||||
pos += 6; // 5 + 1 for pipe
|
||||
// if (match.Itms_len() == max_results) break;
|
||||
@@ -161,9 +161,9 @@ public class Xodb_load_mgr_txt implements Xodb_load_mgr {
|
||||
byte[] bry = tmp_xdat_itm.Itm_bry();
|
||||
int bgn = name.length + 1;
|
||||
boolean hidden = bry[bgn] == Byte_ascii.Ltr_y;
|
||||
int count_subcs = Base85_utl.XtoIntByAry(bry, bgn + 2, bgn + 6);
|
||||
int count_files = Base85_utl.XtoIntByAry(bry, bgn + 8, bgn + 12);
|
||||
int count_pages = Base85_utl.XtoIntByAry(bry, bgn + 14, bgn + 18);
|
||||
int count_subcs = Base85_.To_int_by_bry(bry, bgn + 2, bgn + 6);
|
||||
int count_files = Base85_.To_int_by_bry(bry, bgn + 8, bgn + 12);
|
||||
int count_pages = Base85_.To_int_by_bry(bry, bgn + 14, bgn + 18);
|
||||
rv.Hidden_(hidden);
|
||||
for (byte i = 0; i < Xoa_ctg_mgr.Tid__max; i++) {
|
||||
Xoctg_idx_mgr idx_mgr = rv.Grp_by_tid(i);
|
||||
@@ -178,7 +178,7 @@ public class Xodb_load_mgr_txt implements Xodb_load_mgr {
|
||||
idx_mgr.Total_(count);
|
||||
}
|
||||
}
|
||||
public boolean Load_by_id(Xowd_page_itm page, int id) {Base85_utl.XtoStrByAry(id, tmp_id_bry, 0, 5); return Load_by_id(page, tmp_id_bry);} private byte[] tmp_id_bry = new byte[5];
|
||||
public boolean Load_by_id(Xowd_page_itm page, int id) {Base85_.Set_bry(id, tmp_id_bry, 0, 5); return Load_by_id(page, tmp_id_bry);} private byte[] tmp_id_bry = new byte[5];
|
||||
boolean Load_by_id(Xowd_page_itm page, byte[] id_bry) {
|
||||
if (!Load_xdat_itm(tmp_xdat_itm, Xotdb_dir_info_.Tid_id, id_bry, true)) return false;;
|
||||
Xotdb_page_itm_.Txt_id_load(page, tmp_xdat_itm.Itm_bry());
|
||||
@@ -321,16 +321,16 @@ public class Xodb_load_mgr_txt implements Xodb_load_mgr {
|
||||
private static void Load_ctg_v1_parse(List_adp rv, Gfo_usr_dlg usr_dlg, byte[] ary) {
|
||||
int aryLen = ary.length;
|
||||
int pos = Bry_find_.Find_fwd(ary, Byte_ascii.Pipe, 0, aryLen);
|
||||
int rowCount = (aryLen - pos + 1) / (Base85_utl.Len_int + gplx.xowa.apps.progs.Xoa_prog_mgr.Len_dlm_fld);
|
||||
int rowCount = (aryLen - pos + 1) / (Base85_.Len_int + gplx.xowa.apps.progs.Xoa_prog_mgr.Len_dlm_fld);
|
||||
rv.Clear();
|
||||
boolean garbage = false;
|
||||
for (int i = 0; i < rowCount; i++) {
|
||||
Xowd_page_itm row = new Xowd_page_itm();
|
||||
rv.Add(row);
|
||||
if (garbage) continue;
|
||||
int bgn = pos + 1 + (i * (Base85_utl.Len_int + gplx.xowa.apps.progs.Xoa_prog_mgr.Len_dlm_fld));
|
||||
int bgn = pos + 1 + (i * (Base85_.Len_int + gplx.xowa.apps.progs.Xoa_prog_mgr.Len_dlm_fld));
|
||||
try {
|
||||
int id = Base85_utl.XtoIntByAry(ary, bgn, bgn + Base85_utl.Len_int - 1);
|
||||
int id = Base85_.To_int_by_bry(ary, bgn, bgn + Base85_.Len_int - 1);
|
||||
if (id < 0) throw Err_.new_wo_type("invalid id", "id", id);
|
||||
row.Id_(id);
|
||||
}
|
||||
@@ -357,7 +357,7 @@ public class Xodb_load_mgr_txt implements Xodb_load_mgr {
|
||||
public static boolean Load_page_or_false(Xowd_page_itm page, Xob_xdat_itm xdat, int ns_id) {
|
||||
byte[] src = xdat.Src(); int itm_end = xdat.Itm_end();
|
||||
int bgn = xdat.Itm_bgn();
|
||||
int timestamp = Base85_utl.XtoIntByAry(src, bgn + 6 , bgn + 10);
|
||||
int timestamp = Base85_.To_int_by_bry(src, bgn + 6 , bgn + 10);
|
||||
int ttl_end = Bry_find_.Find_fwd(src, Xotdb_page_itm_.Txt_page_dlm, bgn + 12, itm_end);
|
||||
if (ttl_end == -1) return false;
|
||||
byte[] ttl = Bry_.Mid (src, bgn + 12 , ttl_end);
|
||||
@@ -371,7 +371,7 @@ public class Xodb_load_mgr_txt implements Xodb_load_mgr {
|
||||
int timestamp_bgn = row_bgn + 5 + 1;
|
||||
int timestamp_end = timestamp_bgn + 5;
|
||||
if (timestamp_enabled) {
|
||||
int timestamp = Base85_utl.XtoIntByAry(src, timestamp_bgn, timestamp_end - 1);
|
||||
int timestamp = Base85_.To_int_by_bry(src, timestamp_bgn, timestamp_end - 1);
|
||||
page.Modified_on_(Bit_.Xto_date_short(timestamp));
|
||||
}
|
||||
int name_bgn = timestamp_end + 1;
|
||||
|
||||
@@ -16,7 +16,7 @@ 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.wikis.dbs; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
|
||||
import gplx.dbs.*; import gplx.xowa.wikis.data.*; import gplx.xowa.htmls.hdumps.*;
|
||||
import gplx.dbs.*; import gplx.xowa.wikis.data.*; import gplx.xowa.htmls.core.*;
|
||||
public interface Xodb_mgr extends GfoInvkAble {
|
||||
byte Tid();
|
||||
String Tid_name();
|
||||
|
||||
@@ -16,8 +16,8 @@ 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.wikis.dbs; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
|
||||
import gplx.ios.*; import gplx.dbs.*; import gplx.dbs.qrys.*; import gplx.dbs.engines.sqlite.*;
|
||||
import gplx.xowa.apps.gfs.*; import gplx.xowa.wikis.data.tbls.*; import gplx.xowa.wikis.ctgs.*; import gplx.xowa.htmls.hdumps.*;
|
||||
import gplx.core.ios.*; import gplx.dbs.*; import gplx.dbs.qrys.*; import gplx.dbs.engines.sqlite.*;
|
||||
import gplx.xowa.apps.gfs.*; import gplx.xowa.wikis.data.tbls.*; import gplx.xowa.wikis.ctgs.*; import gplx.xowa.htmls.core.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.wikis.data.*;
|
||||
public class Xodb_mgr_sql implements Xodb_mgr, GfoInvkAble {
|
||||
public Xodb_mgr_sql(Xowe_wiki wiki) {
|
||||
|
||||
@@ -16,7 +16,7 @@ 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.wikis.dbs; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
|
||||
import gplx.ios.*; import gplx.dbs.*; import gplx.xowa.wikis.data.*; import gplx.xowa.wikis.ctgs.*; import gplx.xowa.htmls.hdumps.*; import gplx.xowa.wikis.tdbs.*; import gplx.xowa.wikis.nss.*;
|
||||
import gplx.core.ios.*; import gplx.dbs.*; import gplx.xowa.wikis.data.*; import gplx.xowa.wikis.ctgs.*; import gplx.xowa.htmls.core.*; import gplx.xowa.wikis.tdbs.*; import gplx.xowa.wikis.nss.*;
|
||||
public class Xodb_mgr_txt implements Xodb_mgr {
|
||||
public Xodb_mgr_txt(Xowe_wiki wiki, Xow_data_mgr data_mgr) {
|
||||
this.wiki = wiki;
|
||||
@@ -25,7 +25,7 @@ public class Xodb_mgr_txt implements Xodb_mgr {
|
||||
} private Xowe_wiki wiki;
|
||||
public byte Tid() {return Tid_txt;} public static final byte Tid_txt = 0;
|
||||
public String Tid_name() {return "xdat";}
|
||||
public byte Data_storage_format() {return data_storage_format;} public void Data_storage_format_(byte v) {data_storage_format = v;} private byte data_storage_format = gplx.ios.Io_stream_.Tid_raw;
|
||||
public byte Data_storage_format() {return data_storage_format;} public void Data_storage_format_(byte v) {data_storage_format = v;} private byte data_storage_format = gplx.core.ios.Io_stream_.Tid_raw;
|
||||
public Xodb_load_mgr Load_mgr() {return load_mgr;} private Xodb_load_mgr_txt load_mgr;
|
||||
public Xodb_save_mgr Save_mgr() {return save_mgr;} private Xodb_save_mgr_txt save_mgr;
|
||||
public DateAdp Dump_date_query() {
|
||||
|
||||
@@ -16,7 +16,7 @@ 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.wikis.dbs; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
|
||||
import gplx.ios.*;
|
||||
import gplx.core.ios.*;
|
||||
import gplx.xowa.wikis.data.tbls.*;
|
||||
import gplx.xowa.wikis.nss.*;
|
||||
import gplx.xowa.wikis.tdbs.*; import gplx.xowa.wikis.tdbs.hives.*; import gplx.xowa.wikis.tdbs.xdats.*;
|
||||
|
||||
@@ -16,7 +16,7 @@ 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.wikis.dbs; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
|
||||
import gplx.ios.*; import gplx.dbs.*; import gplx.xowa.wikis.data.*; import gplx.xowa.wikis.data.tbls.*; import gplx.dbs.qrys.*;
|
||||
import gplx.core.ios.*; import gplx.dbs.*; import gplx.xowa.wikis.data.*; import gplx.xowa.wikis.data.tbls.*; import gplx.dbs.qrys.*;
|
||||
import gplx.xowa.wikis.*;
|
||||
public class Xodb_save_mgr_sql implements Xodb_save_mgr {
|
||||
private final Xodb_mgr_sql db_mgr;
|
||||
|
||||
@@ -43,7 +43,7 @@ public class Xodb_save_mgr_txt implements Xodb_save_mgr {
|
||||
int ns_id = ttl.Ns().Id();
|
||||
Xotdb_page_itm_.Txt_page_save(tmp, page_id, DateAdp_.Now(), ttl_bry, text, true);
|
||||
Io_url page_rdr_url = fsys_mgr.Url_ns_fil(Xotdb_dir_info_.Tid_page, ns_id, fil_idx);
|
||||
byte[] page_rdr_bry = gplx.ios.Io_stream_rdr_.Load_all(page_rdr_url);
|
||||
byte[] page_rdr_bry = gplx.core.ios.Io_stream_rdr_.Load_all(page_rdr_url);
|
||||
Xob_xdat_file page_rdr = new Xob_xdat_file();
|
||||
if (Bry_.Len_gt_0(page_rdr_bry)) page_rdr.Parse(page_rdr_bry, page_rdr_bry.length, page_rdr_url);
|
||||
int row_idx = page_rdr.Count();
|
||||
@@ -114,8 +114,8 @@ public class Xodb_save_mgr_txt implements Xodb_save_mgr {
|
||||
class Bry_comparer_fld_last implements gplx.lists.ComparerAble {
|
||||
public int compare(Object lhsObj, Object rhsObj) {
|
||||
byte[] lhs = (byte[])lhsObj, rhs = (byte[])rhsObj;
|
||||
int lhs_bgn = Bry_find_.Find_bwd(lhs, Byte_ascii.Pipe); if (lhs_bgn == Bry_.NotFound) lhs_bgn = -1;
|
||||
int rhs_bgn = Bry_find_.Find_bwd(rhs, Byte_ascii.Pipe); if (rhs_bgn == Bry_.NotFound) rhs_bgn = -1;
|
||||
int lhs_bgn = Bry_find_.Find_bwd(lhs, Byte_ascii.Pipe); if (lhs_bgn == Bry_find_.Not_found) lhs_bgn = -1;
|
||||
int rhs_bgn = Bry_find_.Find_bwd(rhs, Byte_ascii.Pipe); if (rhs_bgn == Bry_find_.Not_found) rhs_bgn = -1;
|
||||
return Bry_.Compare(lhs, lhs_bgn + 1, lhs.length, rhs, rhs_bgn + 1, rhs.length);
|
||||
}
|
||||
public static final Bry_comparer_fld_last Instance = new Bry_comparer_fld_last();
|
||||
|
||||
Reference in New Issue
Block a user