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

'v3.4.2.1'

This commit is contained in:
gnosygnu
2016-04-11 00:12:19 -04:00
parent b2a06b8125
commit 14471ca656
197 changed files with 1918 additions and 1275 deletions

View File

@@ -40,7 +40,7 @@ public class Xow_data_mgr implements GfoInvkAble {
Xow_ns ns = ttl.Ns();
switch (ns.Id()) {
case Xow_ns_.Tid__special:
wiki.Special_mgr().Special_gen(wiki, rv, url, ttl);
wiki.Special_mgr().Special__gen(wiki.App(), wiki, rv, url, ttl);
return rv;
case Xow_ns_.Tid__mediawiki:
if ( !called_from_msg // if called from msg, fall through to actual data retrieval below, else infinite loop; DATE:2014-05-09

View File

@@ -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.wikis.data; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
import gplx.dbs.*; import gplx.dbs.cfgs.*;
public class Xowd_cfg_tbl_ {
public static final String Tbl_name = "xowa_cfg";
public static Db_cfg_tbl New(gplx.dbs.Db_conn conn) {
return new Db_cfg_tbl(conn, Tbl_name);
}
public static Db_cfg_tbl Get_or_null(gplx.dbs.Db_conn conn) {
return conn.Meta_tbl_exists(Tbl_name) ? new Db_cfg_tbl(conn, Tbl_name) : null;
}
}

View File

@@ -26,15 +26,15 @@ public class Xowd_core_db_props {
this.zip_tid_text = zip_tid_text; this.zip_tid_html = zip_tid_html;
this.hzip_enabled = hzip_enabled; this.hzip_mode_is_b256 = hzip_mode_is_b256;
}
public int Schema() {return schema;} private final int schema;
public int Schema() {return schema;} private final int schema;
public boolean Schema_is_1() {return schema == 1;}
public Xowd_db_layout Layout_text() {return layout_text;} private final Xowd_db_layout layout_text;
public Xowd_db_layout Layout_html() {return layout_html;} private final Xowd_db_layout layout_html;
public Xowd_db_layout Layout_file() {return layout_file;} private final Xowd_db_layout layout_file;
public byte Zip_tid_text() {return zip_tid_text;} private final byte zip_tid_text;
public byte Zip_tid_html() {return zip_tid_html;} private final byte zip_tid_html;
public boolean Hzip_enabled() {return hzip_enabled;} private final boolean hzip_enabled;
public boolean Hzip_mode_is_b256() {return hzip_mode_is_b256;} private final boolean hzip_mode_is_b256;
public Xowd_db_layout Layout_text() {return layout_text;} private final Xowd_db_layout layout_text;
public Xowd_db_layout Layout_html() {return layout_html;} private final Xowd_db_layout layout_html;
public Xowd_db_layout Layout_file() {return layout_file;} private final Xowd_db_layout layout_file;
public byte Zip_tid_text() {return zip_tid_text;} private final byte zip_tid_text;
public byte Zip_tid_html() {return zip_tid_html;} private final byte zip_tid_html;
public boolean Hzip_enabled() {return hzip_enabled;} private final boolean hzip_enabled;
public boolean Hzip_mode_is_b256() {return hzip_mode_is_b256;} private final boolean hzip_mode_is_b256;
public void Cfg_save(Db_cfg_tbl tbl) {
tbl.Conn().Txn_bgn("make__core__cfg__save");
tbl.Insert_int (Cfg_grp, Cfg_key__schema_version , schema);
@@ -48,7 +48,7 @@ public class Xowd_core_db_props {
tbl.Conn().Txn_end();
}
public static Xowd_core_db_props Cfg_load(Io_url url, Db_conn conn) {
Db_cfg_tbl cfg_tbl = new Db_cfg_tbl(conn, "xowa_cfg");
Db_cfg_tbl cfg_tbl = gplx.xowa.wikis.data.Xowd_cfg_tbl_.New(conn);
return cfg_tbl.Select_int_or(Cfg_grp, Cfg_key__schema_version, 1) == 1
? new Xowd_core_db_props
( 1, Xowd_db_layout.Itm_lot, Xowd_db_layout.Itm_lot, Xowd_db_layout.Itm_lot, cfg_tbl.Select_byte_or(Xowe_wiki.Invk_db_mgr, Xodb_mgr_sql.Invk_data_storage_format
@@ -78,5 +78,5 @@ public class Xowd_core_db_props {
, Cfg_key__hzip_enabled = "hzip_enabled"
, Cfg_key__hzip_mode_is_b256 = "hzip_mode_is_b256"
;
public static final Xowd_core_db_props Test = new Xowd_core_db_props(2, Xowd_db_layout.Itm_few, Xowd_db_layout.Itm_few, Xowd_db_layout.Itm_few, Io_stream_.Tid_raw, Io_stream_.Tid_raw, Bool_.Y, Bool_.Y);
public static final Xowd_core_db_props Test = new Xowd_core_db_props(2, Xowd_db_layout.Itm_few, Xowd_db_layout.Itm_few, Xowd_db_layout.Itm_few, Io_stream_.Tid_raw, Io_stream_.Tid_raw, Bool_.Y, Bool_.Y);
}

View File

@@ -76,7 +76,7 @@ public class Xowd_db_file {
public static Xowd_db_file make_(Xob_info_session info_session, Xowd_core_db_props props, int id, byte tid, Io_url url, String ns_ids, int part_id, String core_file_name, Db_conn conn) {
Guid_adp guid = Guid_adp_.new_();
Xob_info_file info_file = new Xob_info_file(id, Xowd_db_file_.To_key(tid), ns_ids, part_id, guid, props.Schema(), core_file_name, url.NameAndExt());
Db_cfg_tbl cfg_tbl = new Db_cfg_tbl(conn, "xowa_cfg");
Db_cfg_tbl cfg_tbl = gplx.xowa.wikis.data.Xowd_cfg_tbl_.New(conn);
Xowd_db_file rv = new Xowd_db_file(cfg_tbl, info_session, info_file, props, Xowd_db_file_schema_props.make_(), id, tid, url, ns_ids, part_id, guid, conn, Db_cmd_mode.Tid_create);
cfg_tbl.Create_tbl(); // always create cfg in each db
return rv;
@@ -87,7 +87,7 @@ public class Xowd_db_file {
Xoa_app_.Usr_dlg().Warn_many("", "", "wiki.db:missing db; tid=~{0} url=~{1}", Xowd_db_file_.To_key(tid), url.Raw());
conn = Db_conn_.Noop;
}
Db_cfg_tbl cfg_tbl = new Db_cfg_tbl(conn, "xowa_cfg"); // NOTE: this loads the cfg tbl for the current db, not the core db
Db_cfg_tbl cfg_tbl = gplx.xowa.wikis.data.Xowd_cfg_tbl_.New(conn); // NOTE: this loads the cfg tbl for the current db, not the core db
Xob_info_session info_session = Xob_info_session.Load(cfg_tbl);
Xob_info_file info_file = Xob_info_file.Load(cfg_tbl);
return new Xowd_db_file(cfg_tbl, info_session, info_file, props, Xowd_db_file_schema_props.load_(cfg_tbl, tid, info_session.Version()), id, tid, url, ns_ids, part_id, guid, conn, Db_cmd_mode.Tid_ignore);

View File

@@ -159,6 +159,17 @@ public class Xowd_db_mgr {
default: throw Err_.new_unimplemented();
}
}
public static boolean Maybe_core(String domain_name, String fil_name) {
Xow_domain_itm domain_itm = Xow_domain_itm_.parse(Bry_.new_u8(domain_name));
if (domain_itm.Domain_type_id() == Xow_domain_tid_.Int__other) {
return String_.Has_at_end(fil_name, ".xowa");
}
String domain_str = domain_itm.Domain_str();
return ( String_.Eq(fil_name, domain_str + "-text.xowa")
|| String_.Eq(fil_name, domain_str + "-core.xowa")
|| String_.Eq(fil_name, domain_str + ".xowa")
);
}
private static byte Core_db_tid(Xowd_db_layout layout) {
switch (layout.Tid()) {
case Xowd_db_layout.Const_all: return Xowd_db_file_.Tid_wiki_solo;

View File

@@ -269,7 +269,7 @@ public class Xowd_page_tbl implements Rls_able {
}
public void Read_page__all(Xowd_page_itm page, Db_rdr rdr) {
int html_db_id = rdr.Read_int(fld_html_db_id);
int redirected_id = rdr.Read_int(fld_html_db_id);
int redirected_id = rdr.Read_int(fld_redirect_id);
int page_len = rdr.Read_int(fld_len);
int page_score = page_len;
if (fld_score != Dbmeta_fld_itm.Key_null)
@@ -329,5 +329,5 @@ public class Xowd_page_tbl implements Rls_able {
stmt_select_id_by_ttl = Db_stmt_.Rls(stmt_select_id_by_ttl);
stmt_insert = Db_stmt_.Rls(stmt_insert);
}
private static final String Page_touched_fmt = "yyyyMMddHHmmss";
public static final String Page_touched_fmt = "yyyyMMddHHmmss";
}