1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2024-10-27 20:34:16 +00:00

Embeddable: Fix if_exists test

This commit is contained in:
gnosygnu 2016-11-24 19:26:35 -05:00
parent 81dc7ea4ea
commit dd8cff9838
2 changed files with 6 additions and 5 deletions

View File

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

View File

@ -38,7 +38,7 @@ public class Pfunc_ifexist_mgr {
boolean rv = false; boolean rv = false;
switch (ttl_ns.Id()) { switch (ttl_ns.Id()) {
case Xow_ns_.Tid__special: rv = true; break; // NOTE: some pages call for [[Special]]; always return true for now; DATE:2014-07-17 case Xow_ns_.Tid__special: rv = true; break; // NOTE: some pages call for [[Special]]; always return true for now; DATE:2014-07-17
case Xow_ns_.Tid__media: rv = Find_ttl_for_media_ns(cache_itm, wiki, ttl, ttl_ns, ttl_bry); break; case Xow_ns_.Tid__media: rv = Find_ttl_for_media_ns(cache_itm, wiki, ttl_ns, ttl_bry); break;
default: rv = Find_ttl_in_db(cache_itm, wiki, ttl, ttl_ns, ttl_bry); break; default: rv = Find_ttl_in_db(cache_itm, wiki, ttl, ttl_ns, ttl_bry); break;
} }
cache_itm.Exists_(rv); cache_itm.Exists_(rv);
@ -55,9 +55,10 @@ public class Pfunc_ifexist_mgr {
itm.Exists_(rv); itm.Exists_(rv);
return rv; return rv;
} }
private boolean Find_ttl_for_media_ns(Pfunc_ifexist_itm itm, Xowe_wiki wiki, Xoa_ttl ttl, Xow_ns ns, byte[] ttl_bry) { private boolean Find_ttl_for_media_ns(Pfunc_ifexist_itm itm, Xowe_wiki wiki, Xow_ns ns, byte[] ttl_bry) {
Xow_ns file_ns = wiki.Ns_mgr().Ns_file(); Xow_ns file_ns = wiki.Ns_mgr().Ns_file();
boolean rv = Find_ttl_in_db(itm, wiki, ttl, file_ns, ttl_bry); if (rv) return true; // rarely true, but check local wiki's [[File:]] table anyway Xoa_ttl file_ttl = wiki.Ttl_parse(file_ns.Id(), ttl_bry);
boolean rv = Find_ttl_in_db(itm, wiki, file_ttl, file_ns, ttl_bry); if (rv) return true; // rarely true, but check local wiki's [[File:]] table anyway
Xowe_wiki commons_wiki = wiki.Appe().Wiki_mgr().Wiki_commons(); Xowe_wiki commons_wiki = wiki.Appe().Wiki_mgr().Wiki_commons();
boolean env_is_testing = Env_.Mode_testing(); boolean env_is_testing = Env_.Mode_testing();
if ( commons_wiki != null // null check if ( commons_wiki != null // null check
@ -66,7 +67,7 @@ public class Pfunc_ifexist_mgr {
) )
) { ) {
file_ns = commons_wiki.Ns_mgr().Ns_file(); file_ns = commons_wiki.Ns_mgr().Ns_file();
return Find_ttl_in_db(itm, commons_wiki, ttl, file_ns, ttl_bry); // accurate test using page table in commons wiki (provided commons is up to date) return Find_ttl_in_db(itm, commons_wiki, file_ttl, file_ns, ttl_bry); // accurate test using page table in commons wiki (provided commons is up to date)
} }
else { else {
if (!env_is_testing) if (!env_is_testing)