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

'v3.6.4.2'

This commit is contained in:
gnosygnu
2016-06-27 15:39:55 -04:00
parent b3c2d3bb5f
commit 1a4ca00c0b
23 changed files with 245 additions and 73 deletions

View File

@@ -34,7 +34,7 @@ public class Xoa_app_ {
}
}
public static final String Name = "xowa";
public static final String Version = "3.6.4.1";
public static final String Version = "3.6.4.2";
public static String Build_date = "2012-12-30 00:00:00";
public static String Op_sys_str;
public static String User_agent = "";

View File

@@ -54,4 +54,5 @@ public interface Xow_wiki extends Xow_ttl_parser, Gfo_invk {
Xow_url_parser Utl__url_parser();
Xoax_addon_mgr Addon_mgr();
void Init_needed_y_();
void Rls();
}

View File

@@ -218,12 +218,16 @@ public class Xowe_wiki implements Xow_wiki, Gfo_invk, Gfo_evt_itm {
app.Site_cfg_mgr().Load(this);
}
public void Rls() {
if (rls_list == null) return;
int len = rls_list.Count();
for (int i = 0; i < len; i++) {
Rls_able rls = (Rls_able)rls_list.Get_at(i);
rls.Rls();
if (rls_list != null) {
int len = rls_list.Count();
for (int i = 0; i < len; i++) {
Rls_able rls = (Rls_able)rls_list.Get_at(i);
rls.Rls();
}
}
Xow_db_mgr core_db_mgr = this.Data__core_mgr();
if (core_db_mgr != null) core_db_mgr.Rls();
file_mgr.Rls();
}
public void Init_needed_y_() {this.init_needed = true;}
private void Copy_cfg(Xowe_wiki wiki) {html_mgr.Copy_cfg(wiki.Html_mgr());}

View File

@@ -70,7 +70,7 @@ public class Xobc_step_map_tbl implements Db_tbl {
}
public List_adp Select_all(int task_id) {
List_adp rv = List_adp_.New();
Db_rdr rdr = conn.Stmt_select(tbl_name, flds, fld_task_id).Crt_int(fld_task_id, task_id).Exec_select__rls_auto();
Db_rdr rdr = conn.Stmt_select_order(tbl_name, flds, String_.Ary(fld_task_id), fld_step_seqn).Crt_int(fld_task_id, task_id).Exec_select__rls_auto();
try {
while (rdr.Move_next()) {
rv.Add(rdr.Read_int("step_id"));

View File

@@ -53,6 +53,7 @@ public class Xobc_work_task_tbl implements Db_tbl {
task.Task_status_(cmd_id == Xobc_cmd__base.Seqn__0 ? gplx.core.progs.Gfo_prog_ui_.Status__init : gplx.core.progs.Gfo_prog_ui_.Status__working);
task_mgr.Step_mgr().Load(task, step_id, cmd_id);
}
work_regy.Sort();
} finally {rdr.Rls();}
}
public void Insert(int task_id, int task_seqn, int step_id, int cmd_id) {

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.addons.bldrs.centrals.tasks; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*; import gplx.xowa.addons.bldrs.centrals.*;
import gplx.core.gfobjs.*;
import gplx.xowa.addons.bldrs.centrals.cmds.*; import gplx.xowa.addons.bldrs.centrals.steps.*;
public class Xobc_task_itm {
public class Xobc_task_itm implements gplx.CompareAble {
public Xobc_task_itm(int task_id, int task_seqn, int step_count, String task_key, String task_name) {
this.task_id = task_id; this.task_seqn = task_seqn;
this.step_count = step_count;
@@ -35,6 +35,7 @@ public class Xobc_task_itm {
public boolean Step_is_last() {return step.Step_seqn() == step_count - 1;}
public void Task_status_(byte v) {task_status = v;} // called when task moves from init -> working -> suspended -> done
public void Task_seqn_(int v) {this.task_seqn = v;} // called when task is init'd from db, or added to list
public int compareTo(Object obj) {Xobc_task_itm comp = (Xobc_task_itm)obj; return Int_.Compare(task_seqn, comp.task_seqn);}
public Gfobj_nde Save_to(Gfobj_nde nde) {
nde.Add_int ("task_id" , task_id);

View File

@@ -28,6 +28,7 @@ public abstract class Xobc_task_regy__base {
public Xobc_task_itm Get_at(int i) {return (Xobc_task_itm)hash.Get_at(i);}
public Xobc_task_itm Get_by(int i) {return (Xobc_task_itm)hash.Get_by(i);}
public void Del_by(int i) {hash.Del(i);}
public void Sort() {hash.Sort();}
public void Save_to(Gfobj_ary ary) {
int len = hash.Len();

View File

@@ -56,7 +56,7 @@ public class Xow_file_mgr implements Gfo_invk {
public void Version_1_y_() {version = Version_1;} // TEST:
public void Version_2_y_() {version = Version_2;} // TEST:
public void Fsdb_mgr_(Xof_fsdb_mgr fsdb_mgr) {
this.fsdb_mgr = fsdb_mgr;
this.fsdb_mgr = fsdb_mgr;
version = Version_2;
}
public int Patch_upright() {
@@ -131,6 +131,10 @@ public class Xow_file_mgr implements Gfo_invk {
orig_mgr.Init_by_wiki(wiki, fsdb_mode, db_core.File__orig_tbl_ary(), Xof_url_bldr.new_v2());
fsdb_mgr.Init_by_wiki(wiki);
}
public void Rls() {
fsdb_mgr.Rls();
db_core = null;
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_repos)) return repo_mgr;

View File

@@ -54,6 +54,9 @@ public class Xof_bin_mgr {
}
return null;
}
public void Rls() {
mnt_mgr.Rls();
}
public boolean Find_to_url_as_bool(int exec_tid, Xof_fsdb_itm fsdb) {return Find_as(Bool_.Y, rdr_wrapper, exec_tid, fsdb);}
// public boolean Find_to_url_as_bool3(int exec_tid, Xof_fsdb_itm fsdb) {return Find_to_url(exec_tid, fsdb) != Io_url_.Empty;}
// private Io_url Find_to_url(int exec_tid, Xof_fsdb_itm fsdb) {

View File

@@ -23,4 +23,5 @@ public interface Xof_fsdb_mgr {
Fsm_mnt_mgr Mnt_mgr();
void Init_by_wiki(Xow_wiki wiki);
void Fsdb_search_by_list(List_adp itms, Xow_wiki wiki, Xoa_page page, Xog_js_wkr js_wkr);
void Rls();
}

View File

@@ -62,6 +62,10 @@ public class Xof_fsdb_mgr__sql implements Xof_fsdb_mgr, Gfo_invk {
Xof_file_wkr.Show_img(fsdb, usr_dlg, wiki.File__bin_mgr(), wiki.File__mnt_mgr(), cache_mgr, wiki.File__repo_mgr(), js_wkr, img_size, url_bldr, page);
}
}
public void Rls() {
if (bin_mgr != null) bin_mgr.Rls();
init = false;
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_mnt_mgr)) return mnt_mgr;
else return Gfo_invk_.Rv_unhandled;

View File

@@ -67,8 +67,18 @@ class Xoh_toc_wtr {
switch (tag_id) {
case Gfh_tag_.Id__eos: // eos; return;
return;
case Gfh_tag_.Id__i: // always print tag
case Gfh_tag_.Id__b:
case Gfh_tag_.Id__comment: // never print tag
case Gfh_tag_.Id__img:
case Gfh_tag_.Id__br: case Gfh_tag_.Id__hr: // always ignore in TOC text; EX: en.wikipedia.org/wiki/Magnetic_resonance_imaging; ====''T''<span style="display:inline-block; margin-bottom:-0.3em; vertical-align:-0.4em; line-height:1.2em; font-size:85%; text-align:left;">*<br />2</span>-weighted MRI====
case Gfh_tag_.Id__h1: case Gfh_tag_.Id__h2: case Gfh_tag_.Id__h3: case Gfh_tag_.Id__h4: case Gfh_tag_.Id__h5: case Gfh_tag_.Id__h6:
case Gfh_tag_.Id__ul: case Gfh_tag_.Id__ol: case Gfh_tag_.Id__dd: case Gfh_tag_.Id__dt: case Gfh_tag_.Id__li:
case Gfh_tag_.Id__table: case Gfh_tag_.Id__tr: case Gfh_tag_.Id__td: case Gfh_tag_.Id__th: case Gfh_tag_.Id__thead: case Gfh_tag_.Id__tbody: case Gfh_tag_.Id__caption:
// case Gfh_tag_.Id__ref: // NOTE: don't bother printing references; NOTE: should never show up
print_tag = false;
recurse = false;
break;
case Gfh_tag_.Id__b: // always print tag
case Gfh_tag_.Id__i:
print_tag = true;
break;
case Gfh_tag_.Id__small: // only print tag if not nested
@@ -79,13 +89,6 @@ class Xoh_toc_wtr {
print_tag = true;
break;
}
case Gfh_tag_.Id__comment: // never print tag
case Gfh_tag_.Id__img:
case Gfh_tag_.Id__br:
case Gfh_tag_.Id__hr:
print_tag = false;
recurse = false;
break;
case Gfh_tag_.Id__a: // a never prints tag; also, also, do not recurse if ref
print_tag = false;
byte[] href_val = lhs.Atrs__get_as_bry(Gfh_atr_.Bry__href);

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.htmls.tocs; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*;
import org.junit.*; import gplx.core.tests.*;
public class Xoh_toc_wtr__anch__tst {
@Before public void init() {fxt.Clear();} private final Xoh_toc_wtr_fxt fxt = new Xoh_toc_wtr_fxt();
@Test public void Caption() {
fxt.Test__convert("<a href=\"/wiki/A\">b</a>", "b");
}
@Test public void Ref() { // PURPOSE: ref contents should not print in TOC; DATE:2013-07-23
fxt.Test__convert("a<sup id=\"cite_ref-0\" class=\"reference\"><a href=\"#cite_note-0\">[1]</a></sup>", "a");
}
@Test public void Category() { // PURPOSE: literal Category should show in in TOC; EX: de.w:1234; DATE:2014-01-21
fxt.Test__convert("A<a href=\"/wiki/Category:B\">Category:B</a>", "ACategory:B");
}
@Test public void File() { // PURPOSE: file should not show in in TOC; EX: tr.w:D<>nya_Miraslari; DATE:2014-06-06
fxt.Test__convert
( "<a href=\"/wiki/File:A.png\" class=\"image\" xowa_title=\"A.png\"><img id=\"xoimg_0\" alt=\"\" src=\"file:///mem/wiki/repo/trg/orig/7/0/A.png\" width=\"0\" height=\"0\" /></a> b"
, "b");
}
}

View File

@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.htmls.tocs; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*;
import org.junit.*; import gplx.core.tests.*;
public class Xoh_toc_wtr_tst {
public class Xoh_toc_wtr__keep__tst {
@Before public void init() {fxt.Clear();} private final Xoh_toc_wtr_fxt fxt = new Xoh_toc_wtr_fxt();
@Test public void Basic() {
fxt.Test__convert("a b c", "a b c");
@@ -25,39 +25,15 @@ public class Xoh_toc_wtr_tst {
@Test public void Ws() {
fxt.Test__convert(" a b ", "a b");
}
@Test public void Comment() {
fxt.Test__convert("<!--a-->", "");
}
@Test public void Comment__many() {
fxt.Test__convert("1<!--2-->3<!--4-->5", "135");
}
@Test public void Comment__dangling() {
fxt.Test__convert("1<!--2-->3<!--4->5", "13<!--4->5");
}
@Test public void Apos__italic() {
fxt.Test__convert("<i>a</i>", "<i>a</i>");
}
@Test public void Lnki__caption() {
fxt.Test__convert("<a href=\"/wiki/A\">b</a>", "b");
}
@Test public void Lnki__caption__nest() {
fxt.Test__convert("<a href=\"/wiki/A\">b<i>c</i>d</a>", "b<i>c</i>d");
}
@Test public void Xnde__small() {
fxt.Test__convert("<small>a</small>", "a");
}
@Test public void Xnde__sup() {
fxt.Test__convert("<sup>a</sup>", "a");
}
@Test public void Xnde__nest__xnde() { // <sup> removed but not <small>
fxt.Test__convert("a <sup>b<small>c</small>d</sup> e", "a b<small>c</small>d e");
}
@Test public void Xnde__nest__lnki() { // <small> and <a> removed
fxt.Test__convert("<small><a href=\"/wiki/A\">b</a></small>", "b");
}
@Test public void Amp__ncr() {
fxt.Test__convert("&#91;a&#93;", "&#91;a&#93;");
}
@Test public void Italic() {
fxt.Test__convert("<i>a</i>", "<i>a</i>");
}
@Test public void Caption() {
fxt.Test__convert("<a href=\"/wiki/A\">b</a>", "b");
}
@Test public void Ref() { // PURPOSE: ref contents should not print in TOC; DATE:2013-07-23
fxt.Test__convert("a<sup id=\"cite_ref-0\" class=\"reference\"><a href=\"#cite_note-0\">[1]</a></sup>", "a");
}
@@ -69,12 +45,6 @@ public class Xoh_toc_wtr_tst {
( "<a href=\"/wiki/File:A.png\" class=\"image\" xowa_title=\"A.png\"><img id=\"xoimg_0\" alt=\"\" src=\"file:///mem/wiki/repo/trg/orig/7/0/A.png\" width=\"0\" height=\"0\" /></a> b"
, "b");
}
@Test public void Xnde__nest__inline() { // PURPOSE: do not render inline xndes; EX: Magnetic_resonance_imaging
fxt.Test__convert("a<span id='b'>b<br/></span>", "ab");
}
@Test public void Translate_w_comment() { // PURPOSE: <translate> is an xtn and parses its innerText separately; meanwhile, toc_mgr defaults to using the innerText to build toc; EX:Wikidata:Introduction; DATE:2013-07-16
fxt.Test__convert("<translate><!--b-->ac</translate>", "ac");
}
}
class Xoh_toc_wtr_fxt {
private final Xoh_toc_wtr wtr = new Xoh_toc_wtr();

View File

@@ -0,0 +1,34 @@
/*
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.htmls.tocs; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*;
import org.junit.*; import gplx.core.tests.*;
public class Xoh_toc_wtr__nest__tst {
@Before public void init() {fxt.Clear();} private final Xoh_toc_wtr_fxt fxt = new Xoh_toc_wtr_fxt();
@Test public void Xnde__xnde() { // <sup> removed but not <small>
fxt.Test__convert("a <sup>b<small>c</small>d</sup> e", "a b<small>c</small>d e");
}
@Test public void Xnde__inline() { // PURPOSE: do not render inline xndes; EX: Magnetic_resonance_imaging
fxt.Test__convert("a<span id='b'>b<br/></span>", "ab");
}
@Test public void Xnde__lnki() { // <small> and <a> removed
fxt.Test__convert("<small><a href=\"/wiki/A\">b</a></small>", "b");
}
@Test public void Lnki__xnde() {
fxt.Test__convert("<a href=\"/wiki/A\">b<i>c</i>d</a>", "b<i>c</i>d");
}
}

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.htmls.tocs; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*;
import org.junit.*; import gplx.core.tests.*;
public class Xoh_toc_wtr__skip__tst {
@Before public void init() {fxt.Clear();} private final Xoh_toc_wtr_fxt fxt = new Xoh_toc_wtr_fxt();
@Test public void Comment() {
fxt.Test__convert("<!--a-->", "");
}
@Test public void Comment__many() {
fxt.Test__convert("1<!--2-->3<!--4-->5", "135");
}
@Test public void Comment__dangling() {
fxt.Test__convert("1<!--2-->3<!--4->5", "13<!--4->5");
}
@Test public void Br() {
fxt.Test__convert("a<br/>b", "ab");
}
@Test public void H2() {
fxt.Test__convert("a<h2>b</h2>c", "ac");
}
@Test public void Li() {
fxt.Test__convert("a<ul><li>b</li></ul>c", "ac");
}
@Test public void Table() {
fxt.Test__convert("a<table><tr><td>b</td></tr></table>c", "ac");
}
@Test public void Xnde__small() {
fxt.Test__convert("<small>a</small>", "a");
}
@Test public void Xnde__sup() {
fxt.Test__convert("<sup>a</sup>", "a");
}
@Test public void Translate() { // PURPOSE: <translate> is an xtn and parses its innerText separately; meanwhile, toc_mgr defaults to using the innerText to build toc; EX:Wikidata:Introduction; DATE:2013-07-16
fxt.Test__convert("<translate><!--b-->ac</translate>", "ac");
}
}

View File

@@ -26,11 +26,19 @@ public class Xoa_wiki_mgr_ {
Io_url wiki_root_dir = url.OwnerDir();
Xow_wiki rv = wiki_mgr.Make(wiki_domain, wiki_root_dir);
wiki_mgr.Add(rv);
rv.Init_by_wiki(); // must init for Modified_latest
rv.Init_by_wiki(); // must init for Modified_latest
String wiki_date = rv.Props().Modified_latest__yyyy_MM_dd();
app.User().User_db_mgr().Site_mgr().Import(rv.Domain_str(), rv.Domain_str(), wiki_root_dir.Raw(), wiki_date, "");
conn.Rls_conn();
rv.Init_needed_y_(); // rls wiki else noop connection will hang around
if (app.Tid_is_edit()) {
// get_or_new wiki and mark it offline so it can show up in wikis sidebar
gplx.xowa.wikis.xwikis.Xow_xwiki_itm xwiki = app.User().Wikii().Xwiki_mgr().Get_by_key(wiki_domain);
if (xwiki == null)
xwiki = app.User().Wikii().Xwiki_mgr().Add_by_atrs(wiki_domain, wiki_domain);
xwiki.Offline_(true);
((Xoae_app)app).Gui_mgr().Html_mgr().Portal_mgr().Wikis().Itms_reset(); // dirty wiki list so that next refresh will load itm
}
rv.Rls(); // rls wiki, else open connections will cause later file copies to fail; DATE:2016-06-26
rv.Init_needed_y_(); // mark Init_needed_y_(), else wiki may have NOOP connection which will hang around on next release
return rv;
}
public static final String Invk__import_by_url = "import_by_url";

View File

@@ -106,6 +106,10 @@ public class Xowv_wiki implements Xow_wiki, Xow_ttl_parser, Gfo_invk {
data_mgr__core_mgr.Init_by_make(props, info_session);
html__hdump_mgr.Init_by_db(this);
}
public void Rls() {
data_mgr__core_mgr.Rls();
fsdb_mgr.Rls();
}
public void Pages_get(Xoh_page rv, Gfo_url url, Xoa_ttl ttl) {
if (init_needed) Init_by_wiki();
if (ttl.Ns().Id_is_special())

View File

@@ -20,8 +20,8 @@ import gplx.core.net.*; import gplx.xowa.htmls.hrefs.*;
import gplx.xowa.langs.*;
import gplx.xowa.wikis.domains.*; import gplx.xowa.wikis.xwikis.parsers.*; import gplx.xowa.wikis.xwikis.sitelinks.*;
public class Xow_xwiki_mgr {
private final Ordered_hash list = Ordered_hash_.New_bry(); private final Hash_adp_bry hash = Hash_adp_bry.ci_a7();
private final Xow_wiki wiki;
private final Ordered_hash list = Ordered_hash_.New_bry(); private final Hash_adp_bry hash = Hash_adp_bry.ci_a7();
private final Xow_wiki wiki;
public Xow_xwiki_mgr(Xow_wiki wiki) {
this.wiki = wiki;
this.xwiki_domain_tid = Xwiki_tid(wiki.Domain_tid());
@@ -88,5 +88,5 @@ public class Xow_xwiki_mgr {
return url.Segs__get_at_1st();
}
public static byte[] Bld_url_fmt(byte[] domain_bry) {return Bry_.Add(gplx.core.net.Gfo_protocol_itm.Itm_https.Text_bry(), domain_bry, Bry__url_fmt_end);}
private static final byte[] Bry__url_fmt_end = Bry_.new_a7("/wiki/~{0}");
private static final byte[] Bry__url_fmt_end = Bry_.new_a7("/wiki/~{0}");
}