mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
'v3.8.1.1'
This commit is contained in:
@@ -22,5 +22,5 @@ public class Bry_comparer implements ComparerAble {
|
||||
byte[] lhs = (byte[])lhsObj, rhs = (byte[])rhsObj;
|
||||
return Bry_.Compare(lhs, 0, lhs.length, rhs, 0, rhs.length);
|
||||
}
|
||||
public static final Bry_comparer Instance = new Bry_comparer(); Bry_comparer() {}
|
||||
public static final Bry_comparer Instance = new Bry_comparer(); Bry_comparer() {} // TS.static
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class Gfo_cache_itm_comparer implements gplx.core.lists.ComparerAble {
|
||||
Gfo_cache_itm rhs = (Gfo_cache_itm)rhsObj;
|
||||
return Long_.Compare(lhs.Touched(), rhs.Touched());
|
||||
}
|
||||
public static final Gfo_cache_itm_comparer Touched_asc = new Gfo_cache_itm_comparer();
|
||||
public static final Gfo_cache_itm_comparer Touched_asc = new Gfo_cache_itm_comparer(); // TS.static
|
||||
}
|
||||
class Io_url_exists_mgr {
|
||||
private gplx.core.caches.Gfo_cache_mgr_bry cache_mgr = new gplx.core.caches.Gfo_cache_mgr_bry();
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.core.flds; import gplx.*; import gplx.core.*;
|
||||
import gplx.core.encoders.*;
|
||||
public class Gfo_fld_rdr extends Gfo_fld_base {
|
||||
private Bry_bfr bfr = Bry_bfr_.New(); private static final byte[] Bry_nil = Bry_.new_a7("\\0");
|
||||
private Bry_bfr bfr = Bry_bfr_.New();
|
||||
public byte[] Data() {return data;} public Gfo_fld_rdr Data_(byte[] v) {data = v; data_len = v.length; pos = 0; return this;} private byte[] data; int data_len;
|
||||
public int Pos() {return pos;} public Gfo_fld_rdr Pos_(int v) {pos = v; return this;} private int pos;
|
||||
public int Fld_bgn() {return fld_bgn;} public Gfo_fld_rdr Fld_bgn_(int v) {fld_bgn = v; return this;} private int fld_bgn;
|
||||
@@ -122,4 +122,5 @@ public class Gfo_fld_rdr extends Gfo_fld_base {
|
||||
public Gfo_fld_rdr Ctor_sql() {return (Gfo_fld_rdr)super.Ctor_sql_base();}
|
||||
public static Gfo_fld_rdr xowa_() {return new Gfo_fld_rdr().Ctor_xdat();}
|
||||
public static Gfo_fld_rdr sql_() {return new Gfo_fld_rdr().Ctor_sql();}
|
||||
private static final byte[] Bry_nil = Bry_.new_a7("\\0");
|
||||
}
|
||||
|
||||
@@ -25,5 +25,5 @@ class Io_sort_filCmd_null implements Io_sort_filCmd {
|
||||
public void Bfr_add(Io_line_rdr stream) {}
|
||||
public void Fil_bgn(Io_line_rdr stream) {}
|
||||
public void Fil_end() {}
|
||||
public static final Io_sort_filCmd_null Instance = new Io_sort_filCmd_null(); Io_sort_filCmd_null() {}
|
||||
public static final Io_sort_filCmd_null Instance = new Io_sort_filCmd_null(); Io_sort_filCmd_null() {} // TS.static
|
||||
}
|
||||
|
||||
@@ -19,8 +19,7 @@ package gplx.core.ios; import gplx.*; import gplx.core.*;
|
||||
public class Io_sort_split_itm_sorter implements gplx.core.lists.ComparerAble {
|
||||
public int compare(Object lhsObj, Object rhsObj) {
|
||||
Io_sort_split_itm lhs = (Io_sort_split_itm)lhsObj, rhs = (Io_sort_split_itm)rhsObj;
|
||||
// Tfds.Dbg(String_.new_u8(lhs.Bfr(), lhs.Key_bgn(), lhs.Key_end()), String_.new_u8(rhs.Bfr(), rhs.Key_bgn(), rhs.Key_end()));
|
||||
return Bry_.Compare(lhs.Bfr(), lhs.Key_bgn(), lhs.Key_end(), rhs.Bfr(), rhs.Key_bgn(), rhs.Key_end());
|
||||
}
|
||||
public static final Io_sort_split_itm_sorter Instance = new Io_sort_split_itm_sorter(); Io_sort_split_itm_sorter() {}
|
||||
public static final Io_sort_split_itm_sorter Instance = new Io_sort_split_itm_sorter(); Io_sort_split_itm_sorter() {} // TS.static
|
||||
}
|
||||
|
||||
@@ -16,21 +16,21 @@ 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.core.primitives; import gplx.*; import gplx.core.*;
|
||||
public class Number_parser {
|
||||
public class Gfo_number_parser {
|
||||
public int Rv_as_int() {return (int)num_val;} private long num_val = 0;
|
||||
public long Rv_as_long() {return num_val;}
|
||||
public Decimal_adp Rv_as_dec() {return dec_val == null ? Decimal_adp_.long_(num_val) : dec_val;} private Decimal_adp dec_val = null;
|
||||
public boolean Is_int() {return dec_val == null && (num_val >= Int_.Min_value && num_val <= Int_.Max_value);}
|
||||
public boolean Has_err() {return has_err;} private boolean has_err;
|
||||
public boolean Has_frac() {return has_frac;} private boolean has_frac;
|
||||
public boolean Hex_enabled() {return hex_enabled;} public Number_parser Hex_enabled_(boolean v) {hex_enabled = v; return this;} private boolean hex_enabled;
|
||||
public Number_parser Ignore_chars_(byte[] v) {this.ignore_chars = v; return this;} private byte[] ignore_chars;
|
||||
public Number_parser Ignore_space_at_end_y_() {this.ignore_space_at_end = true; return this;} private boolean ignore_space_at_end;
|
||||
public boolean Hex_enabled() {return hex_enabled;} public Gfo_number_parser Hex_enabled_(boolean v) {hex_enabled = v; return this;} private boolean hex_enabled;
|
||||
public Gfo_number_parser Ignore_chars_(byte[] v) {this.ignore_chars = v; return this;} private byte[] ignore_chars;
|
||||
public Gfo_number_parser Ignore_space_at_end_y_() {this.ignore_space_at_end = true; return this;} private boolean ignore_space_at_end;
|
||||
public void Clear() {
|
||||
ignore_chars = null;
|
||||
}
|
||||
public Number_parser Parse(byte[] src) {return Parse(src, 0, src.length);}
|
||||
public Number_parser Parse(byte[] ary, int bgn, int end) {
|
||||
public Gfo_number_parser Parse(byte[] src) {return Parse(src, 0, src.length);}
|
||||
public Gfo_number_parser Parse(byte[] ary, int bgn, int end) {
|
||||
int loop_bgn = end - 1, loop_end = bgn - 1, exp_multiplier = 1, factor = 10;
|
||||
long multiplier = 1, frc_multiplier = 1;
|
||||
num_val = 0; dec_val = null; boolean comma_nil = true;
|
||||
@@ -183,5 +183,5 @@ public class Number_parser {
|
||||
}
|
||||
return this;
|
||||
}
|
||||
private Number_parser Has_err_y_() {has_err = true; return this;}
|
||||
private Gfo_number_parser Has_err_y_() {has_err = true; return this;}
|
||||
}
|
||||
@@ -17,9 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.core.primitives; import gplx.*; import gplx.core.*;
|
||||
import org.junit.*;
|
||||
public class Number_parser_tst {
|
||||
private final Number_parser_fxt fxt = new Number_parser_fxt();
|
||||
@Before public void init() {fxt.Clear();}
|
||||
public class Gfo_number_parser_tst {
|
||||
@Before public void init() {fxt.Clear();} private final Gfo_number_parser_fxt fxt = new Gfo_number_parser_fxt();
|
||||
@Test public void Integer() {
|
||||
fxt.Test_int("1", 1);
|
||||
fxt.Test_int("1234", 1234);
|
||||
@@ -71,8 +70,8 @@ public class Number_parser_tst {
|
||||
fxt.Test_err("1\r" , true);
|
||||
}
|
||||
}
|
||||
class Number_parser_fxt {
|
||||
private final Number_parser parser = new Number_parser();
|
||||
class Gfo_number_parser_fxt {
|
||||
private final Gfo_number_parser parser = new Gfo_number_parser();
|
||||
public void Clear() {parser.Clear();}
|
||||
public void Init_ignore(String chars) {parser.Ignore_chars_(Bry_.new_a7(chars));}
|
||||
public void Test_int(String raw, int expd) {
|
||||
@@ -15,10 +15,15 @@ GNU Affero General Public License for more details.
|
||||
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.ctgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
|
||||
import org.junit.*;
|
||||
public class Xoctg_view_ctg_tst {
|
||||
// @Before public void init() {fxt.Clear();} private Xoctg_idx_mgr_fxt fxt = new Xoctg_idx_mgr_fxt();
|
||||
@Test public void Basic() {
|
||||
package gplx.core.primitives; import gplx.*; import gplx.core.*;
|
||||
public class Hash_adp__primitive {
|
||||
private final Hash_adp hash = Hash_adp_.New();
|
||||
public byte Get_by_str_or_max(String key) {
|
||||
Byte_obj_val rv = (Byte_obj_val)hash.Get_by(key);
|
||||
return rv == null ? Byte_.Max_value_127 : rv.Val();
|
||||
}
|
||||
public Hash_adp__primitive Add_byte(String key, byte val) {
|
||||
hash.Add(key, Byte_obj_val.new_(val));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.core.primitives; import gplx.*; import gplx.core.*;
|
||||
public class Int_ary_parser extends Obj_ary_parser_base {
|
||||
Number_parser parser = new Number_parser(); int[] ary; int ary_idx;
|
||||
private final Gfo_number_parser parser = new Gfo_number_parser();
|
||||
private int[] ary; private int ary_idx;
|
||||
public int[] Parse_ary(String str, byte dlm) {byte[] bry = Bry_.new_u8(str); return Parse_ary(bry, 0, bry.length, dlm);}
|
||||
public int[] Parse_ary(byte[] bry, int bgn, int end, byte dlm) {
|
||||
Parse_core(bry, bgn, end, dlm, Byte_ascii.Null);
|
||||
@@ -35,5 +36,4 @@ public class Int_ary_parser extends Obj_ary_parser_base {
|
||||
parser.Parse(bry, bgn, end); if (parser.Has_err() || parser.Has_frac()) throw Err_.new_wo_type("failed to parse number", "val", String_.new_u8(bry, bgn, end));
|
||||
ary[ary_idx++] = parser.Rv_as_int();
|
||||
}
|
||||
public static final Int_ary_parser Instance = new Int_ary_parser();
|
||||
}
|
||||
|
||||
@@ -16,13 +16,15 @@ 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.core.primitives; import gplx.*; import gplx.core.*;
|
||||
import org.junit.*;
|
||||
import org.junit.*; import gplx.core.tests.*;
|
||||
public class Int_ary_parser_tst {
|
||||
@Test public void Many() {tst_ints("1,2,3,4,5" , 0, 9, Int_.Ary(1, 2, 3, 4, 5));}
|
||||
@Test public void One() {tst_ints("1" , 0, 1, Int_.Ary(1));}
|
||||
@Test public void None() {tst_ints("" , 0, 0, Int_.Ary());}
|
||||
private void tst_ints(String raw, int bgn, int end, int[] expd) {
|
||||
int[] actl = Int_ary_parser.Instance.Parse_ary(Bry_.new_a7(raw), bgn, end, Byte_ascii.Comma);
|
||||
Tfds.Eq_ary(expd, actl);
|
||||
private final Int_ary_parser_fxt fxt = new Int_ary_parser_fxt();
|
||||
@Test public void Many() {fxt.Test__Parse_ary("1,2,3,4,5" , 0, 9, Int_.Ary(1, 2, 3, 4, 5));}
|
||||
@Test public void One() {fxt.Test__Parse_ary("1" , 0, 1, Int_.Ary(1));}
|
||||
@Test public void None() {fxt.Test__Parse_ary("" , 0, 0, Int_.Ary());}
|
||||
}
|
||||
class Int_ary_parser_fxt {
|
||||
public void Test__Parse_ary(String raw, int bgn, int end, int[] expd) {
|
||||
Gftest.Eq__ary(expd, new Int_ary_parser().Parse_ary(Bry_.new_a7(raw), bgn, end, Byte_ascii.Comma), "parse_ary failed");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class Int_pool {
|
||||
return;
|
||||
}
|
||||
if (available_len == uid_max) {
|
||||
available_list.Add(Int_obj_val.new_(v));
|
||||
available_list.Add(new Int_obj_val(v));
|
||||
available_list.Sort();
|
||||
for (int i = 0; i < available_len; ++i) {
|
||||
Int_obj_val itm = (Int_obj_val)available_list.Get_at(i);
|
||||
@@ -62,7 +62,7 @@ public class Int_pool {
|
||||
}
|
||||
else {
|
||||
// dbg_bfr.Add_str("-:a:").Add_int_variable(v).Add_byte_nl();
|
||||
available_list.Add(Int_obj_val.new_(v));
|
||||
available_list.Add(new Int_obj_val(v));
|
||||
++available_len;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class Db_tbl_copy {
|
||||
trg_conn.Meta_tbl_remake(Dbmeta_tbl_itm.New(trg_tbl, tbl.Flds().To_ary(), tbl.Idxs().To_ary()));
|
||||
|
||||
// do copy
|
||||
attach_mgr.Conn_main_(trg_conn).Conn_others_(new Db_attach_itm("src_db", src_conn));
|
||||
attach_mgr.Conn_main_(trg_conn).Conn_links_(new Db_attach_itm("src_db", src_conn));
|
||||
attach_mgr.Exec_sql(Bld_sql(tbl, src_tbl, trg_tbl));
|
||||
}
|
||||
public String Bld_sql(Dbmeta_tbl_itm tbl, String src_tbl, String trg_tbl) {
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.langs.gfs; import gplx.*; import gplx.langs.*;
|
||||
import gplx.core.gfo_regys.*;
|
||||
public class Gfs_msg_bldr implements GfoMsgParser {
|
||||
private final Gfs_parser parser = new Gfs_parser();
|
||||
private final Gfs_parser parser = new Gfs_parser();
|
||||
public GfoMsg ParseToMsg(String s) {return Bld(s);}
|
||||
public GfoMsg Bld(String src) {return Bld(Bry_.new_u8(src));}
|
||||
public GfoMsg Bld(byte[] src) {
|
||||
@@ -45,6 +45,6 @@ public class Gfs_msg_bldr implements GfoMsgParser {
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
public static final Gfs_msg_bldr Instance = new Gfs_msg_bldr(); Gfs_msg_bldr() {}
|
||||
public static final Gfs_msg_bldr Instance = new Gfs_msg_bldr(); Gfs_msg_bldr() {} // TS.static
|
||||
public static final String Tkn_mutator = "_";
|
||||
}
|
||||
|
||||
@@ -18,11 +18,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.langs.htmls; import gplx.*; import gplx.langs.*;
|
||||
import gplx.core.primitives.*; import gplx.core.btries.*; import gplx.langs.htmls.encoders.*;
|
||||
public class Gfh_utl {
|
||||
private static final Gfo_url_encoder encoder_id = Gfo_url_encoder_.Id; private static final Bry_bfr tmp_bfr = Bry_bfr_.Reset(255);
|
||||
private static final Gfo_url_encoder encoder_id = Gfo_url_encoder_.Id;
|
||||
public static String Encode_id_as_str(byte[] key) {return String_.new_u8(Encode_id_as_bry(key));}
|
||||
public static byte[] Encode_id_as_bry(byte[] key) {
|
||||
byte[] escaped = Escape_html_as_bry(tmp_bfr, key, Bool_.N, Bool_.N, Bool_.N, Bool_.Y, Bool_.Y);
|
||||
return encoder_id.Encode(escaped);
|
||||
Bry_bfr tmp_bfr = Bry_bfr_.Get();
|
||||
try {
|
||||
byte[] escaped = Escape_html_as_bry(tmp_bfr, key, Bool_.N, Bool_.N, Bool_.N, Bool_.Y, Bool_.Y);
|
||||
return encoder_id.Encode(escaped);
|
||||
} finally {tmp_bfr.Mkr_rls();}
|
||||
}
|
||||
public static String Escape_for_atr_val_as_str(Bry_bfr bfr, byte quote_byte, String s) {return String_.new_u8(Escape_for_atr_val_as_bry(bfr, quote_byte, s));}
|
||||
public static byte[] Escape_for_atr_val_as_bry(Bry_bfr bfr, byte quote_byte, String s) {
|
||||
@@ -58,9 +61,16 @@ public class Gfh_utl {
|
||||
}
|
||||
public static String Escape_html_as_str(String v) {return String_.new_u8(Escape_html_as_bry(Bry_.new_u8(v)));}
|
||||
public static byte[] Escape_html_as_bry(Bry_bfr tmp, byte[] bry) {return Escape_html(false, tmp, bry, 0, bry.length, true, true, true, true, true);}
|
||||
public static byte[] Escape_html_as_bry(byte[] bry) {return Escape_html(false, tmp_bfr, bry, 0, bry.length, true, true, true, true, true);}
|
||||
public static byte[] Escape_html_as_bry(byte[] bry, boolean lt, boolean gt, boolean amp, boolean quote, boolean apos)
|
||||
{return Escape_html(false, tmp_bfr, bry, 0, bry.length, lt, gt, amp, quote, apos);}
|
||||
public static byte[] Escape_html_as_bry(byte[] bry) {
|
||||
Bry_bfr tmp_bfr = Bry_bfr_.Get();
|
||||
try {return Escape_html(false, tmp_bfr, bry, 0, bry.length, true, true, true, true, true);}
|
||||
finally {tmp_bfr.Mkr_rls();}
|
||||
}
|
||||
public static byte[] Escape_html_as_bry(byte[] bry, boolean lt, boolean gt, boolean amp, boolean quote, boolean apos) {
|
||||
Bry_bfr tmp_bfr = Bry_bfr_.Get();
|
||||
try {return Escape_html(false, tmp_bfr, bry, 0, bry.length, lt, gt, amp, quote, apos);}
|
||||
finally {tmp_bfr.Mkr_rls();}
|
||||
}
|
||||
public static byte[] Escape_html_as_bry(Bry_bfr bfr, byte[] bry, boolean lt, boolean gt, boolean amp, boolean quote, boolean apos)
|
||||
{return Escape_html(false, bfr, bry, 0, bry.length, lt, gt, amp, quote, apos);}
|
||||
public static void Escape_html_to_bfr(Bry_bfr bfr, byte[] bry, int bgn, int end, boolean escape_lt, boolean escape_gt, boolean escape_amp, boolean escape_quote, boolean escape_apos) {
|
||||
|
||||
@@ -53,7 +53,7 @@ public class Gfo_url_encoder_ {
|
||||
private static Gfo_url_encoder_mkr New__html_href_qarg() { // same as regular href encoder, but also do not encode qarg characters "?" and "="
|
||||
return New__html_href_mw(Bool_.Y).Init__same__many(Byte_ascii.Question, Byte_ascii.Eq);
|
||||
}
|
||||
private static Gfo_url_encoder_mkr New__html_href_quotes() {// same as href encoder, but do not encode ?, =, #, +; also, don't encode "%" vals
|
||||
public static Gfo_url_encoder_mkr New__html_href_quotes() {// same as href encoder, but do not encode ?, =, #, +; also, don't encode "%" vals
|
||||
return new Gfo_url_encoder_mkr().Init(Byte_ascii.Percent).Init_common(Bool_.Y)
|
||||
.Init__diff__one(Byte_ascii.Space, Byte_ascii.Underline)
|
||||
.Init__same__many
|
||||
|
||||
@@ -24,7 +24,7 @@ public interface Gfo_url_encoder_itm {
|
||||
class Gfo_url_encoder_itm_same implements Gfo_url_encoder_itm {
|
||||
public int Encode(Bry_bfr bfr, byte[] src, int end, int idx, byte b) {bfr.Add_byte(b); return 0;}
|
||||
public int Decode(Bry_bfr bfr, byte[] src, int end, int idx, byte b, boolean fail_when_invalid) {bfr.Add_byte(b); return 0;}
|
||||
public static final Gfo_url_encoder_itm Instance = new Gfo_url_encoder_itm_same();
|
||||
public static final Gfo_url_encoder_itm Instance = new Gfo_url_encoder_itm_same(); // TS.static
|
||||
}
|
||||
class Gfo_url_encoder_itm_diff implements Gfo_url_encoder_itm {
|
||||
private final byte orig, repl;
|
||||
|
||||
@@ -33,7 +33,7 @@ public class Json_doc {
|
||||
public Json_nde Root_nde() {return root_nde;} private Json_nde root_nde;
|
||||
public Json_ary Root_ary() {return root_ary;} private Json_ary root_ary;
|
||||
public Bry_bfr Bfr() {return bfr;} private final Bry_bfr bfr = Bry_bfr_.New();
|
||||
public Number_parser Utl_num_parser() {return utl_num_parser;} private final Number_parser utl_num_parser = new Number_parser();
|
||||
public Gfo_number_parser Utl_num_parser() {return utl_num_parser;} private final Gfo_number_parser utl_num_parser = new Gfo_number_parser();
|
||||
public byte[] Tmp_u8_bry() {return tmp_u8_bry;} private final byte[] tmp_u8_bry = new byte[6]; // tmp bry[] for decoding sequences like \u0008
|
||||
public byte[] Get_val_as_bry_or(byte[] qry_bry, byte[] or) {tmp_qry_bry[0] = qry_bry; return Get_val_as_bry_or(tmp_qry_bry, or);}
|
||||
public byte[] Get_val_as_bry_or(byte[][] qry_bry, byte[] or) {
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.langs.jsons; import gplx.*; import gplx.langs.*;
|
||||
import gplx.core.primitives.*;
|
||||
public class Json_parser {
|
||||
private byte[] src; private int src_len, pos; private final Number_parser num_parser = new Number_parser();
|
||||
private byte[] src; private int src_len, pos; private final Gfo_number_parser num_parser = new Gfo_number_parser();
|
||||
public Json_factory Factory() {return factory;} private final Json_factory factory = new Json_factory();
|
||||
public Json_doc Parse_by_apos_ary(String... ary) {return Parse_by_apos(String_.Concat_lines_nl(ary));}
|
||||
public Json_doc Parse_by_apos(String s) {return Parse(Bry_.Replace(Bry_.new_u8(s), Byte_ascii.Apos, Byte_ascii.Quote));}
|
||||
|
||||
@@ -29,7 +29,7 @@ public abstract class Json_parser__itm__base {
|
||||
this.keys = keys;
|
||||
this.keys_len = keys.length;
|
||||
for (int i = 0; i < keys_len; ++i)
|
||||
hash.Add(Bry_.new_u8(keys[i]), Int_obj_val.new_(i));
|
||||
hash.Add(Bry_.new_u8(keys[i]), new Int_obj_val(i));
|
||||
this.atrs = new Json_kv[keys_len];
|
||||
}
|
||||
public int Kv__int(Json_kv[] ary, int i) {return Bry_.To_int(ary[i].Val_as_bry());}
|
||||
|
||||
@@ -16,10 +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; import gplx.*;
|
||||
import gplx.core.brys.*; import gplx.core.ios.*; import gplx.core.log_msgs.*;
|
||||
import gplx.langs.htmls.encoders.*;
|
||||
import gplx.xowa.guis.views.boots.*;
|
||||
import gplx.xowa.apps.boots.*; import gplx.xowa.apps.gfs.*;
|
||||
import gplx.core.log_msgs.*;
|
||||
import gplx.xowa.guis.views.boots.*; import gplx.xowa.apps.boots.*;
|
||||
public class Xoa_app_ {
|
||||
public static void Run(String... args) {
|
||||
Xoa_cmd_arg_mgr arg_mgr = Xoa_cmd_arg_mgr.new_();
|
||||
@@ -34,22 +32,17 @@ public class Xoa_app_ {
|
||||
}
|
||||
}
|
||||
public static final String Name = "xowa";
|
||||
public static final String Version = "3.7.4.1";
|
||||
public static final String Version = "3.8.1.1";
|
||||
public static String Build_date = "2012-12-30 00:00:00";
|
||||
public static String Op_sys_str;
|
||||
public static String User_agent = "";
|
||||
public static final Gfo_msg_grp Nde = Gfo_msg_grp_.prj_(Name);
|
||||
|
||||
public static Gfo_usr_dlg Usr_dlg() {return usr_dlg;} public static void Usr_dlg_(Gfo_usr_dlg v) {usr_dlg = v;} private static Gfo_usr_dlg usr_dlg;
|
||||
public static Bry_bfr_mkr Utl__bfr_mkr() {return utl__bry_bfr_mkr;} private static final Bry_bfr_mkr utl__bry_bfr_mkr = new Bry_bfr_mkr();
|
||||
public static Io_stream_zip_mgr Utl__zip_mgr() {return utl__zip_mgr;} private static final Io_stream_zip_mgr utl__zip_mgr = new Io_stream_zip_mgr();
|
||||
public static Xoa_gfs_mgr Gfs_mgr() {return gfs_mgr;} public static void Gfs_mgr_(Xoa_gfs_mgr v) {gfs_mgr = v;} private static Xoa_gfs_mgr gfs_mgr;
|
||||
public static void Plog_none(String mod, String fmt) {
|
||||
String msg = mod + ": " + fmt;
|
||||
Xoa_app_.Usr_dlg().Plog_many("", "", msg);
|
||||
}
|
||||
public static Gfo_usr_dlg usr_dlg_console_() {
|
||||
public static Gfo_usr_dlg New__usr_dlg__console() {
|
||||
Gfo_usr_dlg rv = new Gfo_usr_dlg_base(new Gfo_usr_dlg__log_base(), Gfo_usr_dlg__gui_.Console);
|
||||
rv.Log_wkr().Queue_enabled_(true);
|
||||
return rv;
|
||||
}
|
||||
|
||||
public static final Gfo_msg_grp Nde = Gfo_msg_grp_.prj_(Name);
|
||||
}
|
||||
|
||||
@@ -22,12 +22,10 @@ public interface Xoa_page {
|
||||
Xoa_url Url(); byte[] Url_bry_safe();
|
||||
Xoa_ttl Ttl();
|
||||
Xopg_db_data Db();
|
||||
Xopg_redirect_mgr Redirect();
|
||||
Xopg_redirect_mgr Redirect_trail();
|
||||
Xopg_html_data Html_data();
|
||||
Xopg_hdump_data Hdump_mgr();
|
||||
|
||||
// Xopg_lnki_list Redlink_list();
|
||||
|
||||
Xoa_page__commons_mgr Commons_mgr();
|
||||
void Xtn_gallery_packed_exists_y_();
|
||||
boolean Xtn__timeline_exists();
|
||||
|
||||
@@ -53,7 +53,11 @@ public class Xoa_ttl { // PAGE:en.w:http://en.wikipedia.org/wiki/Help:Link; REF.
|
||||
return rv;
|
||||
}
|
||||
public String Page_db_as_str() {return String_.new_u8(Page_db());}
|
||||
public byte[] Page_url_w_anch() {return Gfo_url_encoder_.Href.Encode(Bry_.Mid(full_txt, page_bgn, qarg_bgn == -1 ? full_txt.length : qarg_bgn - 1));}
|
||||
public byte[] Page_url_w_anch() {
|
||||
synchronized (href_encoder) { // LOCK:static-obj
|
||||
return href_encoder.Encode(Bry_.Mid(full_txt, page_bgn, qarg_bgn == -1 ? full_txt.length : qarg_bgn - 1));
|
||||
}
|
||||
}
|
||||
public int Leaf_bgn() {return leaf_bgn;}
|
||||
public byte[] Base_txt() {return leaf_bgn == -1 ? Page_txt() : Bry_.Mid(full_txt, page_bgn, leaf_bgn - 1);}
|
||||
public byte[] Leaf_txt() {return leaf_bgn == -1 ? Page_txt() : Bry_.Mid(full_txt, leaf_bgn, anch_bgn == -1 ? full_txt.length : anch_bgn - 1);}
|
||||
@@ -62,17 +66,41 @@ public class Xoa_ttl { // PAGE:en.w:http://en.wikipedia.org/wiki/Help:Link; REF.
|
||||
public byte[] Anch_txt() {return anch_bgn == -1 ? Bry_.Empty : Bry_.Mid(full_txt, anch_bgn, full_txt.length);}
|
||||
public byte[] Talk_txt() {return ns.Id_is_talk() ? Full_txt_w_ttl_case() : Bry_.Add(tors_txt, Page_txt());}
|
||||
public byte[] Subj_txt() {return ns.Id_is_subj() ? Full_txt_w_ttl_case() : Bry_.Add(tors_txt, Page_txt());}
|
||||
public byte[] Full_url() {return Gfo_url_encoder_.Href.Encode(full_txt);}
|
||||
public byte[] Full_url() {
|
||||
synchronized (href_encoder) { // LOCK:static-obj
|
||||
return Gfo_url_encoder_.Href.Encode(full_txt);
|
||||
}
|
||||
}
|
||||
public String Full_db_as_str() {return String_.new_u8(Full_db());}
|
||||
public byte[] Full_db() {return ns.Gen_ttl(this.Page_db());}
|
||||
public byte[] Full_db_w_anch() {return Replace_spaces(full_txt);}
|
||||
public byte[] Page_url() {return Xoa_url_encoder.Instance.Encode(this.Page_txt());}
|
||||
public byte[] Leaf_url() {return Xoa_url_encoder.Instance.Encode(this.Leaf_txt());}
|
||||
public byte[] Base_url() {return Xoa_url_encoder.Instance.Encode(this.Base_txt());}
|
||||
public byte[] Page_url() {
|
||||
synchronized (url_encoder) { // LOCK:static-obj
|
||||
return url_encoder.Encode(this.Page_txt());
|
||||
}
|
||||
}
|
||||
public byte[] Leaf_url() {
|
||||
synchronized (url_encoder) { // LOCK:static-obj
|
||||
return url_encoder.Encode(this.Leaf_txt());
|
||||
}
|
||||
}
|
||||
public byte[] Base_url() {
|
||||
synchronized (url_encoder) { // LOCK:static-obj
|
||||
return url_encoder.Encode(this.Base_txt());
|
||||
}
|
||||
}
|
||||
public byte[] Root_txt() {return root_bgn == -1 ? Page_txt() : Bry_.Mid(full_txt, page_bgn, root_bgn - 1);}
|
||||
public byte[] Rest_txt() {return root_bgn == -1 ? Page_txt() : Bry_.Mid(full_txt, root_bgn, anch_bgn == -1 ? full_txt.length : anch_bgn - 1);}
|
||||
public byte[] Talk_url() {return Xoa_url_encoder.Instance.Encode(this.Talk_txt());}
|
||||
public byte[] Subj_url() {return Xoa_url_encoder.Instance.Encode(this.Subj_txt());}
|
||||
public byte[] Talk_url() {
|
||||
synchronized (url_encoder) { // LOCK:static-obj
|
||||
return url_encoder.Encode(this.Talk_txt());
|
||||
}
|
||||
}
|
||||
public byte[] Subj_url() {
|
||||
synchronized (url_encoder) { // LOCK:static-obj
|
||||
return url_encoder.Encode(this.Subj_txt());
|
||||
}
|
||||
}
|
||||
public int Qarg_bgn() {return qarg_bgn;} private int qarg_bgn = -1;
|
||||
public byte[] Qarg_txt() {return this.Qarg_bgn() == -1 ? null : Bry_.Mid(full_txt, this.Qarg_bgn(), full_txt.length);}
|
||||
public byte[] Base_txt_wo_qarg() {
|
||||
@@ -110,6 +138,9 @@ public class Xoa_ttl { // PAGE:en.w:http://en.wikipedia.org/wiki/Help:Link; REF.
|
||||
.Add_many_int(Char__bidi , Bry_.New_by_ints(0xE2, 0x80, 0x8E), Bry_.New_by_ints(0xE2, 0x80, 0x8F), Bry_.New_by_ints(0xE2, 0x80, 0xAA), Bry_.New_by_ints(0xE2, 0x80, 0xAB), Bry_.New_by_ints(0xE2, 0x80, 0xAC), Bry_.New_by_ints(0xE2, 0x80, 0xAD), Bry_.New_by_ints(0xE2, 0x80, 0xAE))
|
||||
.Add_many_int(Char__ws , "\u00A0", "\u1680", "\u180E", "\u2000", "\u2001", "\u2002", "\u2003", "\u2004", "\u2005", "\u2006", "\u2007", "\u2008", "\u2009", "\u200A", "\u2028", "\u2029", "\u202F", "\u205F", "\u3000");
|
||||
|
||||
private final static Gfo_url_encoder href_encoder = Gfo_url_encoder_.New__html_href_mw(Bool_.Y).Make();
|
||||
private final static Xoa_url_encoder url_encoder = new Xoa_url_encoder();
|
||||
|
||||
public static byte[] Replace_spaces(byte[] raw) {return Bry_.Replace(raw, Byte_ascii.Space, Byte_ascii.Underline);}
|
||||
public static byte[] Replace_unders(byte[] raw) {return Replace_unders(raw, 0, raw.length);}
|
||||
public static byte[] Replace_unders(byte[] raw, int bgn, int end) {return Bry_.Replace(raw, bgn, end, Byte_ascii.Underline, Byte_ascii.Space);}
|
||||
|
||||
@@ -98,10 +98,12 @@ public class Xoa_url {
|
||||
, anch_spr, anch // add anch EX: "#", "B"
|
||||
);
|
||||
if (show_qargs || qargs_ary.length > 0) {
|
||||
Bry_bfr bfr = Xoa_app_.Utl__bfr_mkr().Get_b128();
|
||||
bfr.Add(rv);
|
||||
Gfo_qarg_mgr_old.Concat_bfr(bfr, gplx.langs.htmls.encoders.Gfo_url_encoder_.Href, qargs_ary);
|
||||
return bfr.To_bry_and_rls();
|
||||
Bry_bfr bfr = Bry_bfr_.New();
|
||||
try {
|
||||
bfr.Add(rv);
|
||||
Gfo_qarg_mgr_old.Concat_bfr(bfr, gplx.langs.htmls.encoders.Gfo_url_encoder_.Href, qargs_ary);
|
||||
return bfr.To_bry_and_clear();
|
||||
} finally {bfr.Mkr_rls();}
|
||||
}
|
||||
else
|
||||
return rv;
|
||||
|
||||
@@ -45,7 +45,8 @@ public class Xoae_app implements Xoa_app, Gfo_invk {
|
||||
url_cmd_eval = new Xoa_fsys_eval(fsys_mgr, user.Fsys_mgr());
|
||||
fsys_mgr.Init_by_app(prog_mgr);
|
||||
log_wtr.Log_dir_(user.Fsys_mgr().App_temp_dir().GenSubDir("log"));
|
||||
lang_mgr = new Xoa_lang_mgr(this);
|
||||
this.gfs_mgr = new Xoa_gfs_mgr(this, fsys_mgr, user.Fsys_mgr());
|
||||
lang_mgr = new Xoa_lang_mgr(this, gfs_mgr);
|
||||
wiki_mgr = new Xoae_wiki_mgr(this);
|
||||
gui_mgr = new Xoa_gui_mgr(this);
|
||||
this.gui__tab_mgr = new Xog_tab_mgr__swt(gui_mgr);
|
||||
@@ -57,7 +58,6 @@ public class Xoae_app implements Xoa_app, Gfo_invk {
|
||||
cur_redirect = new Xoa_cur(this);
|
||||
shell = new Xoa_shell(this);
|
||||
setup_mgr = new Xoi_setup_mgr(this);
|
||||
Xoa_app_.Gfs_mgr_(new Xoa_gfs_mgr(this, fsys_mgr, user.Fsys_mgr()));
|
||||
xtn_mgr = new Xow_xtn_mgr().Ctor_by_app(this);
|
||||
hive_mgr = new Xoa_hive_mgr(this);
|
||||
tcp_server.App_ctor(this);
|
||||
@@ -81,7 +81,7 @@ public class Xoae_app implements Xoa_app, Gfo_invk {
|
||||
public Xoa_css_extractor Html__css_installer() {return html__css_installer;} private final Xoa_css_extractor html__css_installer = new Xoa_css_extractor();
|
||||
public Xoh_bridge_mgr Html__bridge_mgr() {return html__bridge_mgr;} private final Xoh_bridge_mgr html__bridge_mgr;
|
||||
public Xowmf_mgr Wmf_mgr() {return wmf_mgr;} private final Xowmf_mgr wmf_mgr = new Xowmf_mgr();
|
||||
public Bry_bfr_mkr Utl__bfr_mkr() {return Xoa_app_.Utl__bfr_mkr();}
|
||||
public Bry_bfr_mkr Utl__bfr_mkr() {return utl__bry_bfr_mkr;} private final Bry_bfr_mkr utl__bry_bfr_mkr = new Bry_bfr_mkr();
|
||||
public Json_parser Utl__json_parser() {return utl__json_parser;} private final Json_parser utl__json_parser = new Json_parser();
|
||||
public Gfo_inet_conn Utl__inet_conn() {return inet_conn;} private final Gfo_inet_conn inet_conn = Gfo_inet_conn_.new_();
|
||||
public Xoa_meta_mgr Dbmeta_mgr() {return meta_mgr;} private final Xoa_meta_mgr meta_mgr;
|
||||
@@ -112,7 +112,7 @@ public class Xoae_app implements Xoa_app, Gfo_invk {
|
||||
public Xoapi_root Api_root() {return api_root;} private Xoapi_root api_root;
|
||||
public Gfo_usr_dlg Usr_dlg() {return Xoa_app_.Usr_dlg();}
|
||||
public Gfo_usr_dlg__log Log_wtr() {return log_wtr;} private Gfo_usr_dlg__log log_wtr;
|
||||
public Xoa_gfs_mgr Gfs_mgr() {return Xoa_app_.Gfs_mgr();}
|
||||
public Xoa_gfs_mgr Gfs_mgr() {return gfs_mgr;} private final Xoa_gfs_mgr gfs_mgr;
|
||||
public Xoa_special_mgr Special_mgr() {return special_mgr;} private Xoa_special_mgr special_mgr = new gplx.xowa.specials.Xoa_special_mgr();
|
||||
public Xoh_html_mgr Html_mgr() {return html_mgr;} private Xoh_html_mgr html_mgr;
|
||||
public Xop_log_mgr Log_mgr() {return log_mgr;} private Xop_log_mgr log_mgr;
|
||||
@@ -147,7 +147,7 @@ public class Xoae_app implements Xoa_app, Gfo_invk {
|
||||
public Xop_amp_mgr Parser_amp_mgr() {return parser_amp_mgr;} private final Xop_amp_mgr parser_amp_mgr = Xop_amp_mgr.Instance;
|
||||
|
||||
private Xoa_fmtr_mgr fmtr_mgr;
|
||||
public Number_parser Utl_num_parser() {return utl_num_parser;} private Number_parser utl_num_parser = new Number_parser();
|
||||
public Gfo_number_parser Utl_num_parser() {return utl_num_parser;} private Gfo_number_parser utl_num_parser = new Gfo_number_parser();
|
||||
public void Init_by_app() {
|
||||
stage = Xoa_stage_.Tid_init;
|
||||
user.Init_by_app(this);
|
||||
@@ -216,7 +216,7 @@ public class Xoae_app implements Xoa_app, Gfo_invk {
|
||||
else if (ctx.Match(k, Invk_shell)) return shell;
|
||||
else if (ctx.Match(k, Invk_log)) return log_wtr;
|
||||
else if (ctx.Match(k, Invk_setup)) return setup_mgr;
|
||||
else if (ctx.Match(k, Invk_scripts)) return Xoa_app_.Gfs_mgr();
|
||||
else if (ctx.Match(k, Invk_scripts)) return gfs_mgr;
|
||||
else if (ctx.MatchPriv(k, Invk_term_cbk)) return this.Term_cbk();
|
||||
else if (ctx.Match(k, Invk_xtns)) return xtn_mgr;
|
||||
else if (ctx.Match(k, Invk_ctg_mgr)) return ctg_mgr;
|
||||
|
||||
@@ -19,7 +19,7 @@ package gplx.xowa; import gplx.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.wikis.pages.*;
|
||||
import gplx.xowa.guis.*; import gplx.xowa.guis.views.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.files.xfers.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.wikis.pages.lnkis.*; import gplx.xowa.xtns.cites.*; import gplx.xowa.xtns.wdatas.*; import gplx.xowa.xtns.wdatas.pfuncs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.wikis.pages.lnkis.*; import gplx.xowa.xtns.cites.*; import gplx.xowa.xtns.wbases.*; import gplx.xowa.xtns.wbases.pfuncs.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*; import gplx.xowa.addons.htmls.tocs.*; import gplx.xowa.htmls.modules.popups.*;
|
||||
import gplx.xowa.wikis.pages.wtxts.*; import gplx.xowa.wikis.pages.dbs.*; import gplx.xowa.wikis.pages.redirects.*; import gplx.xowa.wikis.pages.hdumps.*; import gplx.xowa.wikis.pages.htmls.*;
|
||||
public class Xoae_page implements Xoa_page {
|
||||
@@ -34,10 +34,10 @@ public class Xoae_page implements Xoa_page {
|
||||
public Xoa_ttl Ttl() {return ttl;} public Xoae_page Ttl_(Xoa_ttl v) {ttl = v; url.Wiki_bry_(wiki.Domain_bry()).Page_bry_(v.Full_url()); return this;} private Xoa_ttl ttl;
|
||||
public Xoa_url Url() {return url;} public Xoae_page Url_(Xoa_url v) {url = v; return this;} private Xoa_url url = Xoa_url.blank();
|
||||
public byte[] Url_bry_safe() {return url == null ? Bry_.Empty : url.Raw();}
|
||||
public Xopg_db_data Db() {return db;} private final Xopg_db_data db = new Xopg_db_data();
|
||||
public Xopg_redirect_mgr Redirect() {return redirect;} private final Xopg_redirect_mgr redirect = new Xopg_redirect_mgr();
|
||||
public Xopg_html_data Html_data() {return html;} private final Xopg_html_data html = new Xopg_html_data();
|
||||
public Xopg_hdump_data Hdump_mgr() {return hdump;} private final Xopg_hdump_data hdump = new Xopg_hdump_data();
|
||||
public Xopg_db_data Db() {return db;} private final Xopg_db_data db = new Xopg_db_data();
|
||||
public Xopg_redirect_mgr Redirect_trail() {return redirect_trail;} private final Xopg_redirect_mgr redirect_trail = new Xopg_redirect_mgr();
|
||||
public Xopg_html_data Html_data() {return html;} private final Xopg_html_data html = new Xopg_html_data();
|
||||
public Xopg_hdump_data Hdump_mgr() {return hdump;} private final Xopg_hdump_data hdump = new Xopg_hdump_data();
|
||||
|
||||
public Xoa_page__commons_mgr Commons_mgr() {return commons_mgr;} private final Xoa_page__commons_mgr commons_mgr = new Xoa_page__commons_mgr();
|
||||
public void Xtn_gallery_packed_exists_y_() {html.Xtn_gallery_packed_exists_y_();}
|
||||
@@ -81,7 +81,7 @@ public class Xoae_page implements Xoa_page {
|
||||
public void Clear_all() {Clear(true);}
|
||||
public void Clear(boolean clear_scrib) { // NOTE: this is called post-fetch but pre-wtxt; do not clear items set by post-fetch, such as id, ttl, redirected_ttls, data_raw
|
||||
db.Clear();
|
||||
redirect.Clear();
|
||||
redirect_trail.Clear();
|
||||
html.Clear();
|
||||
hdump.Clear();
|
||||
wtxt.Clear();
|
||||
|
||||
@@ -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; import gplx.*;
|
||||
import gplx.core.primitives.*;
|
||||
import gplx.core.primitives.*; import gplx.core.brys.*; import gplx.core.ios.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.langs.cases.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.wikis.domains.*; import gplx.xowa.wikis.metas.*; import gplx.xowa.wikis.data.site_stats.*; import gplx.xowa.wikis.ttls.*; import gplx.xowa.wikis.data.*; import gplx.xowa.wikis.xwikis.*; import gplx.xowa.addons.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.files.repos.*; import gplx.xowa.files.origs.*; import gplx.xowa.files.bins.*; import gplx.fsdb.meta.*; import gplx.fsdb.*;
|
||||
@@ -52,6 +52,8 @@ public interface Xow_wiki extends Xow_ttl_parser, Gfo_invk {
|
||||
Xow_site_stats_mgr Stats();
|
||||
void Init_by_wiki();
|
||||
void Init_by_wiki__force(); // HACK: force init for drd wiki
|
||||
Bry_bfr_mkr Utl__bfr_mkr();
|
||||
Io_stream_zip_mgr Utl__zip_mgr();
|
||||
Xow_url_parser Utl__url_parser();
|
||||
Xoax_addon_mgr Addon_mgr();
|
||||
void Init_needed_y_();
|
||||
|
||||
@@ -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; import gplx.*;
|
||||
import gplx.core.brys.*; import gplx.core.primitives.*; import gplx.core.brys.fmtrs.*;
|
||||
import gplx.core.brys.*; import gplx.core.primitives.*; import gplx.core.brys.fmtrs.*; import gplx.core.ios.*;
|
||||
import gplx.xowa.apps.*; import gplx.xowa.apps.fsys.*; import gplx.xowa.apps.cfgs.*; import gplx.xowa.apps.cfgs.gui.*; import gplx.xowa.apps.urls.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.langs.msgs.*; import gplx.xowa.langs.cases.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.wikis.domains.*; import gplx.xowa.wikis.xwikis.*; import gplx.xowa.wikis.nss.*; import gplx.xowa.wikis.pages.*; import gplx.xowa.wikis.metas.*; import gplx.xowa.wikis.data.site_stats.*; import gplx.xowa.wikis.ttls.*; import gplx.xowa.wikis.data.*; import gplx.xowa.wikis.data.tbls.*; import gplx.xowa.wikis.caches.*;
|
||||
@@ -130,7 +130,8 @@ public class Xowe_wiki implements Xow_wiki, Gfo_invk, Gfo_evt_itm {
|
||||
public Xow_msg_mgr Msg_mgr() {return msg_mgr;} private Xow_msg_mgr msg_mgr;
|
||||
public Xow_fragment_mgr Fragment_mgr() {return fragment_mgr;} private Xow_fragment_mgr fragment_mgr;
|
||||
public Bfmtr_eval_wiki Eval_mgr() {return eval_mgr;} private Bfmtr_eval_wiki eval_mgr;
|
||||
public Bry_bfr_mkr Utl__bfr_mkr() {return utl__bry_bfr_mkr;} private final Bry_bfr_mkr utl__bry_bfr_mkr = new Bry_bfr_mkr();
|
||||
public Bry_bfr_mkr Utl__bfr_mkr() {return utl__bry_bfr_mkr;} private final Bry_bfr_mkr utl__bry_bfr_mkr = new Bry_bfr_mkr();
|
||||
public Io_stream_zip_mgr Utl__zip_mgr() {return utl__zip_mgr;} private final Io_stream_zip_mgr utl__zip_mgr = new Io_stream_zip_mgr();
|
||||
public byte[] Wdata_wiki_lang() {return wdata_wiki_lang;} private byte[] wdata_wiki_lang;
|
||||
public void Wdata_wiki_lang_(byte[] v) {this.wdata_wiki_lang = v; Wdata_wiki_abrv_();} // TEST:
|
||||
public byte[] Wdata_wiki_abrv() {return wdata_wiki_abrv;} private byte[] wdata_wiki_abrv; private int wdata_wiki_tid;
|
||||
|
||||
@@ -44,6 +44,7 @@ public class Xoax_addon_mgr {
|
||||
, new gplx.xowa.addons.bldrs.htmls .Html__dump_to_fsys__addon()
|
||||
, new gplx.xowa.addons.bldrs.exports .Export_addon()
|
||||
, new gplx.xowa.addons.wikis.pages.randoms .Rndm_addon()
|
||||
, new gplx.xowa.addons.bldrs.hdumps.diffs .Dumpdiff_addon()
|
||||
|
||||
// specials
|
||||
, new gplx.xowa.addons.wikis.registrys .Wiki_registry_addon()
|
||||
|
||||
@@ -46,7 +46,7 @@ public class Xolog_special implements Xow_special_page {
|
||||
args_bldr.Add("cmd", "view");
|
||||
if (redirect_to_same_file && file != null)
|
||||
args_bldr.Add("file", file);
|
||||
page.Redirect().Itms__add__special(wiki, Prototype.Special__meta(), args_bldr.To_ary());
|
||||
page.Redirect_trail().Itms__add__special(wiki, Prototype.Special__meta(), args_bldr.To_ary());
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -35,7 +35,7 @@ public class Xobc_data_db_upgrader {
|
||||
//int next_check_interval = cfg_mgr.Select_int_or("", Cfg__next_check_interval, 24 * 7);
|
||||
//DateAdp last_check = DateAdp_.parse_fmt_or(last_check_str, Date_fmt, null);
|
||||
//if (last_check != null) { // check if last_check_str exists
|
||||
// Time_span span = DateAdp_.Now().Diff(last_check);
|
||||
// Time_span span = Datetime_now.Get().Diff(last_check);
|
||||
// if (span.Total_hours().To_double() < next_check_interval) { // check if enough time passed
|
||||
// Gfo_log_.Instance.Info("xobc_db update not needed", "last_check", last_check_str, "next_check_interval", next_check_interval);
|
||||
// return;
|
||||
@@ -47,7 +47,7 @@ public class Xobc_data_db_upgrader {
|
||||
// Gfo_log_.Instance.Info("xobc_db update needed b/c of missing or invalid last_check_str", "last_check", last_check_str);
|
||||
|
||||
// update needed; first, update cfg_key, then get host
|
||||
cfg_mgr.Upsert_str("", Cfg__last_check_date, DateAdp_.Now().XtoStr_fmt(Date_fmt));
|
||||
cfg_mgr.Upsert_str("", Cfg__last_check_date, Datetime_now.Get().XtoStr_fmt(Date_fmt));
|
||||
Xobc_data_db bc_db = task_mgr.Data_db();
|
||||
Xobc_host_regy_itm host_itm = bc_db.Tbl__host_regy().Select(Xobc_host_regy_tbl.Host_id__archive_org);
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public class Xobc_version_regy_tbl implements Db_tbl {
|
||||
public void Create_tbl() {
|
||||
conn.Meta_tbl_create(Dbmeta_tbl_itm.New(tbl_name, flds));
|
||||
conn.Stmt_insert(tbl_name, flds)
|
||||
.Val_int(fld_version_id, 1).Val_str(fld_version_date, DateAdp_.Now().XtoStr_fmt_yyyy_MM_dd_HH_mm()).Val_str(fld_version_note, "initial")
|
||||
.Val_int(fld_version_id, 1).Val_str(fld_version_date, Datetime_now.Get().XtoStr_fmt_yyyy_MM_dd_HH_mm()).Val_str(fld_version_note, "initial")
|
||||
.Exec_insert();
|
||||
}
|
||||
public Xobc_version_regy_itm Select_latest() {
|
||||
|
||||
@@ -81,7 +81,7 @@ class Merge_wkr__core {
|
||||
}
|
||||
private void Merge_cfg(Db_conn src_conn, Db_conn trg_conn, String src_tbl_name) {
|
||||
if (trg_conn.Meta_tbl_exists("xowa_cfg")) {
|
||||
attach_mgr.Conn_main_(trg_conn).Conn_others_(new Db_attach_itm("src_db", src_conn));
|
||||
attach_mgr.Conn_main_(trg_conn).Conn_links_(new Db_attach_itm("src_db", src_conn));
|
||||
attach_mgr.Exec_sql(String_.Concat_lines_nl
|
||||
( "INSERT INTO xowa_cfg"
|
||||
, "SELECT s.cfg_grp, s.cfg_key, s.cfg_val"
|
||||
|
||||
@@ -55,7 +55,7 @@ class Split_init__file {
|
||||
// update bin_db_id
|
||||
wkr_conn.Meta_idx_create("fsdb_img_regy", "img", "img_type", "fil_id", "thm_id");
|
||||
Gfo_log_.Instance.Prog("updating bin_db_id");
|
||||
attach_mgr.Conn_others_(new Db_attach_itm("fsdb_db", atr_conn));
|
||||
attach_mgr.Conn_links_(new Db_attach_itm("fsdb_db", atr_conn));
|
||||
|
||||
// update bin_db_id.fil
|
||||
attach_mgr.Exec_sql(String_.Concat_lines_nl // ANSI.Y
|
||||
|
||||
@@ -35,7 +35,7 @@ class Split_meta_wkr__fil extends Split_meta_wkr_base {
|
||||
}
|
||||
@Override public void On_nth_rls(Split_ctx ctx, Db_conn trg_conn) {this.stmt = Db_stmt_.Rls(stmt);}
|
||||
@Override protected String Load_sql(Db_attach_mgr attach_mgr, int ns_id, int score_bgn, int score_end) {
|
||||
attach_mgr.Conn_others_(new Db_attach_itm("atr_db", atr_conn));
|
||||
attach_mgr.Conn_links_(new Db_attach_itm("atr_db", atr_conn));
|
||||
return String_.Concat_lines_nl
|
||||
( "SELECT f.fil_id, f.fil_owner_id, f.fil_xtn_id, f.fil_ext_id, f.fil_bin_db_id, f.fil_name, f.fil_size, f.fil_modified, f.fil_hash, fir.page_id"
|
||||
, "FROM <atr_db>fsdb_fil f"
|
||||
|
||||
@@ -35,7 +35,7 @@ class Split_meta_wkr__org extends Split_meta_wkr_base {
|
||||
}
|
||||
@Override public void On_nth_rls(Split_ctx ctx, Db_conn trg_conn) {this.stmt = Db_stmt_.Rls(stmt);}
|
||||
@Override protected String Load_sql(Db_attach_mgr attach_mgr, int ns_id, int score_bgn, int score_end) {
|
||||
attach_mgr.Conn_others_(new Db_attach_itm("atr_db", atr_conn));
|
||||
attach_mgr.Conn_links_(new Db_attach_itm("atr_db", atr_conn));
|
||||
return String_.Concat_lines_nl
|
||||
( "SELECT o.orig_ttl, o.orig_repo, o.orig_status, o.orig_ext, o.orig_w, o.orig_h, o.orig_redirect, fir.page_id"
|
||||
, "FROM <atr_db>orig_reg o"
|
||||
|
||||
@@ -35,7 +35,7 @@ class Split_meta_wkr__thm extends Split_meta_wkr_base {
|
||||
}
|
||||
@Override public void On_nth_rls(Split_ctx ctx, Db_conn trg_conn) {this.stmt = Db_stmt_.Rls(stmt);}
|
||||
@Override protected String Load_sql(Db_attach_mgr attach_mgr, int ns_id, int score_bgn, int score_end) {
|
||||
attach_mgr.Conn_others_(new Db_attach_itm("atr_db", atr_conn));
|
||||
attach_mgr.Conn_links_(new Db_attach_itm("atr_db", atr_conn));
|
||||
return String_.Concat_lines_nl
|
||||
( "SELECT t.thm_id, t.thm_owner_id, t.thm_w, t.thm_h, t.thm_time, t.thm_page, t.thm_bin_db_id, t.thm_size, t.thm_modified, t.thm_hash, fir.page_id"
|
||||
, "FROM <atr_db>fsdb_thm t"
|
||||
|
||||
@@ -58,7 +58,7 @@ public class Split_wkr__rndm implements Split_wkr {
|
||||
Rndm_seq_tbl seq_tbl = new Rndm_seq_tbl(trg_conn); seq_tbl.Create_tbl();
|
||||
Split_tbl_.Bld_insert_by_select(tmp_bfr, seq_tbl.Tbl_name(), seq_tbl.Flds());
|
||||
tmp_bfr.Add_str_u8_fmt("WHERE {0} = {1} AND {2} = {3}", seq_tbl.Fld__qry_idx(), bldr.Qry_idx(), seq_tbl.Fld__rng_idx(), bldr.Rng_idx());
|
||||
attach_mgr.Conn_main_(trg_conn).Conn_others_(new Db_attach_itm("src_db", bldr.Conn()));
|
||||
attach_mgr.Conn_main_(trg_conn).Conn_links_(new Db_attach_itm("src_db", bldr.Conn()));
|
||||
attach_mgr.Exec_sql(tmp_bfr.To_str_and_clear());
|
||||
// bldr.Conn().Txn_bgn("rndm");
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ class Split_meta_wkr__link extends Split_meta_wkr_base {
|
||||
}
|
||||
@Override protected String Load_sql(Db_attach_mgr attach_mgr, int ns_id, int score_bgn, int score_end) {
|
||||
int trg_db_id = srch_db_mgr.Tbl__link__get_idx(ns_id);
|
||||
attach_mgr.Conn_others_(new Db_attach_itm("link_db", srch_db_mgr.Tbl__link__get_at(trg_db_id).conn));
|
||||
attach_mgr.Conn_links_(new Db_attach_itm("link_db", srch_db_mgr.Tbl__link__get_at(trg_db_id).conn));
|
||||
return String_.Concat_lines_nl
|
||||
( "SELECT sl.word_id, sl.page_id, sl.link_score, sw.page_id, " + trg_db_id + " AS trg_db_id"
|
||||
, "FROM <link_db>search_link sl"
|
||||
|
||||
@@ -42,7 +42,7 @@ class Split_srch_init {
|
||||
int len = srch_db_mgr.Tbl__link__len();
|
||||
for (int i = 0; i < len; ++i) {
|
||||
Db_conn link_conn = srch_db_mgr.Tbl__link__get_at(i).conn;
|
||||
attach_mgr.Conn_others_(new Db_attach_itm("word_db", word_conn), new Db_attach_itm("link_db", link_conn));
|
||||
attach_mgr.Conn_links_(new Db_attach_itm("word_db", word_conn), new Db_attach_itm("link_db", link_conn));
|
||||
attach_mgr.Exec_sql(String_.Concat_lines_nl // ANSI.Y
|
||||
( "INSERT INTO split_search_word (word_id, word_text, link_count, link_count_score, link_score_min, link_score_max, page_uid, page_ns, page_id, page_score)"
|
||||
, "SELECT sw.word_id, sw.word_text, sw.link_count, sw.link_count_score, sw.link_score_min, sw.link_score_max, Min(pr.page_uid), -1, -1, -1"
|
||||
|
||||
@@ -21,7 +21,7 @@ import gplx.xowa.files.*;
|
||||
import gplx.xowa.wikis.nss.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.wikis.domains.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.logs.*; import gplx.xowa.parsers.lnkis.*; import gplx.xowa.parsers.xndes.*;
|
||||
import gplx.xowa.htmls.core.bldrs.*; import gplx.xowa.xtns.scribunto.*; import gplx.xowa.xtns.wdatas.*;
|
||||
import gplx.xowa.htmls.core.bldrs.*; import gplx.xowa.xtns.scribunto.*; import gplx.xowa.xtns.wbases.*;
|
||||
import gplx.fsdb.meta.*; import gplx.xowa.files.fsdb.*; import gplx.fsdb.*;
|
||||
import gplx.xowa.langs.vnts.*; import gplx.xowa.parsers.vnts.*;
|
||||
import gplx.xowa.parsers.lnkis.files.*;
|
||||
@@ -112,7 +112,7 @@ public class Xobldr__lnki_temp__create extends Xob_dump_mgr_base implements gplx
|
||||
else {
|
||||
parser.Parse_page_all_clear(root, ctx, ctx.Tkn_mkr(), page_src);
|
||||
if ( gen_html
|
||||
&& page.Redirect().Itms__len() == 0) // don't generate html for redirected pages
|
||||
&& page.Redirect_trail().Itms__len() == 0) // don't generate html for redirected pages
|
||||
wiki.Html_mgr().Page_wtr_mgr().Gen(ctx.Page().Root_(root), Xopg_page_.Tid_read);
|
||||
if (gen_hdump)
|
||||
hdump_bldr.Insert(ctx, page.Root_(root));
|
||||
|
||||
@@ -15,18 +15,14 @@ GNU Affero General Public License for more details.
|
||||
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.xtns.wdatas.core; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.wdatas.*;
|
||||
public class Wdata_dict_value_string {
|
||||
public static final byte
|
||||
Tid_value = 0
|
||||
, Tid_type = 1
|
||||
;
|
||||
public static byte[]
|
||||
Bry_value = Bry_.new_a7("value")
|
||||
, Bry_type = Bry_.new_a7("type")
|
||||
;
|
||||
public static final Hash_adp_bry Dict = Hash_adp_bry.cs()
|
||||
.Add_bry_byte(Bry_value , Tid_value)
|
||||
.Add_bry_byte(Bry_type , Tid_type)
|
||||
;
|
||||
package gplx.xowa.addons.bldrs.hdumps.diffs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*; import gplx.xowa.addons.bldrs.hdumps.*;
|
||||
import gplx.xowa.bldrs.wkrs.*;
|
||||
public class Dumpdiff_addon implements Xoax_addon_itm, Xoax_addon_itm__bldr {
|
||||
public Xob_cmd[] Bldr_cmds() {
|
||||
return new Xob_cmd[]
|
||||
{ Dumpdiff_cmd.Prototype
|
||||
};
|
||||
}
|
||||
|
||||
public String Addon__key() {return "xowa.builds.hdumps.diff";}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
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.addons.bldrs.hdumps.diffs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*; import gplx.xowa.addons.bldrs.hdumps.*;
|
||||
class Dumpdiff_cfg implements Gfo_invk {
|
||||
public Io_url Prv_dir() {return prv_dir;} private Io_url prv_dir;
|
||||
public Io_url Cur_dir() {return cur_dir;} private Io_url cur_dir;
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk__cur_dir_)) this.cur_dir = m.ReadIoUrl("v");
|
||||
else if (ctx.Match(k, Invk__prv_dir_)) this.prv_dir = m.ReadIoUrl("v");
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
public static final String Invk__cur_dir_ = "cur_dir_", Invk__prv_dir_ = "prv_dir_";
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
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.addons.bldrs.hdumps.diffs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*; import gplx.xowa.addons.bldrs.hdumps.*;
|
||||
import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.wkrs.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
public class Dumpdiff_cmd extends Xob_cmd__base {
|
||||
private final Dumpdiff_cfg cfg = new Dumpdiff_cfg();
|
||||
private final Dumpdiff_mgr mgr = new Dumpdiff_mgr();
|
||||
public Dumpdiff_cmd(Xob_bldr bldr, Xowe_wiki wiki) {super(bldr, wiki);}
|
||||
@Override public void Cmd_run() {
|
||||
wiki.Init_assert();
|
||||
mgr.Exec(bldr.App(), wiki, cfg);
|
||||
}
|
||||
@Override public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk__cfg)) return cfg;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
}
|
||||
private static final String Invk__cfg = "cfg";
|
||||
|
||||
public static final String BLDR_CMD_KEY = "hdump.diff";
|
||||
@Override public String Cmd_key() {return BLDR_CMD_KEY;}
|
||||
public static final Xob_cmd Prototype = new Dumpdiff_cmd(null, null);
|
||||
@Override public Xob_cmd Cmd_clone(Xob_bldr bldr, Xowe_wiki wiki) {return new Dumpdiff_cmd(bldr, wiki);}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
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.addons.bldrs.hdumps.diffs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*; import gplx.xowa.addons.bldrs.hdumps.*;
|
||||
import gplx.dbs.*;
|
||||
class Dumpdiff_log_tbl implements Db_tbl {
|
||||
private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
|
||||
private final String fld__page_id, fld__cur_snip, fld__prv_snip;
|
||||
private Db_stmt stmt__insert;
|
||||
public Dumpdiff_log_tbl(Db_conn conn) {
|
||||
this.conn = conn;
|
||||
flds.Add_int_pkey("uid");
|
||||
this.fld__page_id = flds.Add_int("page_id");
|
||||
this.fld__cur_snip = flds.Add_str("cur_snip", 1024);
|
||||
this.fld__prv_snip = flds.Add_str("prv_snip", 1024);
|
||||
conn.Rls_reg(this);
|
||||
}
|
||||
public String Tbl_name() {return tbl_name;} private final String tbl_name = "diff_log";
|
||||
public Db_conn Conn() {return conn;} private final Db_conn conn;
|
||||
public void Create_tbl() {
|
||||
conn.Meta_tbl_remake(Dbmeta_tbl_itm.New(tbl_name, flds, Dbmeta_idx_itm.new_normal_by_tbl(tbl_name, fld__page_id, fld__page_id)));
|
||||
}
|
||||
public void Insert_bgn() {
|
||||
stmt__insert = conn.Stmt_insert(tbl_name, fld__page_id, fld__cur_snip, fld__prv_snip);
|
||||
conn.Txn_bgn("diff_log");
|
||||
}
|
||||
public void Insert_by_batch(int page_id, byte[] prv_snip, byte[] cur_snip) {
|
||||
stmt__insert.Clear().Val_int(fld__page_id, page_id).Val_bry_as_str(fld__cur_snip, cur_snip).Val_bry_as_str(fld__prv_snip, prv_snip).Exec_insert();
|
||||
}
|
||||
public void Insert_end() {
|
||||
conn.Txn_end();
|
||||
stmt__insert.Rls();
|
||||
}
|
||||
public void Rls() {}
|
||||
|
||||
public static Dumpdiff_log_tbl New(Xowe_wiki wiki) {
|
||||
Db_conn conn = Db_conn_bldr.Instance.Get_or_autocreate(true, wiki.Fsys_mgr().Root_dir().GenSubFil("xowa.diff.sqlite3"));
|
||||
Dumpdiff_log_tbl rv = new Dumpdiff_log_tbl(conn);
|
||||
conn.Meta_tbl_remake(rv);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
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.addons.bldrs.hdumps.diffs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*; import gplx.xowa.addons.bldrs.hdumps.*;
|
||||
import gplx.core.brys.*;
|
||||
import gplx.dbs.*;
|
||||
import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.wikis.data.tbls.*;
|
||||
class Dumpdiff_mgr {
|
||||
public void Exec(Xoae_app app, Xowe_wiki wiki, Dumpdiff_cfg cfg) {
|
||||
// init log_tbl, wikis
|
||||
Dumpdiff_log_tbl log_tbl = Dumpdiff_log_tbl.New(wiki);
|
||||
Xowe_wiki cur_wiki = Get_wiki_by_dir(wiki, Bool_.Y, cfg.Cur_dir());
|
||||
Xowe_wiki prv_wiki = Get_wiki_by_dir(wiki, Bool_.N, cfg.Prv_dir());
|
||||
|
||||
// init html_loader, page_loader
|
||||
Hdump_html_loader cur_html_loader = new Hdump_html_loader(cur_wiki);
|
||||
Hdump_html_loader prv_html_loader = new Hdump_html_loader(prv_wiki);
|
||||
Dumpdiff_page_loader page_loader = new Dumpdiff_page_loader(cur_wiki, prv_wiki, 10000);
|
||||
List_adp list = List_adp_.New();
|
||||
|
||||
// prepare for loop
|
||||
int page_count = 0, diff_count = 0;
|
||||
log_tbl.Insert_bgn();
|
||||
|
||||
// loop page_table until no more
|
||||
while (true) {
|
||||
page_loader.Load(list);
|
||||
int list_len = list.Count();
|
||||
if (list_len == 0) break;
|
||||
|
||||
// loop pages, compare, and log
|
||||
for (int i = 0; i < list_len; ++i) {
|
||||
Dumpdiff_page_itm page = (Dumpdiff_page_itm)list.Get_at(i);
|
||||
int page_id = page.Page_id();
|
||||
byte[] cur_html = cur_html_loader.Load(page_id, page.Cur_db_id());
|
||||
byte[] prv_html = prv_html_loader.Load(page_id, page.Prv_db_id());
|
||||
byte[][] diff = Bry_diff_.Diff_1st_line(cur_html, prv_html);
|
||||
++page_count;
|
||||
if (diff != null) {
|
||||
log_tbl.Insert_by_batch(page_id, diff[0], diff[1]);
|
||||
++diff_count;
|
||||
Gfo_usr_dlg_.Instance.Warn_many("", "", "hdump diff: pages=~{0} diffs=~{1} page_id=~{2} cur=~{3} prv=~{4}", page_count, diff_count, page_id, diff[0], diff[1]);
|
||||
}
|
||||
}
|
||||
list.Clear();
|
||||
}
|
||||
|
||||
// cleanup
|
||||
log_tbl.Insert_end();
|
||||
}
|
||||
private static Xowe_wiki Get_wiki_by_dir(Xowe_wiki dflt_wiki, boolean wiki_is_cur, Io_url wiki_dir) {
|
||||
Xowe_wiki rv = null;
|
||||
if (wiki_dir == null) {
|
||||
if (wiki_is_cur)
|
||||
rv = dflt_wiki;
|
||||
else
|
||||
throw Err_.new_("", "prv_dir not specified");
|
||||
}
|
||||
if (rv == null)
|
||||
rv = gplx.xowa.addons.bldrs.mass_parses.parses.Xow_wiki_utl_.Clone_wiki(dflt_wiki, wiki_dir);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
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.addons.bldrs.hdumps.diffs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*; import gplx.xowa.addons.bldrs.hdumps.*;
|
||||
class Dumpdiff_page_itm {
|
||||
public Dumpdiff_page_itm(int page_id, int ns_id, byte[] ttl_bry, int cur_db_id, int prv_db_id) {
|
||||
this.page_id = page_id;
|
||||
this.ns_id = ns_id;
|
||||
this.ttl_bry = ttl_bry;
|
||||
this.cur_db_id = cur_db_id;
|
||||
this.prv_db_id = prv_db_id;
|
||||
}
|
||||
public int Page_id() {return page_id;} private final int page_id;
|
||||
public int Ns_id() {return ns_id;} private final int ns_id;
|
||||
public byte[] Ttl_bry() {return ttl_bry;} private final byte[] ttl_bry;
|
||||
public int Cur_db_id() {return cur_db_id;} private final int cur_db_id;
|
||||
public int Prv_db_id() {return prv_db_id;} private final int prv_db_id;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
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.addons.bldrs.hdumps.diffs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*; import gplx.xowa.addons.bldrs.hdumps.*;
|
||||
import gplx.dbs.*;
|
||||
class Dumpdiff_page_loader {
|
||||
private final Db_attach_mgr attach_mgr = new Db_attach_mgr();
|
||||
private int select_count, cutoff_page_id;
|
||||
public Dumpdiff_page_loader(Xowe_wiki cur_wiki, Xowe_wiki prv_wiki, int select_count) {
|
||||
this.select_count = select_count;
|
||||
attach_mgr.Conn_main_(cur_wiki.Data__core_mgr().Db__core().Conn());
|
||||
attach_mgr.Conn_links_(new Db_attach_itm("prv_db", prv_wiki.Data__core_mgr().Db__core().Conn()));
|
||||
}
|
||||
public void Load(List_adp rv) {
|
||||
String sql = String_.Format(String_.Concat_lines_nl_skip_last // ANSI.Y
|
||||
( "SELECT cur.page_id"
|
||||
, ", cur.page_namespace AS ns_id"
|
||||
, ", cur.page_title AS ttl_bry"
|
||||
, ", cur.page_html_db_id AS cur_html_db_id"
|
||||
, ", prv.page_html_db_id AS prv_html_db_id"
|
||||
, "FROM page cur"
|
||||
, " JOIN <prv_db>page prv ON cur.page_id = prv.page_id"
|
||||
, "WHERE cur.page_id > {0}"
|
||||
, "AND cur.page_html_db_id != -1"
|
||||
, "LIMIT {1}"
|
||||
), cutoff_page_id, select_count);
|
||||
sql = attach_mgr.Resolve_sql(sql);
|
||||
|
||||
attach_mgr.Attach();
|
||||
Db_rdr rdr = attach_mgr.Conn_main().Stmt_sql(sql).Exec_select__rls_auto();
|
||||
while (rdr.Move_next()) {
|
||||
cutoff_page_id = rdr.Read_int("page_id");
|
||||
rv.Add(new Dumpdiff_page_itm(cutoff_page_id
|
||||
, rdr.Read_int("ns_id"), rdr.Read_bry_by_str("ttl_bry")
|
||||
, rdr.Read_int("cur_html_db_id"), rdr.Read_int("prv_html_db_id")
|
||||
));
|
||||
}
|
||||
attach_mgr.Detach();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
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.addons.bldrs.hdumps.diffs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*; import gplx.xowa.addons.bldrs.hdumps.*;
|
||||
import gplx.core.ios.*; import gplx.core.ios.streams.*;
|
||||
import gplx.xowa.wikis.data.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
import gplx.xowa.htmls.*;
|
||||
class Hdump_html_loader {
|
||||
private final Xowe_wiki wiki;
|
||||
private Io_stream_zip_mgr stream_zip_mgr = new Io_stream_zip_mgr();
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr_.New();
|
||||
private final Xoh_page tmp_hpg = new Xoh_page();
|
||||
private final Xoa_url tmp_url; private final Xoa_ttl tmp_ttl;
|
||||
|
||||
public Hdump_html_loader(Xowe_wiki wiki) {
|
||||
this.wiki = wiki;
|
||||
this.tmp_url = wiki.Utl__url_parser().Parse(Bry_.new_a7("temp"));
|
||||
this.tmp_ttl = wiki.Ttl_parse(Bry_.new_a7("temp"));
|
||||
}
|
||||
|
||||
public byte[] Load(int page_id, int html_db_id) {
|
||||
// load html_bry from db
|
||||
Xow_db_file html_db = wiki.Data__core_mgr().Dbs__get_by_id_or_fail(html_db_id);
|
||||
tmp_hpg.Ctor_by_hview(wiki, tmp_url, tmp_ttl, page_id);
|
||||
html_db.Tbl__html().Select_by_page(tmp_hpg);
|
||||
|
||||
// unzip it
|
||||
byte[] html_hzip = stream_zip_mgr.Unzip(Io_stream_.Tid_gzip, tmp_hpg.Db().Html().Html_bry());
|
||||
return wiki.Html__hdump_mgr().Load_mgr().Decode_as_bry(tmp_bfr, tmp_hpg, html_hzip, true);
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ package gplx.xowa.addons.bldrs.mass_parses.makes; import gplx.*; import gplx.xow
|
||||
import gplx.dbs.*;
|
||||
class Xob_lnki_temp_row implements CompareAble {
|
||||
public int Xomp_uid() {return xomp_uid;} private int xomp_uid;
|
||||
public int Make_uid() {return make_uid;} private int make_uid;
|
||||
public int Lnki_id() {return lnki_id;} private int lnki_id;
|
||||
public int Lnki_tier_id() {return lnki_tier_id;} private int lnki_tier_id;
|
||||
public int Lnki_page_id() {return lnki_page_id;} private int lnki_page_id;
|
||||
public byte[] Lnki_ttl() {return lnki_ttl;} private byte[] lnki_ttl;
|
||||
@@ -34,24 +34,24 @@ class Xob_lnki_temp_row implements CompareAble {
|
||||
public int Lnki_page() {return lnki_page;} private int lnki_page;
|
||||
public void Load(Db_rdr rdr, int xomp_uid) {
|
||||
this.xomp_uid = xomp_uid;
|
||||
this.make_uid = rdr.Read_int("lnki_make_uid");
|
||||
this.lnki_id = rdr.Read_int("lnki_id");
|
||||
this.lnki_tier_id = rdr.Read_int("lnki_tier_id");
|
||||
this.lnki_page_id = rdr.Read_int("lnki_page_id");
|
||||
this.lnki_ttl = rdr.Read_bry_by_str("lnki_ttl");
|
||||
this.lnki_commons_ttl = rdr.Read_bry_by_str("lnki_commons_ttl");
|
||||
this.lnki_commons_ttl = Bry_.new_u8_safe(rdr.Read_str("lnki_commons_ttl"));
|
||||
this.lnki_ext = rdr.Read_byte("lnki_ext");
|
||||
this.lnki_type = rdr.Read_byte("lnki_type");
|
||||
this.lnki_src_tid = rdr.Read_byte("lnki_src_tid");
|
||||
this.lnki_w = rdr.Read_int("lnki_w");
|
||||
this.lnki_h = rdr.Read_int("lnki_h");
|
||||
this.lnki_upright = rdr.Read_double("lnki_upright");
|
||||
this.lnki_time = rdr.Read_int("lnki_time");
|
||||
this.lnki_time = rdr.Read_double("lnki_time");
|
||||
this.lnki_page = rdr.Read_int("lnki_page");
|
||||
}
|
||||
public int compareTo(Object obj) {
|
||||
Xob_lnki_temp_row comp = (Xob_lnki_temp_row)obj;
|
||||
int rv = Int_.Compare(xomp_uid, comp.xomp_uid);
|
||||
if (rv != CompareAble_.Same) return rv;
|
||||
return Int_.Compare(make_uid, comp.make_uid);
|
||||
return Int_.Compare(lnki_id, comp.lnki_id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@ public class Xomp_make_cmd extends Xob_cmd__base {
|
||||
public Xomp_make_cmd(Xob_bldr bldr, Xowe_wiki wiki) {super(bldr, wiki);}
|
||||
@Override public void Cmd_run() {
|
||||
wiki.Init_assert();
|
||||
Xomp_make_wkr wkr = new Xomp_make_wkr(wiki);
|
||||
wkr.Exec();
|
||||
new Xomp_make_wkr(wiki).Exec();
|
||||
new Xomp_make_lnki().Exec(wiki, 1000);
|
||||
}
|
||||
|
||||
@Override public String Cmd_key() {return BLDR_CMD_KEY;} private static final String BLDR_CMD_KEY = "wiki.mass_parse.make";
|
||||
|
||||
@@ -44,7 +44,8 @@ class Xomp_make_lnki {
|
||||
Xomp_wkr_db wkr_db = xomp_db.Wkr_db(Bool_.N, i);
|
||||
count += Load_rows(rows, xomp_db, wkr_db, uid_bgn, uid_bgn + uid_count);
|
||||
}
|
||||
if (count == 0) break;
|
||||
if (count < 0) break;
|
||||
uid_bgn += count;
|
||||
Save_rows(rows, lnki_temp_tbl);
|
||||
}
|
||||
|
||||
@@ -56,7 +57,7 @@ class Xomp_make_lnki {
|
||||
private int Load_rows(List_adp rows, Xomp_db_core xomp_db, Xomp_wkr_db wkr_db, int uid_bgn, int uid_end) {
|
||||
// build sql
|
||||
Db_attach_mgr attach_mgr = new Db_attach_mgr(xomp_db.Conn());
|
||||
attach_mgr.Conn_others_(new Db_attach_itm("wkr_db", wkr_db.Conn()));
|
||||
attach_mgr.Conn_links_(new Db_attach_itm("wkr_db", wkr_db.Conn()));
|
||||
String sql = String_.Format(String_.Concat_lines_nl_skip_last
|
||||
( "SELECT mgr.xomp_uid"
|
||||
, ", wkr.*"
|
||||
@@ -77,6 +78,7 @@ class Xomp_make_lnki {
|
||||
rv = rdr.Read_int("xomp_uid");
|
||||
Xob_lnki_temp_row row = new Xob_lnki_temp_row();
|
||||
row.Load(rdr, rv);
|
||||
rows.Add(row);
|
||||
}
|
||||
} finally {rdr.Rls();}
|
||||
attach_mgr.Detach();
|
||||
|
||||
@@ -64,7 +64,7 @@ class Xomp_load_wkr implements Gfo_invk {
|
||||
, "AND mp.page_status = 0"
|
||||
, "LIMIT {1}"
|
||||
), prv_page_id, queue.Capacity());
|
||||
this.attach_mgr.Conn_others_(new Db_attach_itm("page_db", wiki.Data__core_mgr().Db__core().Conn()));
|
||||
this.attach_mgr.Conn_links_(new Db_attach_itm("page_db", wiki.Data__core_mgr().Db__core().Conn()));
|
||||
sql = attach_mgr.Resolve_sql(sql);
|
||||
|
||||
// page_tbl.load_sql
|
||||
|
||||
@@ -60,7 +60,7 @@ class Xomp_page_pool_loader {
|
||||
, "AND mp.page_status = 0"
|
||||
, "LIMIT {1}"
|
||||
), prv_uid, num_pages_per_load);
|
||||
this.attach_mgr.Conn_others_(new Db_attach_itm("page_db", wiki.Data__core_mgr().Db__core().Conn()));
|
||||
this.attach_mgr.Conn_links_(new Db_attach_itm("page_db", wiki.Data__core_mgr().Db__core().Conn()));
|
||||
sql = attach_mgr.Resolve_sql(sql);
|
||||
|
||||
// run page_tbl
|
||||
|
||||
@@ -34,7 +34,7 @@ class Xomp_parse_mgr {
|
||||
Xomp_page_pool page_pool = new Xomp_page_pool(pool_loader, cfg.Num_pages_per_wkr());
|
||||
prog_mgr.Init(pool_loader.Get_pending_count(), cfg.Progress_interval());
|
||||
wiki.App().User().User_db_mgr().Cache_mgr().Enabled_n_(); // disable db lookups of cache
|
||||
Xow_page_cache page_cache = Xomp_tmpl_cache_bldr.New(wiki, true);
|
||||
Xow_page_cache page_cache = Xomp_tmpl_cache_bldr.New(wiki, cfg.Load_all_templates());
|
||||
Gfo_cache_mgr commons_cache = new Gfo_cache_mgr().Max_size_(Int_.Max_value).Reduce_by_(Int_.Max_value);
|
||||
Gfo_cache_mgr ifexist_cache = new Gfo_cache_mgr().Max_size_(Int_.Max_value).Reduce_by_(Int_.Max_value);
|
||||
|
||||
@@ -47,8 +47,8 @@ class Xomp_parse_mgr {
|
||||
latch = new Gfo_countdown_latch(wkr_len);
|
||||
Xomp_parse_wkr[] wkrs = new Xomp_parse_wkr[wkr_len];
|
||||
for (int i = 0; i < wkr_len; ++i) {
|
||||
Xowe_wiki wkr_wiki = Clone_wiki(wiki);
|
||||
Xomp_parse_wkr wkr = new Xomp_parse_wkr(this, wkr_wiki, page_pool, i, cfg.Cleanup_interval(), cfg.Progress_interval(), cfg.Log_file_lnkis());
|
||||
Xowe_wiki wkr_wiki = Xow_wiki_utl_.Clone_wiki(wiki, wiki.Fsys_mgr().Root_dir());
|
||||
Xomp_parse_wkr wkr = new Xomp_parse_wkr(this, wkr_wiki, page_pool, i, cfg, cfg.Cleanup_interval(), cfg.Progress_interval(), cfg.Log_file_lnkis());
|
||||
wkr_wiki.Cache_mgr().Page_cache_(page_cache).Commons_cache_(commons_cache).Ifexist_cache_(ifexist_cache);
|
||||
// remove wmf wkr, else will try to download images during parsing
|
||||
if (wkr_wiki.File__bin_mgr() != null)
|
||||
@@ -74,11 +74,4 @@ class Xomp_parse_mgr {
|
||||
}
|
||||
Gfo_usr_dlg_.Instance.Note_many("", "", bfr.To_str_and_clear());
|
||||
}
|
||||
private static Xowe_wiki Clone_wiki(Xowe_wiki wiki) {
|
||||
Xol_lang_itm lang = new Xol_lang_itm(wiki.App().Lang_mgr(), wiki.Lang().Key_bry());
|
||||
Xol_lang_itm_.Lang_init(lang);
|
||||
Xowe_wiki rv = new Xowe_wiki(wiki.Appe(), lang, gplx.xowa.wikis.nss.Xow_ns_mgr_.default_(lang.Case_mgr()), wiki.Domain_itm(), wiki.Fsys_mgr().Root_dir());
|
||||
rv.Init_by_wiki();
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +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.addons.bldrs.mass_parses.parses; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*; import gplx.xowa.addons.bldrs.mass_parses.*;
|
||||
import gplx.core.ios.streams.*;
|
||||
class Xomp_parse_mgr_cfg implements Gfo_invk {
|
||||
public int Num_wkrs() {return num_wkrs;} private int num_wkrs = -1; // use env.available_processors
|
||||
public int Num_pages_in_pool() {return num_pages_in_pool;} private int num_pages_in_pool = 1000;
|
||||
@@ -27,6 +28,8 @@ class Xomp_parse_mgr_cfg implements Gfo_invk {
|
||||
public boolean Hzip_enabled() {return hzip_enabled;} private boolean hzip_enabled = true;
|
||||
public boolean Hdiff_enabled() {return hdiff_enabled;} private boolean hdiff_enabled = true;
|
||||
public boolean Log_file_lnkis() {return log_file_lnkis;} private boolean log_file_lnkis = true;
|
||||
public boolean Load_all_templates() {return load_all_templates;} private boolean load_all_templates = true;
|
||||
public byte Zip_tid() {return zip_tid;} private byte zip_tid = Io_stream_.Tid_gzip;
|
||||
public void Init(Xowe_wiki wiki) {
|
||||
if (num_wkrs == -1) num_wkrs = gplx.core.envs.Env_.System_cpu_count();
|
||||
}
|
||||
@@ -41,12 +44,16 @@ class Xomp_parse_mgr_cfg implements Gfo_invk {
|
||||
else if (ctx.Match(k, Invk__hdump_enabled_)) hdump_enabled = m.ReadBool("v");
|
||||
else if (ctx.Match(k, Invk__hzip_enabled_)) hzip_enabled = m.ReadBool("v");
|
||||
else if (ctx.Match(k, Invk__hdiff_enabled_)) hdiff_enabled = m.ReadBool("v");
|
||||
else if (ctx.Match(k, Invk__zip_tid_)) zip_tid = m.ReadByte("v");
|
||||
else if (ctx.Match(k, Invk__load_all_templates_)) load_all_templates = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk__manual_now_)) Datetime_now.Manual_and_freeze_(m.ReadDate("v"));
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static final String
|
||||
Invk__num_wkrs_ = "num_wkrs_", Invk__num_pages_in_pool_ = "num_pages_in_pool_", Invk__num_pages_per_wkr_ = "num_pages_per_wkr_"
|
||||
, Invk__progress_interval_ = "progress_interval_", Invk__commit_interval_ = "commit_interval_", Invk__cleanup_interval_ = "cleanup_interval_"
|
||||
, Invk__hdump_enabled_ = "hdump_enabled_", Invk__hzip_enabled_ = "hzip_enabled_", Invk__hdiff_enabled_ = "hdiff_enabled_"
|
||||
, Invk__hdump_enabled_ = "hdump_enabled_", Invk__hzip_enabled_ = "hzip_enabled_", Invk__hdiff_enabled_ = "hdiff_enabled_", Invk__zip_tid_ = "zip_tid_"
|
||||
, Invk__load_all_templates_ = "load_all_templates_", Invk__manual_now_ = "manual_now_"
|
||||
;
|
||||
}
|
||||
|
||||
@@ -24,14 +24,16 @@ class Xomp_parse_wkr implements Gfo_invk {
|
||||
private final Xomp_page_pool page_pool;
|
||||
private final int idx;
|
||||
private final List_adp list = List_adp_.New(); private int list_idx = 0, list_len = 0;
|
||||
private final Xomp_parse_mgr_cfg cfg;
|
||||
private int done_count; private long done_time;
|
||||
private Xomp_wkr_db wkr_db; private int cleanup_interval, commit_interval;
|
||||
private boolean log_file_lnkis;
|
||||
public Xomp_parse_wkr(Xomp_parse_mgr mgr, Xowe_wiki wiki, Xomp_page_pool page_pool, int idx, int cleanup_interval, int commit_interval, boolean log_file_lnkis) {
|
||||
public Xomp_parse_wkr(Xomp_parse_mgr mgr, Xowe_wiki wiki, Xomp_page_pool page_pool, int idx, Xomp_parse_mgr_cfg cfg, int cleanup_interval, int commit_interval, boolean log_file_lnkis) {
|
||||
this.mgr = mgr; this.wiki = wiki;
|
||||
this.page_pool = page_pool;
|
||||
this.idx = idx;
|
||||
this.wkr_db = mgr.Db_core().Wkr_db(Bool_.Y, idx); // NOTE: must go in ctor, or else thread issues
|
||||
this.cfg = cfg;
|
||||
this.cleanup_interval = cleanup_interval;
|
||||
this.commit_interval = commit_interval;
|
||||
this.log_file_lnkis = log_file_lnkis;
|
||||
@@ -40,7 +42,7 @@ class Xomp_parse_wkr implements Gfo_invk {
|
||||
public Xob_hdump_bldr Hdump_bldr() {return hdump_bldr;} private final Xob_hdump_bldr hdump_bldr = new Xob_hdump_bldr();
|
||||
public void Exec() {
|
||||
// init
|
||||
Xow_parser_mgr parser_mgr = new Xow_parser_mgr(wiki);
|
||||
Xow_parser_mgr parser_mgr = wiki.Parser_mgr();
|
||||
|
||||
// disable file download
|
||||
wiki.File_mgr().Init_file_mgr_by_load(wiki); // must happen after fsdb.make
|
||||
@@ -58,8 +60,8 @@ class Xomp_parse_wkr implements Gfo_invk {
|
||||
logger.Bgn();
|
||||
}
|
||||
|
||||
// enable hdump
|
||||
hdump_bldr.Enabled_(true).Hzip_enabled_(true).Hzip_diff_(true).Init(wiki, wkr_db.Conn(), new Xob_hdump_tbl_retriever__xomp(wkr_db.Html_tbl()));
|
||||
// enable hdump
|
||||
hdump_bldr.Enabled_(cfg.Hdump_enabled()).Hzip_enabled_(cfg.Hzip_enabled()).Hzip_diff_(cfg.Hzip_enabled()).Zip_tid_(cfg.Zip_tid()).Init(wiki, wkr_db.Conn(), new Xob_hdump_tbl_retriever__xomp(wkr_db.Html_tbl()));
|
||||
wkr_db.Conn().Txn_bgn("xomp");
|
||||
|
||||
while (true) {
|
||||
|
||||
@@ -22,9 +22,10 @@ import gplx.xowa.wikis.data.tbls.*;
|
||||
class Xomp_text_db_loader {
|
||||
private final Xow_wiki wiki;
|
||||
private final Ordered_hash text_db_hash = Ordered_hash_.New();
|
||||
private final Io_stream_zip_mgr zip_mgr = Xoa_app_.Utl__zip_mgr();
|
||||
private final Io_stream_zip_mgr zip_mgr;
|
||||
public Xomp_text_db_loader(Xow_wiki wiki) {
|
||||
this.wiki = wiki;
|
||||
this.zip_mgr = wiki.Utl__zip_mgr();
|
||||
}
|
||||
public void Add(int text_db_id, Xowd_text_bry_owner ppg) {
|
||||
Xomp_text_db_itm itm = (Xomp_text_db_itm)text_db_hash.Get_by(text_db_id);
|
||||
|
||||
@@ -71,11 +71,26 @@ class Xomp_tmpl_cache_bldr {
|
||||
for (int i = 0; i < redirect_len; ++i) {
|
||||
Xow_page_cache_itm src_itm = (Xow_page_cache_itm)redirect_list.Get_at(i);
|
||||
Xow_page_cache_itm trg_itm = (Xow_page_cache_itm)page_regy.Get_by(src_itm.Redirect_id());
|
||||
if (trg_itm == null) {
|
||||
Gfo_usr_dlg_.Instance.Prog_many("", "", "missing redirect for tmpl: ~{0}", src_itm.Ttl().Full_db());
|
||||
continue;
|
||||
byte[] trg_itm_wtxt = null;
|
||||
Xoa_ttl trg_ttl = null;
|
||||
if (trg_itm == null) { // template can redirect to non-template pages
|
||||
Xoa_ttl src_ttl = src_itm.Ttl();
|
||||
Xoae_page wpg = Xoae_page.New(wiki, src_ttl);
|
||||
wiki.Data_mgr().Load_from_db(wpg, src_ttl.Ns(), src_ttl, false);
|
||||
if (wpg.Db().Page().Exists()) {
|
||||
trg_itm_wtxt = wpg.Db().Text().Text_bry();
|
||||
trg_ttl = wpg.Ttl();
|
||||
}
|
||||
else {
|
||||
Gfo_usr_dlg_.Instance.Prog_many("", "", "missing redirect for tmpl: ~{0}", src_itm.Ttl().Full_db());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
src_itm.Set_redirect_bry(trg_itm.Wtxt__direct());
|
||||
else {
|
||||
trg_itm_wtxt = trg_itm.Wtxt__direct();
|
||||
trg_ttl = trg_itm.Ttl();
|
||||
}
|
||||
src_itm.Set_redirect(trg_ttl, trg_itm_wtxt); // NOTE: itm must have title of redirect, not original item; EX:Template:Ifempty -> Template:If_empty; DATE:2016-07-26
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
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.addons.bldrs.mass_parses.parses; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*; import gplx.xowa.addons.bldrs.mass_parses.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.langs.cases.*;
|
||||
public class Xow_wiki_utl_ {
|
||||
public static Xowe_wiki Clone_wiki(Xowe_wiki wiki, Io_url wiki_dir) {
|
||||
Xol_lang_itm lang = new Xol_lang_itm(wiki.App().Lang_mgr(), wiki.Lang().Key_bry());
|
||||
Xol_lang_itm_.Lang_init(lang);
|
||||
Xowe_wiki rv = new Xowe_wiki(wiki.Appe(), lang, gplx.xowa.wikis.nss.Xow_ns_mgr_.default_(lang.Case_mgr()), wiki.Domain_itm(), wiki_dir);
|
||||
rv.Init_by_wiki();
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ class Xow_import_dir_cbk__xodir implements Xow_import_dir_cbk {
|
||||
wiki.App().User().User_db_mgr().Cfg().Set_app_str("xowa.xodir.custom_dir", path);
|
||||
|
||||
// redirect to import_dir
|
||||
page.Redirect().Itms__add__special(wiki, Xobc_xodir_special.Prototype.Special__meta());
|
||||
page.Redirect_trail().Itms__add__special(wiki, Xobc_xodir_special.Prototype.Special__meta());
|
||||
}
|
||||
public static Xow_import_dir_cbk__xodir Instance = new Xow_import_dir_cbk__xodir(); Xow_import_dir_cbk__xodir() {}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class Xobc_xodir_special implements Xow_special_page {
|
||||
Xobc_xodir_cfg.Set_app_str__selected(wiki.App(), path);
|
||||
// On_path_selected.Invk(null, -1, "", null);
|
||||
// page.Redirect().Itms__add__special(wiki, Xobc_task_special.Prototype.Special__meta());
|
||||
page.Redirect().Itms__add__special(wiki, Prototype.Special__meta());
|
||||
page.Redirect_trail().Itms__add__special(wiki, Prototype.Special__meta());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ public class Xob_css_status {
|
||||
}
|
||||
if (rv.Fs_exists()) {
|
||||
DateAdp fs_timestamp = Timestamp_load(css_dir);
|
||||
DateAdp db_timestamp = DateAdp_.Now();
|
||||
DateAdp db_timestamp = Datetime_now.Get();
|
||||
if (db_timestamp.compareTo(fs_timestamp) == CompareAble_.More)
|
||||
rv.Update_tid_db_y_(); // v2_db and later_version; update from db
|
||||
else
|
||||
|
||||
@@ -27,7 +27,7 @@ public class Xowd_css_core_mgr {
|
||||
try {
|
||||
conn.Txn_bgn("schema__css_core__set");
|
||||
int css_id = core_tbl.Select_id_by_key(key);
|
||||
DateAdp updated_on = DateAdp_.Now().XtoUtc();
|
||||
DateAdp updated_on = Datetime_now.Get().XtoUtc();
|
||||
if (css_id == -1)
|
||||
css_id = core_tbl.Insert(key, updated_on);
|
||||
else {
|
||||
|
||||
@@ -64,7 +64,7 @@ class Xowd_css_core_mgr_fxt {
|
||||
private final Bry_bfr bfr = Bry_bfr_.Reset(32);
|
||||
private Xowd_css_core_tbl core_tbl; private Xowd_css_file_tbl file_tbl;
|
||||
public void Clear() {
|
||||
Tfds.Now_enabled_y_();
|
||||
Datetime_now.Manual_y_();
|
||||
Io_mgr.Instance.InitEngine_mem();
|
||||
Db_conn_bldr.Instance.Reg_default_mem();
|
||||
Db_conn conn = Db_conn_bldr.Instance.New(Io_url_.mem_fil_("mem/db/css.sqlite3"));
|
||||
|
||||
@@ -31,7 +31,7 @@ public class Xow_info_special implements Xow_special_page {
|
||||
delete_wiki.Data__core_mgr().Rls(); // release connection if open
|
||||
Delete_wiki_files(delete_wiki.Fsys_mgr().Root_dir());
|
||||
}
|
||||
page.Redirect().Itms__add__special(wiki, gplx.xowa.addons.wikis.registrys.lists.Xow_list_special.Prototype.Special__meta());
|
||||
page.Redirect_trail().Itms__add__special(wiki, gplx.xowa.addons.wikis.registrys.lists.Xow_list_special.Prototype.Special__meta());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ class Srch_temp_tbl_wkr implements Srch_text_parser_wkr {
|
||||
page_conn.Meta_idx_create(Dbmeta_idx_itm.new_normal_by_tbl("page", "page_ns__page_id", "page_namespace", "page_id"));
|
||||
Srch_db_mgr.Optimize_unsafe_(word_conn, Bool_.Y);
|
||||
word_conn.Meta_tbl_remake(Dbmeta_tbl_itm.New("search_link_temp", Dbmeta_fld_itm.new_int("word_id"), Dbmeta_fld_itm.new_int("page_id"), Dbmeta_fld_itm.new_int("page_namespace")));
|
||||
attach_mgr.Conn_main_(word_conn).Conn_others_(new Db_attach_itm("page_db", page_conn));
|
||||
attach_mgr.Conn_main_(word_conn).Conn_links_(new Db_attach_itm("page_db", page_conn));
|
||||
attach_mgr.Exec_sql_w_msg
|
||||
( "filling search_link_temp (please wait)", String_.Concat_lines_nl_skip_last
|
||||
( "INSERT INTO search_link_temp (word_id, page_id, page_namespace)"
|
||||
@@ -105,7 +105,7 @@ class Srch_temp_tbl_wkr implements Srch_text_parser_wkr {
|
||||
Xoa_app_.Usr_dlg().Plog_many("", "", "creating search_link_temp: ~{0}", i);
|
||||
Srch_link_tbl link_tbl = search_db_mgr.Tbl__link__ary()[i];
|
||||
Srch_db_mgr.Optimize_unsafe_(link_tbl.conn, Bool_.Y);
|
||||
attach_mgr.Conn_main_(link_tbl.conn).Conn_others_(new Db_attach_itm("word_db", word_conn));
|
||||
attach_mgr.Conn_main_(link_tbl.conn).Conn_links_(new Db_attach_itm("word_db", word_conn));
|
||||
attach_mgr.Exec_sql_w_msg
|
||||
( Bry_fmt.Make_str("filling search_link: ~{idx} of ~{len}", i, len), String_.Concat_lines_nl_skip_last
|
||||
( "INSERT INTO search_link (word_id, page_id)"
|
||||
|
||||
@@ -33,8 +33,7 @@ public class Xobldr__link__link_score extends Xob_cmd__base {
|
||||
wiki.Init_assert();
|
||||
Db_conn plink_conn = Db_conn_bldr.Instance.Get_or_autocreate(false, wiki.Fsys_mgr().Root_dir().GenSubFil(Xob_db_file.Name__page_link));
|
||||
String page_rank_tbl = Xobldr__page__page_score.Pagerank__tbl_name;
|
||||
String log_module = "search.page.score";
|
||||
Xoa_app_.Plog_none(log_module, "adding fields to page_rank_temp");
|
||||
Gfo_usr_dlg_.Instance.Prog_none("", "", "search.page.score:adding fields to page_rank_temp");
|
||||
plink_conn.Meta_fld_assert(page_rank_tbl, "page_len_score" , Dbmeta_fld_tid.Itm__int, 0);
|
||||
plink_conn.Meta_fld_assert(page_rank_tbl, "page_rank_score" , Dbmeta_fld_tid.Itm__double, 0);
|
||||
plink_conn.Meta_fld_assert(page_rank_tbl, "page_score" , Dbmeta_fld_tid.Itm__int, 0);
|
||||
@@ -54,7 +53,7 @@ public class Xobldr__link__link_score extends Xob_cmd__base {
|
||||
// calc page_score
|
||||
if (page_rank_enabled) {
|
||||
// get min / max
|
||||
Xoa_app_.Plog_none(log_module, "calculating page_rank range");
|
||||
Gfo_usr_dlg_.Instance.Prog_none("", "", "search.page.score:calculating page_rank range");
|
||||
double page_rank_min = plink_conn.Exec_select_as_double("SELECT Min(page_rank) FROM " + page_rank_tbl, Double_.MinValue); if (page_rank_min == Double_.MinValue) throw Err_.new_("bldr", "failed to get min; tbl=~{0}", page_rank_tbl);
|
||||
double page_rank_max = plink_conn.Exec_select_as_double("SELECT Max(page_rank) FROM " + page_rank_tbl, Double_.MinValue); if (page_rank_max == Double_.MinValue) throw Err_.new_("bldr", "failed to get max; tbl=~{0}", page_rank_tbl);
|
||||
double page_rank_rng = page_rank_max - page_rank_min;
|
||||
|
||||
@@ -59,7 +59,7 @@ class Srch_sym_parser__split implements Srch_sym_parser {
|
||||
int hooks_len = hooks_ary.length;
|
||||
for (int i = 0; i < hooks_len; ++i) {
|
||||
byte[] hook = hooks_ary[i];
|
||||
trie.Add_obj(hook, Int_obj_val.new_(hook.length));
|
||||
trie.Add_obj(hook, new Int_obj_val(hook.length));
|
||||
}
|
||||
}
|
||||
public int Tid() {return Srch_sym_parser_.Tid__split;}
|
||||
|
||||
@@ -21,5 +21,5 @@ public interface Srch_text_parser_wkr {
|
||||
}
|
||||
class Srch_text_parser_wkr__noop implements Srch_text_parser_wkr {
|
||||
public void Parse_done(Srch_word_itm word) {}
|
||||
public static final Srch_text_parser_wkr__noop Instance = new Srch_text_parser_wkr__noop(); Srch_text_parser_wkr__noop() {}
|
||||
public static final Srch_text_parser_wkr__noop Instance = new Srch_text_parser_wkr__noop(); Srch_text_parser_wkr__noop() {} // TS.static
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public class Srch_link_wkr extends Percentile_select_base {
|
||||
this.link_tbl_idx = 0;
|
||||
this.link_tbl_nth = ctx.Tbl__link__ary.length - 1;
|
||||
sql_root = Srch_link_wkr_.Find_sql_root(ctx);
|
||||
attach_mgr.Conn_others_(new Db_attach_itm("page_db", ctx.Db__core.Conn()), new Db_attach_itm("word_db", ctx.Tbl__word.conn));
|
||||
attach_mgr.Conn_links_(new Db_attach_itm("page_db", ctx.Db__core.Conn()), new Db_attach_itm("word_db", ctx.Tbl__word.conn));
|
||||
super.Select();
|
||||
}
|
||||
finally {
|
||||
|
||||
@@ -86,7 +86,7 @@ public class Srch_special_page implements Xow_special_page, Gfo_invk, Gfo_evt_it
|
||||
page.Root().Data_htm_(search_page.Root().Data_htm());
|
||||
Xoa_url redirect_url = Xoa_url.New(wiki, search_ttl);
|
||||
page.Ttl_(search_ttl).Url_(redirect_url);
|
||||
page.Redirect().Itms__add__article(redirect_url, search_ttl, null);
|
||||
page.Redirect_trail().Itms__add__article(redirect_url, search_ttl, null);
|
||||
}
|
||||
}
|
||||
private void Multi_wikis_changed() {
|
||||
|
||||
@@ -35,7 +35,8 @@ public class Xoav_app implements Xoa_app, Gfo_invk {
|
||||
public Xoav_app(Gfo_usr_dlg usr_dlg, Xoa_app_mode mode, Xog_tab_mgr tab_mgr, String plat_name, Io_url root_dir, Io_url file_dir, Io_url css_dir, Io_url http_root) {
|
||||
Xoa_app_.Usr_dlg_(usr_dlg); this.usr_dlg = usr_dlg; this.mode = mode;
|
||||
this.fsys_mgr = new Xoa_fsys_mgr(plat_name, root_dir, root_dir.GenSubDir("wiki"), file_dir, css_dir, http_root);
|
||||
this.lang_mgr = new Xoa_lang_mgr(this);
|
||||
Xoa_gfs_mgr gfs_mgr = new Xoa_gfs_mgr(this, fsys_mgr, null);
|
||||
this.lang_mgr = new Xoa_lang_mgr(this, gfs_mgr);
|
||||
this.meta_mgr = new Xoa_meta_mgr(this);
|
||||
this.gfs_mgr = new Xoa_gfs_mgr(this, fsys_mgr, null);
|
||||
this.file__cache_mgr = new Xof_cache_mgr(usr_dlg, null, null);
|
||||
@@ -83,7 +84,7 @@ public class Xoav_app implements Xoa_app, Gfo_invk {
|
||||
|
||||
public Xowmf_mgr Wmf_mgr() {return wmf_mgr;} private final Xowmf_mgr wmf_mgr = new Xowmf_mgr();
|
||||
public Gfo_usr_dlg Usr_dlg() {return usr_dlg;} public void Usr_dlg_(Gfo_usr_dlg v) {usr_dlg = v; Xoa_app_.Usr_dlg_(usr_dlg);} private Gfo_usr_dlg usr_dlg = Gfo_usr_dlg_.Noop;
|
||||
public Bry_bfr_mkr Utl__bfr_mkr() {return Xoa_app_.Utl__bfr_mkr();}
|
||||
public Bry_bfr_mkr Utl__bfr_mkr() {return utl__bry_bfr_mkr;} private final Bry_bfr_mkr utl__bry_bfr_mkr = new Bry_bfr_mkr();
|
||||
public Json_parser Utl__json_parser() {return utl__json_parser;} private final Json_parser utl__json_parser = new Json_parser();
|
||||
public boolean Bldr__running() {return bldr__running;} public void Bldr__running_(boolean v) {this.bldr__running = v;} private boolean bldr__running;
|
||||
public Xop_amp_mgr Utl_amp_mgr() {return utl_amp_mgr;} private Xop_amp_mgr utl_amp_mgr = Xop_amp_mgr.Instance;
|
||||
|
||||
@@ -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.apps.apis.xowa.xtns; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
|
||||
import gplx.xowa.xtns.wdatas.*;
|
||||
import gplx.xowa.xtns.wbases.*;
|
||||
public class Xoapi_wikibase implements Gfo_invk, Gfo_evt_mgr_owner {
|
||||
public Xoapi_wikibase() {
|
||||
evt_mgr = new Gfo_evt_mgr(this);
|
||||
|
||||
@@ -38,7 +38,7 @@ public class Xoa_boot_mgr {
|
||||
}
|
||||
}
|
||||
private void Init_env(String[] args) {
|
||||
Gfo_usr_dlg_.Instance = usr_dlg = Xoa_app_.usr_dlg_console_();
|
||||
Gfo_usr_dlg_.Instance = usr_dlg = Xoa_app_.New__usr_dlg__console();
|
||||
Gfo_log_.Instance__set(new gplx.xowa.apps.shells.Gfo_log__console());
|
||||
log_wtr = usr_dlg.Log_wkr(); log_wtr.Log_to_session_fmt("env.init: version=~{0}", Xoa_app_.Version);
|
||||
GfuiEnv_.Init_swt(args, Xoa_app_.class);
|
||||
|
||||
@@ -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.apps.caches; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*;
|
||||
import gplx.xowa.xtns.wdatas.*;
|
||||
import gplx.xowa.xtns.wbases.*;
|
||||
public class Wdata_doc_cache {
|
||||
private Hash_adp_bry hash = Hash_adp_bry.cs();
|
||||
public void Add(byte[] qid, Wdata_doc doc) {hash.Add(qid, doc);}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class Xoa_cfg_db_txt implements Xoa_cfg_db {
|
||||
private Bry_fmtr fmtr = Bry_fmtr.new_("app.cfgs.get('~{msg}', '~{wiki}').val = '~{val}';\n", "msg", "wiki", "val");
|
||||
public void Cfg_reset_all(Xoa_cfg_mgr cfg_mgr) {
|
||||
Io_url src_url = this.Cfg_url(cfg_mgr);
|
||||
Io_url trg_url = src_url.GenNewNameAndExt("xowa_user_cfg." + DateAdp_.Now().XtoStr_fmt_yyyyMMdd_HHmmss() + ".gfs");
|
||||
Io_url trg_url = src_url.GenNewNameAndExt("xowa_user_cfg." + Datetime_now.Get().XtoStr_fmt_yyyyMMdd_HHmmss() + ".gfs");
|
||||
Io_mgr.Instance.MoveFil_args(src_url, trg_url, true).Exec();
|
||||
if (cfg_mgr.App().Tid_is_edit())
|
||||
((Xoae_app)cfg_mgr.App()).Gui_mgr().Kit().Ask_ok("", "", "Options cleared. Please restart XOWA.");
|
||||
|
||||
@@ -64,7 +64,7 @@ public class Xoa_gfs_mgr implements Gfo_invk, Gfo_invk_root_wkr {
|
||||
try {Run_url(url);}
|
||||
catch (Exception e) { // gfs is corrupt; may happen if multiple XOWAs opened, and "Close all" chosen in OS; DATE:2014-07-01
|
||||
if (!String_.Eq(type, "xowa")) // check if user.gfs
|
||||
Io_mgr.Instance.MoveFil(url, url.GenNewNameOnly(url.NameOnly() + "-" + DateAdp_.Now().XtoStr_fmt_yyyyMMdd_HHmmss())); // move file
|
||||
Io_mgr.Instance.MoveFil(url, url.GenNewNameOnly(url.NameOnly() + "-" + Datetime_now.Get().XtoStr_fmt_yyyyMMdd_HHmmss())); // move file
|
||||
Gfo_usr_dlg_.Instance.Warn_many("", "", "invalid gfs; obsoleting: src=~{0} err=~{1}", url.Raw(), Err_.Message_gplx_full(e));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,17 +20,19 @@ public class Xoa_gfs_wtr_ {
|
||||
public static byte[] Escape(String v) {return Escape(Bry_.new_u8(v));}
|
||||
public static byte[] Escape(byte[] v) {
|
||||
return Bry_find_.Find_fwd(v, Byte_ascii.Apos) == Bry_find_.Not_found ? v : Bry_.Replace(v, Byte_ascii.Apos_bry, Bry__apos_escaped);
|
||||
} private static final byte[] Bry__apos_escaped = Bry_.new_a7("''");
|
||||
} private static final byte[] Bry__apos_escaped = Bry_.new_a7("''");
|
||||
public static void Write_prop(Bry_bfr bfr, byte[] prop, byte[] val) {
|
||||
bfr.Add(prop).Add(Bry__val_bgn).Add(Xoa_gfs_wtr_.Escape(val)).Add(Bry__val_end); // EX: "a_('b');\n"
|
||||
} private static final byte[] Bry__val_bgn = Bry_.new_a7("_('"), Bry__val_end = Bry_.new_a7("');\n");
|
||||
} private static final byte[] Bry__val_bgn = Bry_.new_a7("_('"), Bry__val_end = Bry_.new_a7("');\n");
|
||||
public static String Write_func_chain(String... ary) { // EX: "a.b.c"
|
||||
Bry_bfr bfr = Xoa_app_.Utl__bfr_mkr().Get_b128(); // Bry_bfr.try_none: simple-ops
|
||||
int len = ary.length;
|
||||
for (int i = 0; i < len; ++i) {
|
||||
if (i != 0) bfr.Add_byte(Byte_ascii.Dot);
|
||||
bfr.Add_str_u8(ary[i]);
|
||||
}
|
||||
return bfr.To_str_and_rls();
|
||||
Bry_bfr bfr = Bry_bfr_.New();
|
||||
try {
|
||||
int len = ary.length;
|
||||
for (int i = 0; i < len; ++i) {
|
||||
if (i != 0) bfr.Add_byte(Byte_ascii.Dot);
|
||||
bfr.Add_str_u8(ary[i]);
|
||||
}
|
||||
return bfr.To_str_and_clear();
|
||||
} finally {bfr.Mkr_rls();}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public abstract class Xoa_site_cfg_itm__base {
|
||||
public byte[] Key_bry() {return key_bry;} private byte[] key_bry;
|
||||
public byte[] Parse_json(Xow_wiki wiki, Json_itm js_itm) {
|
||||
Json_ary ary = Json_ary.cast(js_itm);
|
||||
Bry_bfr bfr = Xoa_app_.Utl__bfr_mkr().Get_b512();
|
||||
Bry_bfr bfr = wiki.Utl__bfr_mkr().Get_b512();
|
||||
int len = ary.Len();
|
||||
for (int i = 0; i < len; ++i)
|
||||
Parse_json_ary_itm(bfr, wiki, i, ary.Get_at(i));
|
||||
|
||||
@@ -38,7 +38,7 @@ class Xoa_site_cfg_loader__db implements Xoa_site_cfg_loader {
|
||||
cfg_tbl.Upsert_bry(Grp__xowa_wm_api, db_key, data);
|
||||
}
|
||||
public static String Bld_meta(int loader_tid) {
|
||||
return String_.Format("//#xowa|{0}|{1}|{2}", Xoa_app_.Version, Xoa_site_cfg_loader_.Get_key(loader_tid), DateAdp_.Now().XtoUtc().XtoStr_fmt_yyyyMMdd_HHmmss());
|
||||
return String_.Format("//#xowa|{0}|{1}|{2}", Xoa_app_.Version, Xoa_site_cfg_loader_.Get_key(loader_tid), Datetime_now.Get().XtoUtc().XtoStr_fmt_yyyyMMdd_HHmmss());
|
||||
}
|
||||
public static final String Grp__xowa_wm_api = "xowa.site_cfg";
|
||||
}
|
||||
|
||||
@@ -21,13 +21,14 @@ import gplx.langs.jsons.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
public class Xoa_site_cfg_loader__inet implements Xoa_site_cfg_loader {
|
||||
private final Gfo_inet_conn inet_conn; private final Json_parser json_parser;
|
||||
private String api_url; private boolean call_api = true; private Json_doc jdoc;
|
||||
private String api_url; private boolean call_api = true; private Json_doc jdoc;
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr_.New();
|
||||
public Xoa_site_cfg_loader__inet(Gfo_inet_conn inet_conn, Json_parser json_parser) {this.inet_conn = inet_conn; this.json_parser = json_parser;}
|
||||
public int Tid() {return Xoa_site_cfg_loader_.Tid__inet;}
|
||||
public void Load_csv__bgn(Xoa_site_cfg_mgr mgr, Xow_wiki wiki) {
|
||||
this.call_api = true;
|
||||
this.jdoc = null;
|
||||
this.api_url = Bld_url(wiki.Domain_str(), mgr.Data_hash(), mgr.Itm_ary());
|
||||
this.api_url = Bld_url(tmp_bfr, wiki.Domain_str(), mgr.Data_hash(), mgr.Itm_ary());
|
||||
}
|
||||
public String Api_url() {return api_url;}
|
||||
public byte[] Load_csv(Xoa_site_cfg_mgr mgr, Xow_wiki wiki, Xoa_site_cfg_itm__base itm) {
|
||||
@@ -41,8 +42,7 @@ public class Xoa_site_cfg_loader__inet implements Xoa_site_cfg_loader {
|
||||
Json_itm js_itm = jdoc.Get_grp_many(Bry__query, itm.Key_bry()); if (js_itm == null) return null;
|
||||
return itm.Parse_json(wiki, js_itm);
|
||||
}
|
||||
public static String Bld_url(String domain_str, Hash_adp_bry db_hash, Xoa_site_cfg_itm__base[] itm_ary) {
|
||||
Bry_bfr bfr = Xoa_app_.Utl__bfr_mkr().Get_b512();
|
||||
public static String Bld_url(Bry_bfr tmp_bfr, String domain_str, Hash_adp_bry db_hash, Xoa_site_cfg_itm__base[] itm_ary) {
|
||||
boolean first = true;
|
||||
int len = itm_ary.length;
|
||||
for (int i = 0; i < len; ++i) {
|
||||
@@ -51,10 +51,10 @@ public class Xoa_site_cfg_loader__inet implements Xoa_site_cfg_loader {
|
||||
if (first)
|
||||
first = false;
|
||||
else
|
||||
bfr.Add_byte_pipe();
|
||||
bfr.Add(itm.Key_bry());
|
||||
tmp_bfr.Add_byte_pipe();
|
||||
tmp_bfr.Add(itm.Key_bry());
|
||||
}
|
||||
return first ? null : Xowm_api_mgr.Bld_api_url(domain_str, Qarg__bgn + bfr.To_str_and_rls());
|
||||
return first ? null : Xowm_api_mgr.Bld_api_url(domain_str, Qarg__bgn + tmp_bfr.To_str_and_clear());
|
||||
}
|
||||
private static final byte[] Bry__query = Bry_.new_a7("query");
|
||||
public static final String
|
||||
|
||||
@@ -66,8 +66,9 @@ class Xoa_site_cfg_mgr_fxt {
|
||||
private final Xoa_site_cfg_mgr site_cfg_mgr;
|
||||
private final Db_cfg_tbl cfg_tbl;
|
||||
private final Json_printer printer = new Json_printer();
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr_.New();
|
||||
public Xoa_site_cfg_mgr_fxt() {
|
||||
// Xoa_app_.Usr_dlg_(Xoa_app_.usr_dlg_console_());
|
||||
// Xoa_app_.Usr_dlg_(Xoa_app_.New__usr_dlg__console());
|
||||
Xoa_test_.Inet__init();
|
||||
this.app = Xoa_app_fxt.Make__app__edit();
|
||||
this.wiki = Xoa_app_fxt.Make__wiki__edit(app);
|
||||
@@ -76,14 +77,14 @@ class Xoa_site_cfg_mgr_fxt {
|
||||
this.site_cfg_mgr = app.Site_cfg_mgr();
|
||||
}
|
||||
public void Init() {
|
||||
Tfds.Now_enabled_y_(); Tfds.Now_freeze_y_();
|
||||
Datetime_now.Manual_y_(); Datetime_now.Autoincrement_n_();
|
||||
Io_mgr.Instance.InitEngine_mem();
|
||||
cfg_tbl.Delete_grp(Xoa_site_cfg_loader__db.Grp__xowa_wm_api);
|
||||
site_cfg_mgr.Init_loader_bgn(wiki);
|
||||
app.Utl__inet_conn().Clear();
|
||||
}
|
||||
public void Term() {
|
||||
Tfds.Now_enabled_n_();
|
||||
Datetime_now.Manual_n_();
|
||||
}
|
||||
public void Init_db(String key, String data) {
|
||||
cfg_tbl.Assert_bry(Xoa_site_cfg_loader__db.Grp__xowa_wm_api, key, Bry_.new_u8(data));
|
||||
@@ -93,7 +94,7 @@ class Xoa_site_cfg_mgr_fxt {
|
||||
Tfds.Eq_str_lines(expd, String_.new_u8(actl));
|
||||
}
|
||||
public void Init_inet(String data) {
|
||||
String url = Xoa_site_cfg_loader__inet.Bld_url(wiki.Domain_str(), site_cfg_mgr.Data_hash(), site_cfg_mgr.Itm_ary());
|
||||
String url = Xoa_site_cfg_loader__inet.Bld_url(tmp_bfr, wiki.Domain_str(), site_cfg_mgr.Data_hash(), site_cfg_mgr.Itm_ary());
|
||||
app.Utl__inet_conn().Upload_by_bytes(url, Bry_.new_u8(data));
|
||||
}
|
||||
public void Init_fsys(String key, String data) {
|
||||
@@ -123,7 +124,7 @@ class Xoa_site_cfg_mgr_fxt {
|
||||
Tfds.Eq(expd, String_.Mid(api_url, String_.FindBwd(api_url, "=") + 1));
|
||||
}
|
||||
public String Make_api(byte[]... sections) {
|
||||
Bry_bfr bfr = Xoa_app_.Utl__bfr_mkr().Get_b512();
|
||||
Bry_bfr bfr = wiki.Utl__bfr_mkr().Get_b512();
|
||||
bfr.Add_str_a7("{'query':");
|
||||
int len = sections.length;
|
||||
bfr.Add_str_a7("{");
|
||||
@@ -136,7 +137,7 @@ class Xoa_site_cfg_mgr_fxt {
|
||||
return printer.Print_by_bry(Bry_.new_u8(Json_doc.Make_str_by_apos(bfr.To_str_and_rls()))).To_str();
|
||||
}
|
||||
public byte[] Make_api_interwikimap(String... ary) {
|
||||
Bry_bfr bfr = Xoa_app_.Utl__bfr_mkr().Get_b512();
|
||||
Bry_bfr bfr = wiki.Utl__bfr_mkr().Get_b512();
|
||||
bfr.Add_str_a7("'interwikimap':");
|
||||
int len = ary.length;
|
||||
bfr.Add_str_a7("[");
|
||||
@@ -150,7 +151,7 @@ class Xoa_site_cfg_mgr_fxt {
|
||||
return bfr.To_bry_and_clear();
|
||||
}
|
||||
public byte[] Make_api_extensiontags(String... ary) {
|
||||
Bry_bfr bfr = Xoa_app_.Utl__bfr_mkr().Get_b512();
|
||||
Bry_bfr bfr = wiki.Utl__bfr_mkr().Get_b512();
|
||||
bfr.Add_str_a7("'extensiontags':");
|
||||
int len = ary.length;
|
||||
bfr.Add_str_a7("[");
|
||||
@@ -162,7 +163,7 @@ class Xoa_site_cfg_mgr_fxt {
|
||||
return bfr.To_bry_and_clear();
|
||||
}
|
||||
public String Make_data(int loader_tid, int flds, String... ary) {
|
||||
Bry_bfr bfr = Xoa_app_.Utl__bfr_mkr().Get_b512();
|
||||
Bry_bfr bfr = wiki.Utl__bfr_mkr().Get_b512();
|
||||
if (loader_tid != Xoa_site_cfg_loader_.Tid__null) // null when constructing data for fsys
|
||||
bfr.Add_str_u8(Xoa_site_cfg_loader__db.Bld_meta(loader_tid)).Add_byte_nl();
|
||||
int len = ary.length;
|
||||
|
||||
@@ -17,26 +17,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.apps.urls; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*;
|
||||
public class Xoa_url_encoder {
|
||||
private final Bry_bfr bfr = Bry_bfr_.New();
|
||||
public byte[] Encode(byte[] src) {
|
||||
int src_len = src.length;
|
||||
for (int i = 0; i < src_len; i++) {
|
||||
byte b = src[i];
|
||||
switch (b) {
|
||||
case Byte_ascii.Space: bb.Add(Bry_underline); break;
|
||||
case Byte_ascii.Amp: bb.Add(Bry_amp); break;
|
||||
case Byte_ascii.Apos: bb.Add(Bry_apos); break;
|
||||
case Byte_ascii.Eq: bb.Add(Bry_eq); break;
|
||||
case Byte_ascii.Plus: bb.Add(Bry_plus); break;
|
||||
default: bb.Add_byte(b); break;
|
||||
// FUTURE: html_entities, etc:
|
||||
case Byte_ascii.Space: bfr.Add(Bry__underline); break;
|
||||
case Byte_ascii.Amp: bfr.Add(Bry__amp); break;
|
||||
case Byte_ascii.Apos: bfr.Add(Bry__apos); break;
|
||||
case Byte_ascii.Eq: bfr.Add(Bry__eq); break;
|
||||
case Byte_ascii.Plus: bfr.Add(Bry__plus); break;
|
||||
default: bfr.Add_byte(b); break;
|
||||
}
|
||||
}
|
||||
return bb.To_bry_and_clear();
|
||||
return bfr.To_bry_and_clear();
|
||||
}
|
||||
private static final byte[] Bry_amp = Bry_.new_a7("%26"), Bry_eq = Bry_.new_a7("%3D")
|
||||
, Bry_plus = Bry_.new_a7("%2B"), Bry_apos = Bry_.new_a7("%27")
|
||||
, Bry_underline = new byte[] {Byte_ascii.Underline}
|
||||
;
|
||||
Bry_bfr bb = Bry_bfr_.New();
|
||||
public static final Xoa_url_encoder Instance = new Xoa_url_encoder(); Xoa_url_encoder() {}
|
||||
private static final byte[] Bry__amp = Bry_.new_a7("%26"), Bry__eq = Bry_.new_a7("%3D")
|
||||
, Bry__plus = Bry_.new_a7("%2B"), Bry__apos = Bry_.new_a7("%27")
|
||||
, Bry__underline = new byte[] {Byte_ascii.Underline}
|
||||
;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class Db_mgr_fxt {
|
||||
public void Init_page_insert(Int_obj_ref page_id_next, int ns_id, String[] ttls) {
|
||||
Xowe_wiki wiki = this.Wiki();
|
||||
int len = ttls.length;
|
||||
DateAdp modified_on = Tfds.Now_time0_add_min(0);
|
||||
DateAdp modified_on = Datetime_now.Dflt_add_min_(0);
|
||||
Xowd_page_tbl tbl_page = wiki.Db_mgr_as_sql().Core_data_mgr().Tbl__page();
|
||||
tbl_page.Insert_bgn();
|
||||
for (int i = 0; i < len; i++) {
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.bldrs; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.core.primitives.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.xtns.wdatas.imports.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.xtns.wbases.imports.*;
|
||||
import gplx.xowa.bldrs.wkrs.*; import gplx.xowa.bldrs.cmds.texts.*; import gplx.xowa.bldrs.cmds.texts.sqls.*; import gplx.xowa.bldrs.cmds.texts.tdbs.*; import gplx.xowa.addons.bldrs.files.*; import gplx.xowa.bldrs.cmds.ctgs.*; import gplx.xowa.bldrs.cmds.utils.*;
|
||||
import gplx.xowa.bldrs.cmds.diffs.*;
|
||||
import gplx.xowa.files.origs.*; import gplx.xowa.htmls.core.bldrs.*;
|
||||
|
||||
@@ -34,7 +34,7 @@ public class Xob_db_file {
|
||||
public static Xob_db_file New__page_link(Xow_wiki wiki) {return New(wiki.Fsys_mgr().Root_dir(), Name__page_link);}
|
||||
public static Xob_db_file New__page_file_map(Xow_wiki wiki) {return New(wiki.Fsys_mgr().Root_dir(), wiki.Domain_str() + "-file-page_map.xowa");}
|
||||
public static Xob_db_file New__deletion_db(Xow_wiki wiki) {
|
||||
String name = String_.Format("{0}-file-core-deletion_db-{1}.xowa", wiki.Domain_str(), DateAdp_.Now().XtoStr_fmt("yyyy.MM"));
|
||||
String name = String_.Format("{0}-file-core-deletion_db-{1}.xowa", wiki.Domain_str(), Datetime_now.Get().XtoStr_fmt("yyyy.MM"));
|
||||
return New(wiki.Fsys_mgr().Root_dir(), name);
|
||||
}
|
||||
public static Xob_db_file New(Io_url dir, String name) {
|
||||
|
||||
@@ -204,6 +204,7 @@ public abstract class Xob_dump_mgr_base extends Xob_itm_basic_base implements Xo
|
||||
else if (ctx.Match(k, Invk_exec_count_max_)) exec_count_max = m.ReadInt("v");
|
||||
else if (ctx.Match(k, Invk_exit_now_)) exit_now = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_exit_after_commit_)) exit_after_commit = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk__manual_now_)) Datetime_now.Manual_and_freeze_(m.ReadDate("v"));
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
@@ -218,6 +219,7 @@ public abstract class Xob_dump_mgr_base extends Xob_itm_basic_base implements Xo
|
||||
, Invk_load_tmpls_ = "load_tmpls_"
|
||||
, Invk_poll_mgr = "poll_mgr", Invk_reset_db_ = "reset_db_"
|
||||
, Invk_exec_count_max_ = "exec_count_max_", Invk_exit_now_ = "exit_now_", Invk_exit_after_commit_ = "exit_after_commit_"
|
||||
, Invk__manual_now_ = "manual_now_"
|
||||
;
|
||||
}
|
||||
class Xob_dump_mgr_base_ {
|
||||
|
||||
@@ -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.bldrs.cmds.texts; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.cmds.*;
|
||||
import gplx.xowa.xtns.wdatas.*;
|
||||
import gplx.xowa.xtns.wbases.*;
|
||||
import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.wkrs.*; import gplx.xowa.bldrs.xmls.*; import gplx.xowa.bldrs.cmds.texts.xmls.*;
|
||||
import gplx.xowa.bldrs.css.*; import gplx.xowa.wikis.domains.*;
|
||||
public abstract class Xob_init_base implements Xob_cmd, Gfo_invk {
|
||||
|
||||
@@ -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.bldrs.cmds.texts; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.cmds.*;
|
||||
import gplx.xowa.bldrs.wkrs.*; import gplx.xowa.bldrs.xmls.*; import gplx.xowa.xtns.wdatas.*; import gplx.xowa.wikis.data.tbls.*; import gplx.xowa.wikis.dbs.*;
|
||||
import gplx.xowa.bldrs.wkrs.*; import gplx.xowa.bldrs.xmls.*; import gplx.xowa.xtns.wbases.*; import gplx.xowa.wikis.data.tbls.*; import gplx.xowa.wikis.dbs.*;
|
||||
public abstract class Xob_term_base implements Xob_cmd, Gfo_invk {
|
||||
public Xob_term_base Ctor(Xob_bldr bldr, Xowe_wiki wiki) {this.wiki = wiki; return this;} private Xowe_wiki wiki;
|
||||
public abstract String Cmd_key();
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.bldrs.cmds.texts.sqls; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.cmds.*; import gplx.xowa.bldrs.cmds.texts.*;
|
||||
import gplx.xowa.bldrs.*; import gplx.xowa.apps.apis.xowa.bldrs.imports.*;
|
||||
import gplx.xowa.xtns.wdatas.imports.*;
|
||||
import gplx.xowa.xtns.wbases.imports.*;
|
||||
public class Xob_init_cmd extends Xob_init_base {
|
||||
public Xob_init_cmd(Xob_bldr bldr, Xowe_wiki wiki) {this.Ctor(bldr, wiki);}
|
||||
@Override public String Cmd_key() {return Xob_cmd_keys.Key_text_init;}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class Xob_page_cmd extends Xob_itm_basic_base implements Xob_page_wkr, Gf
|
||||
this.redirect_mgr = wiki.Redirect_mgr();
|
||||
this.db_mgr = wiki.Db_mgr_as_sql().Core_data_mgr();
|
||||
this.page_core_tbl = db_mgr.Tbl__page();
|
||||
this.text_zip_mgr = Xoa_app_.Utl__zip_mgr(); text_zip_tid = import_cfg.Zip_tid_text();
|
||||
this.text_zip_mgr = wiki.Utl__zip_mgr(); text_zip_tid = import_cfg.Zip_tid_text();
|
||||
this.ns_to_db_mgr = new Xob_ns_to_db_mgr(new Xob_ns_to_db_wkr__text(), db_mgr, import_cfg.Text_db_max());
|
||||
this.dg_match_mgr = app.Api_root().Bldr().Wiki().Filter().Dansguardian().New_mgr(wiki.Domain_str(), wiki.Fsys_mgr().Root_dir());
|
||||
if (dg_match_mgr != null) redirect_id_enabled = true; // always enable redirect_id if dg_match_mgr enabled; DATE:2016-01-04
|
||||
|
||||
@@ -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.bldrs.cmds.texts.tdbs; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.cmds.*; import gplx.xowa.bldrs.cmds.texts.*;
|
||||
import gplx.xowa.xtns.wdatas.imports.*;
|
||||
import gplx.xowa.xtns.wbases.imports.*;
|
||||
public class Xob_init_tdb extends Xob_init_base {
|
||||
public Xob_init_tdb(Xob_bldr bldr, Xowe_wiki wiki) {this.Ctor(bldr, wiki);}
|
||||
@Override public String Cmd_key() {return Xob_cmd_keys.Key_tdb_text_init;}
|
||||
|
||||
@@ -39,13 +39,13 @@ public class Xob_download_cmd extends Xob_cmd__base implements Xob_cmd {
|
||||
if (dump_trg_bin == null && unzip)
|
||||
dump_trg_bin = dump_trg_zip.GenNewNameAndExt(dump_trg_zip.NameOnly()); // convert a.sql.gz -> a.sql
|
||||
// download
|
||||
usr_dlg.Note_many("", "", "downloading file: now=~{0} src=~{1} trg=~{2}", DateAdp_.Now().XtoStr_fmt_yyyyMMdd_HHmmss(), dump_src, dump_trg_zip.OwnerDir());
|
||||
usr_dlg.Note_many("", "", "downloading file: now=~{0} src=~{1} trg=~{2}", Datetime_now.Get().XtoStr_fmt_yyyyMMdd_HHmmss(), dump_src, dump_trg_zip.OwnerDir());
|
||||
IoEngine_xrg_downloadFil download_wkr = app.Wmf_mgr().Download_wkr().Download_xrg();
|
||||
download_wkr.Src_last_modified_query_(false).Init(dump_src, dump_trg_zip);
|
||||
if (!download_wkr.Exec())
|
||||
usr_dlg.Warn_many("", "", "download failed: src=~{0} trg=~{1} err=~{2}", dump_src, dump_trg_zip.Raw(), Err_.Message_gplx_full(download_wkr.Rslt_err()));
|
||||
if (unzip) { // parsing unzipped file is faster, but takes up more storage space
|
||||
usr_dlg.Note_many("", "", "unzipping file: now=~{0} trg=~{1}", DateAdp_.Now().XtoStr_fmt_yyyyMMdd_HHmmss(), dump_trg_bin.Raw());
|
||||
usr_dlg.Note_many("", "", "unzipping file: now=~{0} trg=~{1}", Datetime_now.Get().XtoStr_fmt_yyyyMMdd_HHmmss(), dump_trg_bin.Raw());
|
||||
Xob_unzip_wkr unzip_wkr = new Xob_unzip_wkr().Init(app).Process_run_mode_(Process_adp.Run_mode_sync_block);
|
||||
unzip_wkr.Decompress(dump_trg_zip, dump_trg_bin);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class Xob_site_meta_cmd implements Xob_cmd {
|
||||
Xoa_app app = bldr.App();
|
||||
if (wikis == null) wikis = Xow_domain_regy.All;
|
||||
if (db_url == null) db_url = app.Fsys_mgr().Cfg_site_meta_fil();
|
||||
if (cutoff_time == null) cutoff_time = DateAdp_.Now().Add_day(-1);
|
||||
if (cutoff_time == null) cutoff_time = Datetime_now.Get().Add_day(-1);
|
||||
Load_all(app, db_url, wikis, cutoff_time);
|
||||
}
|
||||
private void Load_all(Xoa_app app, Io_url db_url, String[] reqd_ary, DateAdp cutoff) {
|
||||
@@ -53,7 +53,7 @@ public class Xob_site_meta_cmd implements Xob_cmd {
|
||||
reqd_len = reqd_hash.Count();
|
||||
for (int i = 0; i < reqd_len; ++i) {
|
||||
String domain_str = (String)reqd_hash.Get_at(i);
|
||||
DateAdp json_date = DateAdp_.Now();
|
||||
DateAdp json_date = Datetime_now.Get();
|
||||
byte[] json_text = null;
|
||||
for (int j = 0; j < 5; ++j) {
|
||||
json_text = gplx.xowa.bldrs.wms.Xowm_api_mgr.Call_by_qarg(usr_dlg, inet_conn, domain_str, Xoa_site_cfg_loader__inet.Qarg__all);
|
||||
|
||||
@@ -34,7 +34,7 @@ public class Dg_parser_tst {
|
||||
@Test public void Invalid_score() {fxt.Test_parse_line("<a><1a>", fxt.Make_line(Dg_rule.Score_banned, "a"));}
|
||||
// @Test public void Parse_dir() {
|
||||
// Dg_parser parser = new Dg_parser();
|
||||
// Gfo_usr_dlg_.I = Xoa_app_.usr_dlg_console_();
|
||||
// Gfo_usr_dlg_.I = Xoa_app_.New__usr_dlg__console();
|
||||
// parser.Parse_dir(Io_url_.new_dir_("C:\\xowa\\bin\\any\\xowa\\bldr\\filters\simple.wikipedia.org\\Dansguardian\\\\"));
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -56,6 +56,6 @@ public class Xob_info_session {
|
||||
, Cfg_key__time = "time" // EX: 20150102 030405
|
||||
, Cfg_key__guid = "guid" // EX: 00000000-0000-0000-0000-000000000000
|
||||
;
|
||||
public static Xob_info_session new_(String user, String wiki_domain, String dump_name) {return new Xob_info_session(user, Xoa_app_.Version, wiki_domain, dump_name, DateAdp_.Now(), Guid_adp_.New());}
|
||||
public static Xob_info_session new_(String user, String wiki_domain, String dump_name) {return new Xob_info_session(user, Xoa_app_.Version, wiki_domain, dump_name, Datetime_now.Get(), Guid_adp_.New());}
|
||||
public static final Xob_info_session Test = new_("anonymous", "en.wikipedia.org", "enwiki-latest-pages-articles");
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.bldrs.installs; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*;
|
||||
import org.junit.*;
|
||||
import gplx.core.consoles.*;
|
||||
import gplx.core.brys.args.*; import gplx.core.threads.*; import gplx.xowa.bldrs.setups.maints.*; import gplx.xowa.xtns.wdatas.imports.*;
|
||||
import gplx.core.brys.args.*; import gplx.core.threads.*; import gplx.xowa.bldrs.setups.maints.*; import gplx.xowa.xtns.wbases.imports.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
import gplx.xowa.bldrs.wms.*; import gplx.xowa.bldrs.wms.dumps.*;
|
||||
public class Xoi_cmd_wiki_tst {
|
||||
|
||||
@@ -62,11 +62,11 @@ public class Xod_page_mgr {
|
||||
catch (Exception e) {Gfo_log_.Instance.Warn("failed to generate special page", "url", url.To_str(), "err", Err_.Message_gplx_log(e)); return rv;}
|
||||
|
||||
// handle redirects; EX: Special:XowaWikiInfo
|
||||
Xopg_redirect_itm redirect_itm = page.Redirect().Itms__get_at_nth_or_null();
|
||||
Xopg_redirect_itm redirect_itm = page.Redirect_trail().Itms__get_at_nth_or_null();
|
||||
if (redirect_itm != null)
|
||||
return Get_page(wiki, redirect_itm.Url());
|
||||
|
||||
rv.Init(-1, -1, String_.new_u8(ttl.Page_txt()), String_.new_u8(ttl.Page_db()), null, null, DateAdp_.Now().XtoStr_fmt_iso_8561(), false, false, false, 0, "", "", "");
|
||||
rv.Init(-1, -1, String_.new_u8(ttl.Page_txt()), String_.new_u8(ttl.Page_db()), null, null, Datetime_now.Get().XtoStr_fmt_iso_8561(), false, false, false, 0, "", "", "");
|
||||
rv.Init_by_hpg(page);
|
||||
Xoh_section_itm section = new Xoh_section_itm(1, 1, Bry_.Empty, Bry_.Empty);
|
||||
section.Content_(page.Html_data().Custom_body());
|
||||
|
||||
@@ -24,7 +24,7 @@ public class Xof_ext_ {
|
||||
, Id_mid = 10, Id_ogg = 11, Id_oga = 12, Id_ogv = 13, Id_webm = 14
|
||||
, Id_flac = 15, Id_bmp = 16, Id_xcf = 17, Id_wav = 18;
|
||||
public static final int Id__max = 19;
|
||||
public static final byte[]
|
||||
public static final byte[]
|
||||
Bry_png = Bry_.new_a7("png"), Bry_jpg = Bry_.new_a7("jpg"), Bry_jpeg = Bry_.new_a7("jpeg")
|
||||
, Bry_gif = Bry_.new_a7("gif"), Bry_tif = Bry_.new_a7("tif"), Bry_tiff = Bry_.new_a7("tiff")
|
||||
, Bry_svg = Bry_.new_a7("svg"), Bry_djvu = Bry_.new_a7("djvu"), Bry_pdf = Bry_.new_a7("pdf")
|
||||
@@ -32,7 +32,7 @@ public class Xof_ext_ {
|
||||
, Bry_ogv = Bry_.new_a7("ogv"), Bry_webm = Bry_.new_a7("webm"), Bry_flac = Bry_.new_a7("flac")
|
||||
, Bry_bmp = Bry_.new_a7("bmp"), Bry_xcf = Bry_.new_a7("xcf"), Bry_wav = Bry_.new_a7("wav")
|
||||
;
|
||||
public static final byte[][] Bry__ary = new byte[][]
|
||||
public static final byte[][] Bry__ary = new byte[][]
|
||||
{ Bry_.Empty, Bry_png, Bry_jpg, Bry_jpeg
|
||||
, Bry_gif, Bry_tif, Bry_tiff
|
||||
, Bry_svg, Bry_djvu, Bry_pdf
|
||||
@@ -40,7 +40,7 @@ public class Xof_ext_ {
|
||||
, Bry_ogv, Bry_webm, Bry_flac
|
||||
, Bry_bmp, Bry_xcf, Bry_wav
|
||||
};
|
||||
public static final byte[][] Mime_type__ary = new byte[][]
|
||||
public static final byte[][] Mime_type__ary = new byte[][]
|
||||
{ Bry_.new_a7("application/octet-stream"), Bry_.new_a7("image/png"), Bry_.new_a7("image/jpg"), Bry_.new_a7("image/jpeg")
|
||||
, Bry_.new_a7("image/gif"), Bry_.new_a7("image/tiff"), Bry_.new_a7("image/tiff")
|
||||
, Bry_.new_a7("image/svg+xml"), Bry_.new_a7("image/x.djvu"), Bry_.new_a7("application/pdf")
|
||||
@@ -48,7 +48,7 @@ public class Xof_ext_ {
|
||||
, Bry_.new_a7("video/ogg"), Bry_.new_a7("video/webm"), Bry_.new_a7("audio/flac")
|
||||
, Bry_.new_a7("image/bmp"), Bry_.new_a7("image/xcf"), Bry_.new_a7("audio/x-wav")
|
||||
};
|
||||
private static final Hash_adp id_hash = id_hash_new_();
|
||||
private static final Hash_adp id_hash = id_hash_new_();
|
||||
private static Hash_adp id_hash_new_() {
|
||||
Hash_adp rv = Hash_adp_bry.cs();
|
||||
id_hash_new_(rv, Bry_png, Id_png); id_hash_new_(rv, Bry_jpg, Id_jpg); id_hash_new_(rv, Bry_jpeg, Id_jpeg);
|
||||
@@ -59,9 +59,9 @@ public class Xof_ext_ {
|
||||
id_hash_new_(rv, Bry_bmp, Id_bmp); id_hash_new_(rv, Bry_xcf, Id_xcf); id_hash_new_(rv, Bry_wav, Id_wav);
|
||||
return rv;
|
||||
}
|
||||
private static void id_hash_new_(Hash_adp hash, byte[] key, int val) {hash.Add(key, Int_obj_val.new_(val));}
|
||||
private static void id_hash_new_(Hash_adp hash, byte[] key, int val) {hash.Add(key, new Int_obj_val(val));}
|
||||
|
||||
private static final Hash_adp_bry ext_hash = Hash_adp_bry.ci_a7()
|
||||
private static final Hash_adp_bry ext_hash = Hash_adp_bry.ci_a7()
|
||||
.Add_bry_bry(Bry_png).Add_bry_bry(Bry_jpg).Add_bry_bry(Bry_jpeg)
|
||||
.Add_bry_bry(Bry_gif).Add_bry_bry(Bry_tif).Add_bry_bry(Bry_tiff)
|
||||
.Add_bry_bry(Bry_svg).Add_bry_bry(Bry_djvu).Add_bry_bry(Bry_pdf)
|
||||
@@ -69,7 +69,7 @@ public class Xof_ext_ {
|
||||
.Add_bry_bry(Bry_ogv).Add_bry_bry(Bry_webm).Add_bry_bry(Bry_flac)
|
||||
.Add_bry_bry(Bry_bmp).Add_bry_bry(Bry_xcf).Add_bry_bry(Bry_wav)
|
||||
;
|
||||
private static final Xof_ext[] Ary = new Xof_ext[Id__max];
|
||||
private static final Xof_ext[] Ary = new Xof_ext[Id__max];
|
||||
|
||||
public static byte[] Get_ext_by_id_(int id) {
|
||||
if (id < 0 || id >= Id__max) throw Err_.new_wo_type("index out of bounds", "id", id);
|
||||
|
||||
@@ -23,11 +23,11 @@ public class Xof_mime_minor_ {
|
||||
int id = id_obj == null ? Xof_ext_.Id_unknown : id_obj.Val();
|
||||
return Xof_ext_.new_by_id_(id);
|
||||
}
|
||||
private static final byte[]
|
||||
private static final byte[]
|
||||
Mime_svg = Bry_.new_a7("svg+xml"), Mime_djvu = Bry_.new_a7("vnd.djvu"), Mime_midi = Bry_.new_a7("midi")
|
||||
, Mime_xcf = Bry_.new_a7("x-xcf"), Mime_flac = Bry_.new_a7("x-flac")
|
||||
, Mime_bmp = Bry_.new_a7("x-bmp"), Mime_bmp_2 = Bry_.new_a7("x-ms-bmp");
|
||||
private static final Hash_adp mime_hash = mime_hash_();
|
||||
private static final Hash_adp mime_hash = mime_hash_();
|
||||
private static Hash_adp mime_hash_() {
|
||||
Hash_adp rv = Hash_adp_bry.cs();
|
||||
mime_hash_itm_(rv, Xof_ext_.Bry_png , Xof_ext_.Id_png);
|
||||
@@ -51,5 +51,5 @@ public class Xof_mime_minor_ {
|
||||
mime_hash_itm_(rv, Xof_ext_.Bry_wav , Xof_ext_.Id_wav);
|
||||
return rv;
|
||||
}
|
||||
private static void mime_hash_itm_(Hash_adp hash, byte[] key, int val) {hash.Add(key, Int_obj_val.new_(val));}
|
||||
private static void mime_hash_itm_(Hash_adp hash, byte[] key, int val) {hash.Add(key, new Int_obj_val(val));}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user