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

'v3.4.3.1'

This commit is contained in:
gnosygnu
2016-04-17 23:47:45 -04:00
parent 14471ca656
commit ad140a93fe
102 changed files with 1278 additions and 382 deletions

View File

@@ -41,6 +41,7 @@ public class Xoax_addon_mgr {
, new gplx.xowa.addons.apps.searchs .Xoax_builds_search_addon()
, new gplx.xowa.addons.apps.file_browsers .Fbrow_addon()
, new gplx.xowa.addons.updates.files .Xoax_updates_files_addon()
, new gplx.xowa.addons.builds.htmls .Html__dump_to_fsys__addon()
);
return this;
}

View File

@@ -39,7 +39,7 @@ public class Fbrow_special_page implements Xows_page {
// write head
Xopage_html_data rv = new Xopage_html_data(Display_ttl, body);
rv.Head_tags().Add(Xopg_tag_itm.New_css(addon_dir.GenSubFil_nest("bin", "file_browser.css")));
rv.Head_tags().Add(Xopg_tag_itm.New_css_file(addon_dir.GenSubFil_nest("bin", "file_browser.css")));
return rv;
}

View File

@@ -42,7 +42,7 @@ class Wikis_list_wtr {
// write to html
Xopage_html_data rv = new Xopage_html_data(Wikis_list_page.Display_ttl, body);
rv.Head_tags().Add(Xopg_tag_itm.New_css(addon_dir.GenSubFil_nest("bin", "wiki_list.css")));
rv.Head_tags().Add(Xopg_tag_itm.New_css_file(addon_dir.GenSubFil_nest("bin", "wiki_list.css")));
return rv;
}
private static byte[] Get_root_url() {

View File

@@ -30,9 +30,6 @@ public class Xopage_html_data {
public void Apply(Xoa_page page) {
page.Html_data().Html_restricted_n_();
page.Html_data().Skip_parse_(Bool_.Y);
Bry_bfr bfr = Bry_bfr.new_();
page.Html_data().Custom_head_end_concat(head_tags.To_html(bfr));
page.Html_data().Custom_html_end_concat(tail_tags.To_html(bfr));
page.Html_data().Display_ttl_(display_ttl);
page.Html_data().Custom_body_(this.Body());
page.Html_data().Custom_head_tags().Copy(head_tags);

View File

@@ -16,20 +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.xowa.addons.apps.searchs.bldrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*; import gplx.xowa.addons.apps.searchs.*;
import gplx.xowa.bldrs.*;
import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.wkrs.*;
public class Srch_bldr_wkr implements Xob_page_wkr {
private final Xowe_wiki wiki;
private final Srch_temp_tbl_wkr temp_tbl_wkr = new Srch_temp_tbl_wkr();
public Srch_bldr_wkr(Xob_bldr bldr, Xowe_wiki wiki) {this.wiki = wiki;}
public String Wkr_key() {return Xob_cmd_keys.Key_text_search_wkr;}
public void Wkr_bgn(Xob_bldr bldr) {
public String Page_wkr__key() {return Xob_cmd_keys.Key_text_search_wkr;}
public void Page_wkr__bgn() {
temp_tbl_wkr.Init(Bool_.N, wiki);
}
public void Wkr_run(gplx.xowa.wikis.data.tbls.Xowd_page_itm page) {
public void Page_wkr__run(gplx.xowa.wikis.data.tbls.Xowd_page_itm page) {
try {temp_tbl_wkr.Exec_by_wkr(page.Id(), page.Ttl_page_db());}
catch (Exception e) {Gfo_usr_dlg_.Instance.Warn_many("", "", "search:error: page=~{0} err=~{1}", page.Ttl_page_db(), Err_.Message_gplx_full(e));}
}
public void Wkr_end() {
public void Page_wkr__run_cleanup() {}
public void Page_wkr__end() {
temp_tbl_wkr.Term();
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {return this;}

View File

@@ -50,10 +50,10 @@ class Srch_temp_tbl_wkr implements Srch_text_parser_wkr {
Db_conn word_conn = search_temp_tbl.conn;
// update search_word ids if they exist
Srch_db_mgr.Optimize_unsafe_(word_conn, Bool_.Y);
// Srch_db_mgr.Optimize_unsafe_(word_conn, Bool_.Y); // NOTE: fails in multi-db due to transaction
Update_word_id(word_conn, wiki);
Search_word__insert(word_conn);
Srch_db_mgr.Optimize_unsafe_(word_conn, Bool_.N);
// Srch_db_mgr.Optimize_unsafe_(word_conn, Bool_.N);
// create search_link
Db_conn page_conn = wiki.Data__core_mgr().Tbl__page().conn;

View File

@@ -39,10 +39,10 @@ public class Srch_temp_tbl {
}
public void Insert_end() {
conn.Txn_end();
stmt_insert = Db_stmt_.Rls(stmt_insert);
Srch_db_mgr.Optimize_unsafe_(conn, Bool_.Y);
conn.Meta_idx_create(Xoa_app_.Usr_dlg(), Dbmeta_idx_itm.new_unique_by_tbl(tbl_name, "word_text__word_id", fld_word_text, fld_word_id));
stmt_insert = Db_stmt_.Rls(stmt_insert);
// Srch_db_mgr.Optimize_unsafe_(conn, Bool_.Y); // NOTE: fails in multi-db due to transaction
conn.Meta_idx_create(Xoa_app_.Usr_dlg(), Dbmeta_idx_itm.new_normal_by_tbl(tbl_name, "word_text__word_id", fld_word_text, fld_word_id));
// conn.Meta_idx_create(Xoa_app_.Usr_dlg(), Dbmeta_idx_itm.new_normal_by_tbl(tbl_name, "page_id", fld_page_id));
Srch_db_mgr.Optimize_unsafe_(conn, Bool_.N);
// Srch_db_mgr.Optimize_unsafe_(conn, Bool_.N);
}
}

View File

@@ -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.builds.htmls; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.builds.*;
import gplx.xowa.bldrs.wkrs.*;
public class Html__dump_to_fsys__addon implements Xoax_addon_itm, Xoax_addon_itm__bldr {
public Xob_cmd[] Cmds_ary() {
return new Xob_cmd[]
{ Html__dump_to_fsys__cmd.Prototype
};
}
public static final byte[] ADDON_KEY = Bry_.new_a7("xowa.builds.htmls");
public byte[] Addon__key() {return ADDON_KEY;}
}

View File

@@ -15,43 +15,54 @@ 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.updates.files; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.updates.*;
package gplx.xowa.addons.builds.htmls; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.builds.*;
import gplx.dbs.*;
import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.wkrs.*; import gplx.xowa.htmls.core.htmls.*;
import gplx.fsdb.*; import gplx.fsdb.meta.*; import gplx.xowa.files.*;
import gplx.langs.mustaches.*;
public class Xobldr__deletion_db__temp extends Xob_cmd__base {
private Io_url template_url, dump_root;
public Xobldr__deletion_db__temp(Xob_bldr bldr, Xowe_wiki wiki) {super(bldr, wiki);}
import gplx.xowa.wikis.pages.*;
public class Html__dump_to_fsys__cmd extends Xob_cmd__base {
private Io_url template_url, fsys_root;
private byte[] http_root, page_root;
private boolean skip_unchanged = true;
public Html__dump_to_fsys__cmd(Xob_bldr bldr, Xowe_wiki wiki) {super(bldr, wiki);}
@Override public void Cmd_run() {
// init mustache
Mustache_tkn_parser parser = new Mustache_tkn_parser();
Mustache_tkn_itm root = parser.Parse(Io_mgr.Instance.LoadFilBry(template_url));
Mustache_render_ctx ctx = new Mustache_render_ctx();
Bry_bfr bfr = Bry_bfr.new_();
Mustache_bfr mbfr = new Mustache_bfr(bfr);
Xo_page_dump_to_html page_itm = new Xo_page_dump_to_html();
Html_page_itm page_itm = new Html_page_itm();
// load rdr
Xoh_wtr_ctx hctx = Xoh_wtr_ctx.File_dump(page_root, Bry_.new_a7(".html"));
wiki.Init_assert();
gplx.xowa.wikis.data.tbls.Xowd_page_tbl page_tbl = wiki.Data__core_mgr().Db__core().Tbl__page();
Db_conn conn = page_tbl.conn;
Db_rdr rdr = conn.Exec_rdr("SELECT page_id, page_title, page_touched FROM page WHERE page_namespace = 0;");
Xoh_wtr_ctx hctx = Xoh_wtr_ctx.File_dump(Bry_.new_a7("/page/"), Bry_.new_a7(".html"));
while (rdr.Move_next()) {
String page_ttl = rdr.Read_str("page_title");
String page_ttl_str = rdr.Read_str("page_title");
try {
Xoa_ttl ttl = wiki.Ttl_parse(Bry_.new_u8(page_ttl));
DateAdp page_modified_last = DateAdp_.parse_fmt(rdr.Read_str("page_touched"), gplx.xowa.wikis.data.tbls.Xowd_page_tbl.Page_touched_fmt);
Xoae_page page = wiki.Data_mgr().Load_page_by_ttl(wiki.Utl__url_parser().Parse(Bry_.new_u8(page_ttl)), ttl);
// load page
Xoa_ttl page_ttl = wiki.Ttl_parse(Bry_.new_u8(page_ttl_str));
DateAdp page_modified_on = DateAdp_.parse_fmt(rdr.Read_str("page_touched"), gplx.xowa.wikis.data.tbls.Xowd_page_tbl.Page_touched_fmt);
Io_url dump_fil_url = Io_url_.new_fil_(fsys_root.Gen_sub_path_for_os(page_ttl_str) + ".html");
if (skip_unchanged && Io_mgr.Instance.QueryFil(dump_fil_url).ModifiedTime().Eq(page_modified_on)) continue;
// parse page
Xoae_page page = wiki.Data_mgr().Load_page_by_ttl(wiki.Utl__url_parser().Parse(page_ttl.Page_db()), page_ttl);
wiki.Parser_mgr().Parse(page, true);
page.Wikie().Html_mgr().Page_wtr_mgr().Page_read_fmtr().Fmt_("~{page_data}");
page.Wikie().Html_mgr().Page_wtr_mgr().Wkr(gplx.xowa.wikis.pages.Xopg_page_.Tid_read).Write_body(bfr, hctx, page);
byte[] html_src = bfr.To_bry_and_clear();//page.Wikie().Html_mgr().Page_wtr_mgr().Gen(page, gplx.xowa.wikis.pages.Xopg_page_.Tid_read); // NOTE: must use wiki of page, not of owner tab; DATE:2015-03-05
page_itm.Init(page_ttl, Bry_.Empty, Bry_.Empty, html_src);
byte[] html_head = page.Html_data().Custom_head_tags().To_html__style(bfr);
// fmt with mustache; write to file
page_itm.Init(http_root, page_root, page_ttl.Page_txt(), html_head, Bry_.Empty, html_src);
root.Render(mbfr, ctx.Init(page_itm));
Io_url dump_fil_url = Io_url_.new_fil_(dump_root.Gen_sub_path_for_os(page_ttl) + ".html");
if (Io_mgr.Instance.QueryFil(dump_fil_url).ModifiedTime().Eq(page_modified_last)) continue;
Io_mgr.Instance.SaveFilBry(dump_fil_url, mbfr.To_bry_and_clear());
Io_mgr.Instance.UpdateFilModifiedTime(dump_fil_url, page_modified_last);
Io_mgr.Instance.UpdateFilModifiedTime(dump_fil_url, page_modified_on);
} catch (Exception e) {
Gfo_usr_dlg_.Instance.Warn_many("", "", "err: ~{0}", Err_.Message_gplx_log(e));
}
@@ -59,37 +70,19 @@ public class Xobldr__deletion_db__temp extends Xob_cmd__base {
}
@Override public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk__template_url_)) this.template_url = m.ReadIoUrl("v");
else if (ctx.Match(k, Invk__dump_root_)) this.dump_root = m.ReadIoUrl("v");
else if (ctx.Match(k, Invk__fsys_root_)) this.fsys_root = m.ReadIoUrl("v");
else if (ctx.Match(k, Invk__http_root_)) this.http_root = m.ReadBry("v");
else if (ctx.Match(k, Invk__page_root_)) this.page_root = m.ReadBry("v");
else if (ctx.Match(k, Invk__skip_unchanged_)) this.skip_unchanged = m.ReadYn("v");
else return GfoInvkAble_.Rv_unhandled;
return this;
} private static final String Invk__template_url_ = "template_url_", Invk__dump_root_ = "dump_root_";
}
private static final String Invk__template_url_ = "template_url_", Invk__fsys_root_ = "fsys_root_"
, Invk__http_root_ = "http_root_", Invk__page_root_ = "page_root_"
, Invk__skip_unchanged_ = "skip_unchanged_";
public static final String BLDR_CMD_KEY = "html.dump_to_file";
@Override public String Cmd_key() {return BLDR_CMD_KEY;}
public static final Xob_cmd Prototype = new Xobldr__deletion_db__temp(null, null);
@Override public Xob_cmd Cmd_clone(Xob_bldr bldr, Xowe_wiki wiki) {return new Xobldr__deletion_db__temp(bldr, wiki);}
}
class Xo_page_dump_to_html implements Mustache_doc_itm {
private String page_title;
private byte[] page_head_extra;
private byte[] page_caption;
private byte[] page_body;
public Xo_page_dump_to_html Init(String page_title, byte[] page_head_extra, byte[] page_caption, byte[] page_body) {
this.page_title = page_title;
this.page_head_extra = page_head_extra;
this.page_caption = page_caption;
this.page_body = page_body;
return this;
}
public boolean Mustache__write(String key, Mustache_bfr mbfr) {
if (String_.Eq(key, "page_title")) mbfr.Add_str_u8(page_title);
else if (String_.Eq(key, "page_head_extra")) mbfr.Add_bry(page_head_extra);
else if (String_.Eq(key, "page_caption")) mbfr.Add_bry(page_caption);
else if (String_.Eq(key, "page_body")) mbfr.Add_bry(page_body);
else return false;
return true;
}
public Mustache_doc_itm[] Mustache__subs(String key) {
return Mustache_doc_itm_.Ary__empty;
}
public static final Xob_cmd Prototype = new Html__dump_to_fsys__cmd(null, null);
@Override public Xob_cmd Cmd_clone(Xob_bldr bldr, Xowe_wiki wiki) {return new Html__dump_to_fsys__cmd(bldr, wiki);}
}

View File

@@ -0,0 +1,49 @@
/*
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.builds.htmls; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.builds.*;
import gplx.langs.mustaches.*;
class Html_page_itm implements Mustache_doc_itm {
private byte[] http_root;
private byte[] page_root;
private byte[] page_title;
private byte[] page_head_extra;
private byte[] page_caption;
private byte[] page_body;
public Html_page_itm Init(byte[] http_root, byte[] page_root, byte[] page_title, byte[] page_head_extra, byte[] page_caption, byte[] page_body) {
this.http_root = http_root;
this.page_root = page_root;
this.page_title = page_title;
this.page_head_extra = page_head_extra;
this.page_caption = page_caption;
this.page_body = page_body;
return this;
}
public boolean Mustache__write(String key, Mustache_bfr mbfr) {
if (String_.Eq(key, "page_title")) mbfr.Add_bry(page_title);
else if (String_.Eq(key, "http_root")) mbfr.Add_bry(http_root);
else if (String_.Eq(key, "page_root")) mbfr.Add_bry(page_root);
else if (String_.Eq(key, "page_head_extra")) mbfr.Add_bry(page_head_extra);
else if (String_.Eq(key, "page_caption")) mbfr.Add_bry(page_caption);
else if (String_.Eq(key, "page_body")) mbfr.Add_bry(page_body);
else return false;
return true;
}
public Mustache_doc_itm[] Mustache__subs(String key) {
return Mustache_doc_itm_.Ary__empty;
}
}

View File

@@ -33,7 +33,7 @@ public class Pglnk_page_link_temp_tbl implements Rls_able {
public String Tbl_name() {return tbl_name;}
public void Create_tbl() {conn.Meta_tbl_create(Dbmeta_tbl_itm.New(tbl_name, flds));}
public void Create_idx() {conn.Meta_idx_create(Gfo_usr_dlg_.Instance, Dbmeta_idx_itm.new_normal_by_tbl(tbl_name, "main", fld_src_id, fld_trg_ns, fld_trg_ttl));}
public void Insert_bgn() {conn.Txn_bgn("schema__page_link__insert"); stmt_insert = conn.Stmt_insert(tbl_name, flds);}
public void Insert_bgn() {conn.Txn_bgn("page_link__insert_bulk"); stmt_insert = conn.Stmt_insert(tbl_name, flds);}
public void Insert_end() {conn.Txn_end(); stmt_insert = Db_stmt_.Rls(stmt_insert);}
public void Insert(int src_id, int trg_ns, byte[] trg_ttl) {
if (stmt_insert == null) stmt_insert = conn.Stmt_insert(tbl_name, flds);

View File

@@ -0,0 +1,36 @@
/*
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.builds.volumes; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.builds.*;
import gplx.core.brys.*;
class Volume_make_itm implements Bry_bfr_able {
public int Uid = 0;
public int Prep_id = 0;
public int Item_type = 0; // 0=page;1=thm
public int Item_id = 0; // either page_id or fsdb_id
public String Item_name = ""; // friendly-name
public byte[] Item_ttl = Bry_.Empty; // actual name
public long Item_size = 0; // size of page / file
public void To_bfr(Bry_bfr bfr) {
}
}
/*
1|p|Earth|123|100
1|f|Earth.png|124|200
1|f|Moon.png|125|300
4|p|Sun|123|100
*/

View File

@@ -0,0 +1,63 @@
/*
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.builds.volumes; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.builds.*;
import gplx.xowa.parsers.lnkis.*; import gplx.xowa.wikis.nss.*;
interface Volume_page_loader {
boolean Load(Volume_page_itm rv, byte[] ttl);
}
class Volume_page_loader__wiki implements Volume_page_loader {
private final Xowe_wiki wiki;
public Volume_page_loader__wiki(Xowe_wiki wiki) {this.wiki = wiki;}
public boolean Load(Volume_page_itm rv, byte[] ttl) {
Xoa_ttl page_ttl = wiki.Ttl_parse(ttl); if (page_ttl == null) return false;
Xoa_url page_url = wiki.Utl__url_parser().Parse(ttl);
Xoae_page page = wiki.Data_mgr().Load_page_by_ttl(page_url, page_ttl);
Load_links(rv, page.Lnki_list());
return true;
}
private void Load_links(Volume_page_itm rv, List_adp list) {
int len = list.Len();
//gplx.xowa.wikis.data.tbls.Xowd_page_tbl page_tbl; page_tbl.Select_in__ttl
for (int i = 0; i < len; i++) {
Xop_lnki_tkn lnki = (Xop_lnki_tkn)list.Get_at(i);
int ns_id = lnki.Ns_id();
switch (ns_id) {
case Xow_ns_.Tid__special:
case Xow_ns_.Tid__media:
break;
case Xow_ns_.Tid__file:
break; // file
default:
Volume_make_itm make_itm = new Volume_make_itm();
make_itm.Item_ttl = lnki.Ttl().Page_db();
make_itm.Item_size = 1;
rv.Link_list().Add(make_itm);
break;
}
}
}
}
class Volume_page_itm {
public void Init(Xoa_ttl page_ttl, Xoa_url page_url) {
this.page_ttl = page_ttl; this.page_url = page_url;
}
public Xoa_ttl Page_ttl() {return page_ttl;} private Xoa_ttl page_ttl;
public Xoa_url Page_url() {return page_url;} private Xoa_url page_url;
public List_adp Link_list() {return link_list;} private final List_adp link_list = List_adp_.new_();
public List_adp File_list() {return file_list;} private final List_adp file_list = List_adp_.new_();
}

View File

@@ -0,0 +1,48 @@
/*
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.builds.volumes; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.builds.*;
import gplx.core.brys.*;
import gplx.dbs.*;
import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.wkrs.*;
public class Volume_prep_cmd extends Xob_cmd__base {
private Io_url prep_url, make_url;
public Volume_prep_cmd(Xob_bldr bldr, Xowe_wiki wiki) {super(bldr, wiki);}
@Override public void Cmd_run() {
Volume_prep_itm[] page_itms = new Volume_prep_rdr().Parse(prep_url);
Volume_prep_mgr prep_mgr = new Volume_prep_mgr(new Volume_page_loader__wiki(wiki));
Volume_make_itm[] make_itms = prep_mgr.Calc_makes(page_itms);
Bry_bfr bfr = Bry_bfr.new_();
for (Volume_make_itm make_itm : make_itms) {
make_itm.To_bfr(bfr);
bfr.Add_byte_nl();
}
Io_mgr.Instance.SaveFilBfr(make_url, bfr);
}
@Override public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk__prep_url_)) prep_url = m.ReadIoUrl("v");
else if (ctx.Match(k, Invk__make_url_)) make_url = m.ReadIoUrl("v");
else return super.Invk(ctx, ikey, k, m);
return this;
}
private static final String Invk__prep_url_ = "prep_url_", Invk__make_url_ = "make_url_";
public static final String BLDR_CMD_KEY = "volume.prep";
@Override public String Cmd_key() {return BLDR_CMD_KEY;}
public static final Xob_cmd Prototype = new Volume_prep_cmd(null, null);
@Override public Xob_cmd Cmd_clone(Xob_bldr bldr, Xowe_wiki wiki) {return new Volume_prep_cmd(bldr, wiki);}
}

View File

@@ -0,0 +1,36 @@
/*
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.builds.volumes; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.builds.*;
import gplx.core.brys.*;
class Volume_prep_itm implements Bry_bfr_able {
public int Prep_id = 0;
public byte[] Page_ttl = null;
public long Max_bytes = 0;
public int Max_depth = 2;
public int Max_article_count = -1;
public int Max_link_count_per_page = -1;
public boolean Skip_navbox = false;
public int Max_file_count = -1;
public long Max_file_size = -1;
public boolean Skip_audio = true;
public static final Volume_prep_itm[] Ary_empty = new Volume_prep_itm[0];
public void To_bfr(Bry_bfr bfr) {
bfr.Add(Page_ttl);
}
}
// Earth|2|100|10|100|100MB

View File

@@ -0,0 +1,76 @@
/*
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.builds.volumes; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.builds.*;
class Volume_prep_mgr {
private final Volume_page_loader loader;
private final Volume_page_itm tmp_page = new Volume_page_itm();
private final List_adp list = List_adp_.new_();
public Volume_prep_mgr(Volume_page_loader loader) {this.loader = loader;}
public Volume_make_itm[] Calc_makes(Volume_prep_itm[] ary) {
Volume_prep_ctx ctx = new Volume_prep_ctx();
int len = ary.length;
for (int i = 0; i < len; ++i) {
Volume_prep_itm itm = ary[i];
ctx.Init(ctx, itm);
Calc_make(ctx, itm.Page_ttl);
}
return (Volume_make_itm[])list.To_ary_and_clear(Volume_make_itm.class);
}
private void Calc_make(Volume_prep_ctx ctx, byte[] page_ttl) {
if (!loader.Load(tmp_page, page_ttl)) return;
if (ctx.Bytes_max != -1 && ctx.Bytes_count > ctx.Bytes_max) return;
if (ctx.Depth_count > ctx.Depth_max) return;
List_adp files_list = tmp_page.File_list();
int files_len = files_list.Len();
for (int i = 0; i < files_len; ++i) {
Volume_make_itm file_itm = (Volume_make_itm)files_list.Get_at(i);
list.Add(file_itm);
}
List_adp links_list = tmp_page.Link_list();
int links_len = links_list.Len();
for (int i = 0; i < links_len; ++i) {
if (ctx.Page_max != -1 && ctx.Page_count++ > ctx.Page_max) return;
Volume_make_itm link_itm = (Volume_make_itm)links_list.Get_at(i);
list.Add(link_itm);
ctx.Depth_count++;
Calc_make(ctx, link_itm.Item_ttl);
ctx.Depth_count--;
}
}
}
class Volume_prep_ctx {
public long Bytes_count;
public long Bytes_max;
public int Page_count;
public int Page_max;
public int Depth_count;
public int Depth_max;
public void Init(Volume_prep_ctx prv_ctx, Volume_prep_itm itm) {
this.Bytes_count = prv_ctx.Bytes_count;
this.Bytes_max = itm.Max_bytes;
this.Page_count = 1;
this.Page_max = itm.Max_article_count;
this.Depth_count = 0;
this.Depth_max = itm.Max_depth;
}
// public int Max_link_count_per_page = -1;
// public int Max_file_count = -1;
// public long Max_file_size = -1;
// public boolean Skip_navbox = false;
// public boolean Skip_audio = true;
}

View File

@@ -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.builds.volumes; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.builds.*;
class Volume_prep_rdr {
public Volume_prep_itm[] Parse(Io_url url) {return Parse(Io_mgr.Instance.LoadFilBryOr(url, null));}
public Volume_prep_itm[] Parse(byte[] src) {
if (src == null) return Volume_prep_itm.Ary_empty;
List_adp rv = List_adp_.new_();
byte[][] lines = Bry_split_.Split_lines(src);
int lines_len = lines.length;
for (int i = 0; i < lines_len; ++i) {
Volume_prep_itm itm = Parse_line_or_null(lines[i]);
if (itm != null) rv.Add(itm);
}
return (Volume_prep_itm[])rv.To_ary_and_clear(Volume_prep_itm.class);
}
private Volume_prep_itm Parse_line_or_null(byte[] line) {
byte[][] flds = Bry_split_.Split(line, Byte_ascii.Pipe);
int flds_len = flds.length; if (flds_len == 0) return null;
Volume_prep_itm rv = new Volume_prep_itm();
for (int i = 0; i < flds_len; ++i) {
byte[] fld = flds[i];
switch (i) {
case 0: rv.Page_ttl = fld; break;
default: throw Err_.new_unhandled_default(i);
}
}
return rv;
}
}

View File

@@ -0,0 +1,40 @@
/*
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.builds.volumes; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.builds.*;
import org.junit.*; import gplx.core.tests.*;
public class Volume_prep_rdr_tst {
private final Volume_prep_rdr_fxt fxt = new Volume_prep_rdr_fxt();
@Test public void Parse() {
fxt.Test__parse(String_.Concat_lines_nl_skip_last("A", "", "B")
, fxt.Make__itm("A")
, fxt.Make__itm("B")
);
}
}
class Volume_prep_rdr_fxt {
private final Volume_prep_rdr rdr = new Volume_prep_rdr();
public Volume_prep_rdr_fxt Test__parse(String raw, Volume_prep_itm... expd) {
Gftest.Eq__ary(expd, rdr.Parse(Bry_.new_u8(raw)));
return this;
}
public Volume_prep_itm Make__itm(String page_ttl) {
Volume_prep_itm rv = new Volume_prep_itm();
rv.Page_ttl = Bry_.new_u8(page_ttl);
return rv;
}
}

View File

@@ -24,7 +24,6 @@ public class Xoax_updates_files_addon implements Xoax_addon_itm, Xoax_addon_itm_
{ Xobldr__deletion_db__make.Prototype
, Xobldr__deletion_db__exec.Prototype
, Xobldr__deletion_db__small_files.Prototype
, Xobldr__deletion_db__temp.Prototype
};
}

View File

@@ -0,0 +1,91 @@
/*
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.wikis.randoms; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.wikis.*;
import gplx.core.primitives.*; import gplx.core.brys.fmtrs.*;
import gplx.dbs.*; import gplx.xowa.wikis.data.tbls.*;
import gplx.xowa.addons.wikis.randoms.dbs.*;
public class Rndm_mgr implements Rls_able {
private Rndm_core_tbl core_tbl; private final Rndm_core_row core_row = new Rndm_core_row();
private Rndm_range_tbl rng_tbl;
private Xowd_page_tbl page_tbl; private Db_stmt stmt__page__random;
public void Init(Db_conn conn, Xowd_page_tbl page_tbl) {
core_tbl = new Rndm_core_tbl(conn);
rng_tbl = new Rndm_range_tbl(conn);
this.page_tbl = page_tbl;
conn.Rls_reg(this);
}
public void Rebuild(int uid, String where_sql, int interval) {
int total_count = 0; List_adp rng_list = List_adp_.new_();
Db_conn conn = page_tbl.conn;
Db_stmt stmt = conn.Stmt_select_order(page_tbl.Tbl_name(), String_.Ary(page_tbl.Fld_page_id()), String_.Ary_empty, page_tbl.Fld_page_id());
Db_rdr rdr = stmt.Exec_select__rls_auto();
try {
while (rdr.Move_next()) {
++total_count; // add to total count first so (total_count % interval) is never 0 for total_count = 0
if (total_count % interval == 0) {
int cur_page_id = rdr.Read_int(page_tbl.Fld_page_id());
rng_list.Add(Int_obj_ref.new_(cur_page_id));
}
}
}
finally {rdr.Rls();}
conn.Txn_bgn("rndm_rebuild");
core_tbl.Upsert(uid, where_sql, total_count, interval);
int rng_ary_len = rng_list.Count();
rng_tbl.Insert_bgn(uid);
for (int i = 0; i < rng_ary_len; ++i) {
Int_obj_ref rng_itm = (Int_obj_ref)rng_list.Get_at(i);
rng_tbl.Insert_itm(uid, i + 1, rng_itm.Val());
}
rng_tbl.Insert_end();
conn.Txn_end();
}
public int Get_rndm_page(int uid) { // EX: ns=0;type_is_redirect=0
synchronized (core_row) {core_tbl.Select(core_row, uid);}
int rndm_num = RandomAdp_.new_().Next(core_row.total);
int rng_idx = rndm_num / core_row.interval;
int itm_idx = rndm_num % core_row.interval;
int page_id_bgn = rng_idx == 0 ? 0 : rng_tbl.Select_or_neg_1(uid, rng_idx);
int rv = Select_by_offset(core_row.where_sql, page_id_bgn, itm_idx);
return rv;
}
private int Select_by_offset(String where_sql, int page_id_bgn, int offset) {
Bry_bfr bfr = Bry_bfr.new_();
where_sql = fmt_where.Fmt_(where_sql).Bld_many_to_str(bfr, page_tbl.Fld_page_ns(), page_tbl.Fld_is_redirect());
String sql = fmt_sql.Bld_many_to_str(bfr, page_tbl.Tbl_name(), page_tbl.Fld_page_id(), where_sql, page_id_bgn, offset);
Db_rdr rdr = Db_rdr_.Empty;
try {
rdr = page_tbl.conn.Exec_rdr(sql);
return rdr.Move_next() ? rdr.Read_int(page_tbl.Fld_page_id()) : -1;
}
finally {rdr.Rls();}
}
public void Rls() {
stmt__page__random = Db_stmt_.Rls(stmt__page__random);
}
private static final Bry_fmt fmt_sql = Bry_fmt.New(String_.Concat_lines_nl_skip_last
( "SELECT p.~{page_id}"
, "FROM ~{page} p"
, "WHERE p.~{~page_id} > ~{page_id_bgn}"
, "~{where_sql}"
, "ORDER BY ~{page_id}"
, "LIMIT 1"
, "OFFSET ~{offset};"
), "page", "page_id", "where_sql", "page_id_bgn", "offset");
private static final Bry_fmt fmt_where = Bry_fmt.New("", "page_namespace", "page_is_redirect");
}

View File

@@ -0,0 +1,39 @@
/*
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.wikis.randoms.bldrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.wikis.*; import gplx.xowa.addons.wikis.randoms.*;
import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.wkrs.*;
public class Rndm_bldr_cmd extends Xob_cmd__base {
private int rndm_uid = 0; private String rndm_where_sql = "AND ~{page_namespace} = 0 AND ~{page_is_redirect} = 0"; private int rndm_interval = 1000;
public Rndm_bldr_cmd(Xob_bldr bldr, Xowe_wiki wiki) {super(bldr, wiki);}
@Override public void Cmd_run() {
// wiki.Special_mgr().Page_random().Mgr().Rebuild(rndm_uid, rndm_where_sql, rndm_interval);
Tfds.Write(rndm_uid, rndm_where_sql, rndm_interval);
}
@Override public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_rndm_uid_)) rndm_uid = m.ReadInt("v");
else if (ctx.Match(k, Invk_rndm_where_sql_)) rndm_where_sql = m.ReadStr("v");
else if (ctx.Match(k, Invk_rndm_interval_)) rndm_interval = m.ReadInt("v");
else return GfoInvkAble_.Rv_unhandled;
return this;
} private static final String Invk_rndm_uid_ = "rndm_uid_", Invk_rndm_where_sql_ = "rndm_where_sql_", Invk_rndm_interval_ = "rndm_interval_";
public static final String BLDR_CMD_KEY = "wiki.random";
@Override public String Cmd_key() {return BLDR_CMD_KEY;}
public static final Xob_cmd Prototype = new Rndm_bldr_cmd(null, null);
@Override public Xob_cmd Cmd_clone(Xob_bldr bldr, Xowe_wiki wiki) {return new Rndm_bldr_cmd(bldr, wiki);}
}

View File

@@ -0,0 +1,25 @@
/*
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.wikis.randoms.dbs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.wikis.*; import gplx.xowa.addons.wikis.randoms.*;
public class Rndm_core_row {
public void Load(int uid, String where_sql, int total, int interval) {this.uid = uid; this.where_sql = where_sql; this.total = total; this.interval = interval;}
public int uid;
public String where_sql;
public int total;
public int interval;
}

View File

@@ -0,0 +1,52 @@
/*
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.wikis.randoms.dbs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.wikis.*; import gplx.xowa.addons.wikis.randoms.*;
import gplx.core.ios.*; import gplx.dbs.*; import gplx.dbs.utls.*;
public class Rndm_core_tbl implements Rls_able {
private final String tbl_name = "rndm_core"; private final Dbmeta_fld_list flds = Dbmeta_fld_list.new_();
private final String fld_uid, fld_where_sql, fld_total, fld_interval;
private final Db_conn conn; private Db_stmt stmt_select;
public Rndm_core_tbl(Db_conn conn) {
this.conn = conn;
fld_uid = flds.Add_int_pkey("rndm_uid");
fld_where_sql = flds.Add_str("rndm_where_sql", 1024);
fld_total = flds.Add_int("rndm_total");
fld_interval = flds.Add_int("rndm_interval");
conn.Rls_reg(this);
}
public void Create_tbl() {conn.Meta_tbl_create(Dbmeta_tbl_itm.New(tbl_name, flds, Dbmeta_idx_itm.new_unique_by_name(tbl_name, "core", fld_uid)));}
public void Upsert(int uid, String where_sql, int total, int interval) {
conn.Stmt_delete(tbl_name, fld_uid).Crt_int(fld_uid, uid).Exec_delete();
conn.Stmt_insert(tbl_name, flds).Val_int(fld_uid, uid).Val_str(fld_where_sql, where_sql).Val_int(fld_total, total).Val_int(fld_interval, interval).Exec_insert();
}
public void Select(Rndm_core_row rv, int uid) {
if (stmt_select == null) stmt_select = conn.Stmt_select(tbl_name, flds, fld_uid);
Db_rdr rdr = stmt_select.Clear().Val_int(fld_uid, uid).Exec_select__rls_manual();
try {
if (rdr.Move_next()) {
String where_sql = rdr.Read_str(fld_where_sql);
int total = rdr.Read_int(fld_total);
int interval = rdr.Read_int(fld_interval);
rv.Load(uid, where_sql, total, interval);
}
} finally {rdr.Rls();}
}
public void Rls() {
stmt_select = Db_stmt_.Rls(stmt_select);
}
}

View File

@@ -0,0 +1,52 @@
/*
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.wikis.randoms.dbs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.wikis.*; import gplx.xowa.addons.wikis.randoms.*;
import gplx.core.ios.*; import gplx.dbs.*; import gplx.dbs.utls.*;
public class Rndm_range_tbl implements Rls_able {
private final String tbl_name = "rndm_range"; private final Dbmeta_fld_list flds = Dbmeta_fld_list.new_();
private final String fld_rng_uid, fld_rng_idx, fld_rng_page_id;
private final Db_conn conn; private Db_stmt stmt_select, stmt_insert;
public Rndm_range_tbl(Db_conn conn) {
this.conn = conn;
fld_rng_uid = flds.Add_int("rng_uid");
fld_rng_idx = flds.Add_int("rng_idx");
fld_rng_page_id = flds.Add_int("rng_page_id");
conn.Rls_reg(this);
}
public void Create_tbl() {conn.Meta_tbl_create(Dbmeta_tbl_itm.New(tbl_name, flds, Dbmeta_idx_itm.new_unique_by_name(tbl_name, "core", fld_rng_uid, fld_rng_idx)));}
public void Insert_bgn(int uid) {
conn.Stmt_delete(tbl_name, fld_rng_uid).Crt_int(fld_rng_uid, uid).Exec_delete();
stmt_insert = conn.Stmt_insert(tbl_name, flds);
}
public void Insert_itm(int uid, int idx, int page_id) {
stmt_insert.Clear().Val_int(fld_rng_uid, uid).Val_int(fld_rng_idx, idx).Val_int(fld_rng_page_id, page_id).Exec_insert();
}
public void Insert_end() {
stmt_insert = Db_stmt_.Rls(stmt_insert);
}
public int Select_or_neg_1(int core_uid, int rng_idx) {
if (stmt_select == null) stmt_select = conn.Stmt_select(tbl_name, flds, fld_rng_uid, fld_rng_idx);
Db_rdr rdr = stmt_select.Clear().Val_int(fld_rng_uid, core_uid).Val_int(fld_rng_idx, rng_idx).Exec_select__rls_manual();
try {return rdr.Move_next() ? rdr.Read_int(fld_rng_page_id) : -1;}
catch (Exception e) {Gfo_usr_dlg_.Instance.Warn_many("", "", "failed to get rndm_idx; url=~{0} core_uid=~{1} rng_idx=~{2} err=~{3}", conn.Conn_info().Db_api(), core_uid, rng_idx, Err_.Message_gplx_log(e)); return -1;}
finally {rdr.Rls();}
}
public void Rls() {
stmt_select = Db_stmt_.Rls(stmt_select);
}
}