mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.9.3.1
This commit is contained in:
@@ -17,6 +17,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.wikis.data; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
|
||||
import gplx.lists.*; /*ComparerAble*/ import gplx.xowa.bldrs.cmds.ctgs.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.langs.vnts.*;
|
||||
import gplx.xowa.nss.*;
|
||||
import gplx.xowa.gui.views.*;
|
||||
import gplx.xowa.dbs.*; import gplx.xowa.wikis.*; import gplx.xowa.langs.msgs.*;
|
||||
import gplx.xowa.parsers.utils.*;
|
||||
import gplx.xowa.wikis.data.tbls.*;
|
||||
@@ -80,6 +83,52 @@ public class Xow_data_mgr implements GfoInvkAble {
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
public Xoae_page Load_page_by_ttl(Xoa_url url, Xoa_ttl ttl) {return Load_page_by_ttl(url, ttl, wiki.Lang(), wiki.Appe().Gui_mgr().Browser_win().Active_tab(), true);}
|
||||
public Xoae_page Load_page_by_ttl(Xoa_url url, Xoa_ttl ttl, Xog_tab_itm tab) {return Load_page_by_ttl(url, ttl, wiki.Lang(), tab, true);}
|
||||
public Xoae_page Load_page_by_ttl(Xoa_url url, Xoa_ttl ttl, Xol_lang lang, Xog_tab_itm tab, boolean parse_page) {
|
||||
wiki.Init_assert();
|
||||
Xoae_page page = Xoae_page.new_(wiki, ttl); page.Tab_data().Tab_(tab);
|
||||
this.Get_page(page, url, ttl, false, false); // get page from data_mgr
|
||||
if (page.Missing()) { // page doesn't exist
|
||||
boolean vnt_missing = true;
|
||||
Xol_vnt_mgr vnt_mgr = lang.Vnt_mgr();
|
||||
if (vnt_mgr.Enabled()) { // if vnt enabled, then try to load by vnt form; DATE:2015-09-15
|
||||
gplx.xowa.wikis.data.tbls.Xowd_page_itm page_itm = vnt_mgr.Convert_mgr().Convert_ttl(wiki, ttl);
|
||||
if (page_itm.Exists()) {
|
||||
Xoa_ttl vnt_ttl = Xoa_ttl.parse(wiki, ttl.Ns().Id(), page_itm.Ttl_page_db());
|
||||
page = this.Get_page(vnt_ttl, false);
|
||||
vnt_missing = page.Missing();
|
||||
}
|
||||
}
|
||||
if (vnt_missing) {
|
||||
if (ttl.Ns().Id_file()) {
|
||||
Xowe_wiki commons_wiki = wiki.Appe().Wiki_mgr().Get_by_key_or_null(wiki.Commons_wiki_key());
|
||||
if (commons_wiki != null) { // commons exists
|
||||
if (!Bry_.Eq(wiki.Domain_bry(), commons_wiki.Domain_bry())) { // !Bry_.Eq is recursion guard
|
||||
Xoae_page rv = commons_wiki.Data_mgr().Load_page_by_ttl(url, ttl, wiki.Lang(), tab, true);
|
||||
if (rv.Exists()) {
|
||||
rv.Commons_mgr().Source_wiki_(wiki);
|
||||
return rv;
|
||||
}
|
||||
else {
|
||||
page.Missing_(false);
|
||||
page.Commons_mgr().Xowa_mockup_(true);
|
||||
return page;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
return page.Missing_();
|
||||
}
|
||||
}
|
||||
if (page.Missing()) return page; // NOTE: commons can return null page
|
||||
page.Tab_data().Tab_(tab);
|
||||
page.Lang_(lang);
|
||||
if (parse_page)
|
||||
wiki.Parser_mgr().Parse(page, false); // NOTE: do not clear page b/c reused for search
|
||||
return page;
|
||||
}
|
||||
public Xoae_page Redirect(Xoae_page page, byte[] page_bry) {
|
||||
Xoa_ttl trg_ttl = Xoa_ttl.parse(wiki, page_bry);
|
||||
Xoa_url trg_url = Xoa_url.new_(wiki.Domain_bry(), page_bry);
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.wikis.data; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
|
||||
import org.junit.*; import gplx.xowa.tdbs.*;
|
||||
import gplx.xowa.nss.*;
|
||||
public class Xow_data_mgr_tst {
|
||||
Xow_data_mgr_fxt fxt = new Xow_data_mgr_fxt();
|
||||
@Before public void init() {fxt.Clear(); Tfds.Now_enabled_y_();}
|
||||
|
||||
@@ -92,6 +92,10 @@ public class Xowd_db_mgr {
|
||||
props.Cfg_save(db__core.Tbl__cfg()); // NOTE: must save cfg now, especially zip_tid; latter will be reloaded after import is done;
|
||||
conn.Txn_end();
|
||||
}
|
||||
public void Create_page(Xowd_page_tbl core_tbl, Xowd_text_tbl text_tbl, int page_id, int ns_id, byte[] ttl_wo_ns, boolean redirect, DateAdp modified_on, byte[] text_zip_data, int text_raw_len, int random_int, int text_db_id, int html_db_id) {
|
||||
core_tbl.Insert_cmd_by_batch(page_id, ns_id, ttl_wo_ns, redirect, modified_on, text_raw_len, random_int, text_db_id, html_db_id);
|
||||
text_tbl.Insert_cmd_by_batch(page_id, text_zip_data);
|
||||
}
|
||||
private void Dbs__set_by_tid(Xowd_db_file db) {
|
||||
switch (db.Tid()) {
|
||||
case Xowd_db_file_.Tid_wiki_solo:
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.wikis.data.tbls; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.data.*;
|
||||
import gplx.core.primitives.*;
|
||||
import gplx.xowa.nss.*;
|
||||
public class Xowd_page_itm {
|
||||
public Xowd_page_itm() {this.Clear();}
|
||||
public int Id() {return id;} public Xowd_page_itm Id_(int v) {id = v; id_val = null; return this;} private int id;
|
||||
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.wikis.data.tbls; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.data.*;
|
||||
import org.junit.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
import org.junit.*; import gplx.xowa.wikis.data.tbls.*; import gplx.xowa.nss.*;
|
||||
public class Xowd_page_itm_tst {
|
||||
@Before public void init() {fxt.Init();} private Xowd_page_itm_fxt fxt = new Xowd_page_itm_fxt();
|
||||
@Test public void Ttl_() {
|
||||
|
||||
@@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.wikis.data.tbls; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.data.*;
|
||||
import gplx.core.primitives.*; import gplx.core.criterias.*;
|
||||
import gplx.dbs.*; import gplx.xowa.*; import gplx.xowa.dbs.*; import gplx.dbs.qrys.*;
|
||||
import gplx.xowa.nss.*;
|
||||
public class Xowd_page_tbl implements RlsAble {
|
||||
private final String tbl_name = "page";
|
||||
private String fld_id, fld_ns, fld_title, fld_is_redirect, fld_touched, fld_len, fld_random_int, fld_text_db_id, fld_html_db_id, fld_redirect_id;
|
||||
@@ -179,7 +180,7 @@ public class Xowd_page_tbl implements RlsAble {
|
||||
}
|
||||
public void Select_for_search_suggest(Cancelable cancelable, List_adp rslt_list, Xow_ns ns, byte[] key, int max_results, int min_page_len, int browse_len, boolean include_redirects, boolean fetch_prv_item) {
|
||||
String search_bgn = String_.new_u8(key);
|
||||
String search_end = String_.new_u8(gplx.intl.Utf8_.Increment_char_at_last_pos(key));
|
||||
String search_end = String_.new_u8(gplx.core.intls.Utf8_.Increment_char_at_last_pos(key));
|
||||
String sql = String_.Format
|
||||
( "SELECT {0}, {1}, {2}, {3} FROM {4} INDEXED BY {4}__title WHERE {1} = {5} AND {2} BETWEEN '{6}' AND '{7}' ORDER BY {3} DESC LIMIT {8};"
|
||||
, fld_id, fld_ns, fld_title, fld_len
|
||||
|
||||
@@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.wikis.data.tbls; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.data.*;
|
||||
import gplx.core.criterias.*;
|
||||
import gplx.dbs.*; import gplx.dbs.utls.*;
|
||||
import gplx.xowa.nss.*;
|
||||
class Xowd_page_tbl__ttl_ns extends Xowd_page_tbl__in_wkr__base {
|
||||
private Xow_ns_mgr ns_mgr; private Ordered_hash hash;
|
||||
@Override protected int Interval() {return 64;} // NOTE: 96+ overflows; PAGE:en.w:Space_Liability_Convention; DATE:2013-10-24
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.wikis.data.tbls; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.data.*;
|
||||
import gplx.dbs.*; import gplx.dbs.qrys.*;
|
||||
import gplx.xowa.nss.*;
|
||||
public class Xowd_site_ns_tbl {
|
||||
private final String tbl_name; private final Db_meta_fld_list flds = Db_meta_fld_list.new_();
|
||||
private final String fld_id, fld_name, fld_case, fld_count, fld_is_alias;
|
||||
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.wikis.data.tbls; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.data.*;
|
||||
import gplx.dbs.*;
|
||||
import gplx.dbs.*; import gplx.xowa.wikis.metas.*;
|
||||
public class Xowd_site_stats_tbl {
|
||||
private final String tbl_name = "site_stats";
|
||||
private final String fld_row_id, fld_good_articles, fld_total_pages, fld_images;
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.wikis.data.tbls; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.data.*;
|
||||
import org.junit.*; import gplx.dbs.*;
|
||||
import gplx.xowa.nss.*;
|
||||
public class Xowd_wbase_qid_tbl_tst {
|
||||
private final Xowd_wbase_qid_tbl_fxt fxt = new Xowd_wbase_qid_tbl_fxt();
|
||||
@Before public void init() {fxt.Clear();}
|
||||
|
||||
Reference in New Issue
Block a user