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

@@ -22,7 +22,7 @@ public class Xow_page_cache {
public Xow_page_cache(Xowe_wiki wiki) {this.wiki = wiki;}
public byte[] Get_or_load_as_src(Xoa_ttl ttl) {
Xow_page_cache_itm rv = Get_or_load_as_itm(ttl);
return rv == null ? null : rv.Wtxt();
return rv == null ? null : rv.Wtxt__direct();
}
public Xow_page_cache_itm Get_or_load_as_itm(Xoa_ttl ttl) {
byte[] ttl_full_db = ttl.Full_db();

View File

@@ -17,11 +17,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.wikis.caches; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
public class Xow_page_cache_itm {
public Xow_page_cache_itm(Xoa_ttl ttl, byte[] wtxt, byte[] redirected_src_wtxt) {
this.ttl = ttl; this.wtxt = wtxt; this.redirected_src_wtxt = redirected_src_wtxt;
public Xow_page_cache_itm(Xoa_ttl ttl, byte[] wtxt__direct, byte[] wtxt__redirect) {
this.ttl = ttl; this.wtxt__direct = wtxt__direct; this.wtxt__redirect = wtxt__redirect;
}
public Xoa_ttl Ttl() {return ttl;} private Xoa_ttl ttl;
public byte[] Wtxt() {return wtxt;} private byte[] wtxt;
public byte[] Redirected_src_wtxt() {return redirected_src_wtxt;} private byte[] redirected_src_wtxt;
public static final Xow_page_cache_itm Null = null;
public byte[] Wtxt__direct() {return wtxt__direct;} private byte[] wtxt__direct;
public byte[] Wtxt__redirect() {return wtxt__redirect;} private byte[] wtxt__redirect;
public byte[] Wtxt__redirect_or_direct() {
return wtxt__redirect == null ? wtxt__direct : wtxt__redirect;
}
public static final Xow_page_cache_itm Null = null;
}

View File

@@ -24,7 +24,7 @@ public class Xowd_db_file_ {
, Tid_wiki_solo = 8, Tid_text_solo = 9
, Tid_html_solo = 10, Tid_html_data = 11
, Tid_file_solo = 12, Tid_file_core = 13, Tid_file_data = 14, Tid_file_user = 15
, Tid_search_link = 16
, Tid_search_link = 16, Tid_random = 17
;
private static final String
Key_core = "core", Key_text = "text", Key_cat = "xtn.category", Key_search_core = "xtn.search.core", Key_wbase = "core.wbase"
@@ -32,7 +32,7 @@ public class Xowd_db_file_ {
, Key_text_solo = "text.solo", Key_wiki_solo = "wiki.solo"
, Key_html_solo = "html.solo", Key_html_data = "html"
, Key_file_solo = "file.solo", Key_file_core = "file.core", Key_file_data = "file.data", Key_file_user = "file.user"
, Key_search_link = "xtn.search.link"
, Key_search_link = "xtn.search.link", Key_random = "xtn.random"
;
public static String To_key(byte v) {
switch (v) {
@@ -52,6 +52,7 @@ public class Xowd_db_file_ {
case Tid_file_data: return Key_file_data;
case Tid_file_user: return Key_file_user;
case Tid_search_link: return Key_search_link;
case Tid_random: return Key_random;
default: throw Err_.new_unhandled(v);
}
}

View File

@@ -63,6 +63,10 @@ public class Xowd_db_mgr {
Dbs__set_by_tid(rv);
return rv;
}
public Xowd_db_file Dbs__remake_by_tid(byte tid) {
Dbs__delete_by_tid(tid);
return Dbs__make_by_tid(tid);
}
public void Dbs__delete_by_tid(byte... tids) {
int len = dbs__ary_len;
for (int i = 0; i < len; ++i) {

View File

@@ -69,7 +69,7 @@ public class Xowd_page_tbl implements Rls_able {
this.Insert_cmd_by_batch(page_id, ns_id, ttl_wo_ns, page_is_redirect, modified_on, page_len, random_int, text_db_id, html_db_id);
this.Insert_end();
}
public void Insert_bgn() {conn.Txn_bgn("schema__page__insert"); stmt_insert = conn.Stmt_insert(tbl_name, flds);}
public void Insert_bgn() {conn.Txn_bgn("page__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_cmd_by_batch(int page_id, int ns_id, byte[] ttl_wo_ns, boolean page_is_redirect, DateAdp modified_on, int page_len, int random_int, int text_db_id, int html_db_id) {
stmt_insert.Clear()

View File

@@ -26,11 +26,11 @@ public class Xow_wiki_props implements GfoInvkAble {
siteinfo_mainpage = main_page; // note that main_page came from <siteinfo>; store old value for record's sake
main_page = Xow_mainpage_finder.Find_or(wiki, siteinfo_mainpage); // get new main_page from mainpage_finder
}
public byte Protocol_tid() {return protocol_tid;} private final byte protocol_tid = gplx.core.net.Gfo_protocol_itm.Tid_https; // NOTE: default protocol to https; handles external links like [//a.org]; may need to be changed for wikia or other non-WMF wikis; DATE:2015-07-27
public byte Protocol_tid() {return protocol_tid;} private final byte protocol_tid = gplx.core.net.Gfo_protocol_itm.Tid_https; // NOTE: default protocol to https; handles external links like [//a.org]; may need to be changed for wikia or other non-WMF wikis; DATE:2015-07-27
public byte[] Site_name() {return site_name;} private byte[] site_name = Bry_.Empty;
public byte[] ServerName() {return serverName;} public Xow_wiki_props ServerName_(byte[] v) {serverName = v; server = Bry_.Add(bry_http, v); return this;} private byte[] serverName = Bry_.new_a7("localhost");
public byte[] Server() {return server;} private byte[] server = Bry_.new_a7("http://localhost"); static final byte[] bry_http = Bry_.new_a7("http://");
public byte[] Server_name() {return server_name;} private byte[] server_name = Bry_.new_a7("localhost");
public byte[] Server() {return server;} private byte[] server = Bry_.new_a7("http://localhost");
public byte[] ArticlePath() {return articlePath;} public Xow_wiki_props ArticlePath_(byte[] v) {articlePath = v; return this;} private byte[] articlePath = Xoh_href_.Bry__wiki;
public byte[] ScriptPath() {return scriptPath;} public Xow_wiki_props ScriptPath_(byte[] v) {scriptPath = v; return this;} private byte[] scriptPath = Bry_.new_a7("/wiki");
public byte[] StylePath() {return stylePath;} public Xow_wiki_props StylePath_(byte[] v) {stylePath = v; return this;} private byte[] stylePath = Bry_.new_a7("/wiki/skins");
@@ -42,7 +42,12 @@ public class Xow_wiki_props implements GfoInvkAble {
public byte[] Siteinfo_misc() {return siteinfo_misc;}
public byte[] Siteinfo_mainpage() {return siteinfo_mainpage;} private byte[] siteinfo_mainpage = Bry_.Empty;
public DateAdp Modified_latest() {return modified_latest;} private DateAdp modified_latest;
public Xow_wiki_props SiteName_(int v) {site_name = Bry_.new_a7(String_.UpperFirst(String_.new_a7(Xow_domain_tid_.Get_type_as_bry(v)))); return this;}
public Xow_wiki_props Init_props(int domain_tid, byte[] domain_bry) {
this.site_name = Bry_.new_a7(String_.UpperFirst(String_.new_a7(Xow_domain_tid_.Get_type_as_bry(domain_tid)))); // EX: "Wikipedia"
this.server_name = domain_bry; // EX: "en.wikipedia.org"
this.server = Bry_.Add(gplx.core.net.Gfo_protocol_itm.Itm_https.Text_bry(), domain_bry); // EX: "https://en.wikipedia.org"
return this;
}
public Xow_wiki_props Siteinfo_misc_(byte[] v) {
siteinfo_misc = v;
int pipe_0 = Bry_find_.Find_fwd(v, Byte_ascii.Pipe);
@@ -73,5 +78,5 @@ public class Xow_wiki_props implements GfoInvkAble {
, Invk_css_version_ = "css_version_"
, Invk_modified_latest_ = "modified_latest_"
;
private static final byte[] Current_version_const = Bry_.new_a7("1.21wmf11"); // approximate level of compatibility
private static final byte[] Current_version_const = Bry_.new_a7("1.21wmf11"); // approximate level of compatibility
}

View File

@@ -60,20 +60,6 @@ public class Xopg_html_data {
public byte[] Custom_html() {return custom_html;} public Xopg_html_data Custom_html_(byte[] v) {custom_html = v; return this;} private byte[] custom_html;
public byte[] Custom_body() {return custom_body;} public Xopg_html_data Custom_body_(byte[] v) {custom_body = v; return this;} private byte[] custom_body;
public byte[] Custom_tab_name() {return custom_tab_name;} public Xopg_html_data Custom_tab_name_(byte[] v) {custom_tab_name = v; return this;} private byte[] custom_tab_name;
public byte[] Custom_head_end() {return custom_head_end;}
public byte[] Custom_html_end() {return custom_html_end;}
public void Custom_head_end_concat(byte[] v) {
if (v == null)
custom_head_end = v;
else
custom_head_end = Bry_.Add(custom_head_end, v);
} private byte[] custom_head_end;
public void Custom_html_end_concat(byte[] v) {
if (v == null)
custom_html_end = v;
else
custom_html_end = Bry_.Add(custom_html_end, v);
} private byte[] custom_html_end;
public void Clear() {
html_restricted = true;
display_ttl = content_sub = display_ttl_vnt = null;
@@ -88,7 +74,7 @@ public class Xopg_html_data {
xtn_scribunto_dbg = Bry_.Empty;
xtn_pgbnr = null;
module_mgr.Clear();
custom_html = custom_html_end = custom_head_end = custom_tab_name = null;
custom_html = custom_tab_name = null;
if (ctg_hash != null) ctg_hash.Clear();
indicators.Clear();
this.mode_wtxt_shown = false;

View File

@@ -19,15 +19,15 @@ package gplx.xowa.wikis.pages; import gplx.*; import gplx.xowa.*; import gplx.xo
import gplx.core.brys.*; import gplx.core.brys.fmtrs.*;
public class Xopg_page_heading implements Bfr_arg {
private Xopg_html_data html_data;
private Xoa_ttl page_ttl;
public Xopg_page_heading Init(Xoae_page page) {
this.html_data = page.Html_data();
this.page_ttl = page.Ttl();
private byte[] display_title;
public Xopg_page_heading Init(Xopg_html_data html_data, byte[] display_title) {
this.html_data = html_data;
this.display_title = display_title;
return this;
}
public void Bfr_arg__add(Bry_bfr bfr) {
if (html_data.Xtn_pgbnr() != null) return; // pgbnr exists; don't add title
fmtr.Bld_many(bfr, page_ttl.Page_txt());
fmtr.Bld_many(bfr, display_title);
}
private final Bry_fmt fmtr = Bry_fmt.New(Bry_.New_u8_nl_apos("<h1 id='firstHeading' class='firstHeading'><span>~{page_title}</span></h1>"), "page_title");
private final Bry_fmt fmtr = Bry_fmt.New(Bry_.New_u8_nl_apos("<h1 id='firstHeading' class='firstHeading'><span>~{page_title}</span></h1>"), "page_title");
}

View File

@@ -16,18 +16,19 @@ 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.pages; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
import gplx.langs.htmls.*;
public class Xopg_tag_itm {
public Xopg_tag_itm(String name, String text, Keyval... atrs_ary) {
public Xopg_tag_itm(byte[] name, byte[] text, Keyval... atrs_ary) {
this.Name = name;
this.Text = text;
this.Atrs_ary = atrs_ary;
}
public final String Name;
public final String Text;
public final byte[] Name;
public final byte[] Text;
public final Keyval[] Atrs_ary;
public void To_html(Bry_bfr bfr) {
bfr.Add_byte(Byte_ascii.Angle_bgn);
bfr.Add_str_a7(Name);
bfr.Add(Name);
int len = Atrs_ary.length;
for (int i = 0; i < len; ++i) {
bfr.Add_byte_space();
@@ -39,20 +40,27 @@ public class Xopg_tag_itm {
bfr.Add_byte(Byte_ascii.Quote);
}
bfr.Add_byte(Byte_ascii.Angle_end);
if (String_.Eq(Name, "link")) return;
if (Text != null) bfr.Add_str_u8(Text);
if (Bry_.Eq(Name, Gfh_tag_.Bry__link)) return;
if (Text != null) {
bfr.Add_byte_nl();
bfr.Add(Text);
bfr.Add_byte_nl();
}
bfr.Add_byte(Byte_ascii.Angle_bgn).Add_byte(Byte_ascii.Slash);
bfr.Add_str_a7(Name);
bfr.Add(Name);
bfr.Add_byte(Byte_ascii.Angle_end);
}
public static Xopg_tag_itm New_css(Io_url href) {
return new Xopg_tag_itm("link" , null, Keyval_.new_("type", "text/css"), Keyval_.new_("rel", "stylesheet"), Keyval_.new_("href", href.To_http_file_str()));
public static Xopg_tag_itm New_css_file(Io_url href) {
return new Xopg_tag_itm(Gfh_tag_.Bry__link , null, Keyval_.new_("type", "text/css"), Keyval_.new_("rel", "stylesheet"), Keyval_.new_("href", href.To_http_file_str()));
}
public static Xopg_tag_itm New_script_file(Io_url src) {
return new Xopg_tag_itm("script", null, Keyval_.new_("type", "text/javascript"), Keyval_.new_("src", src.To_http_file_str()));
public static Xopg_tag_itm New_css_code(byte[] code) {
return new Xopg_tag_itm(Gfh_tag_.Bry__style , code, Keyval_.new_("type", "text/css"));
}
public static Xopg_tag_itm New_script_code(String code) {
return new Xopg_tag_itm("script", code, Keyval_.new_("type", "text/javascript"));
public static Xopg_tag_itm New_js_file(Io_url src) {
return new Xopg_tag_itm(Gfh_tag_.Bry__script , null, Keyval_.new_("type", "text/javascript"), Keyval_.new_("src", src.To_http_file_str()));
}
public static Xopg_tag_itm New_js_code(byte[] code) {
return new Xopg_tag_itm(Gfh_tag_.Bry__script , code, Keyval_.new_("type", "text/javascript"));
}
}

View File

@@ -35,4 +35,17 @@ public class Xopg_tag_mgr {
}
return bfr.To_bry_and_clear();
}
public byte[] To_html__style(Bry_bfr bfr) {
int len = this.Len();
for (int i = 0; i < len; ++i) {
Xopg_tag_itm tag = this.Get_at(i);
if ( Bry_.Eq(tag.Name, gplx.langs.htmls.Gfh_tag_.Bry__style)
&& tag.Text != null
) {
tag.To_html(bfr);
bfr.Add_byte_nl();
}
}
return bfr.To_bry_and_clear();
}
}