mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.11.1.1
This commit is contained in:
@@ -20,7 +20,7 @@ import gplx.core.net.*;
|
||||
public class Xowm_api_mgr {
|
||||
public static byte[] Call_by_qarg(Gfo_usr_dlg usr_dlg, Gfo_inet_conn inet_conn, String domain_str, String api_args) {return Call_by_url(usr_dlg, inet_conn, domain_str, Bld_api_url(domain_str, api_args));}
|
||||
public static byte[] Call_by_url (Gfo_usr_dlg usr_dlg, Gfo_inet_conn inet_conn, String domain_str, String url) {
|
||||
if (!gplx.ios.IoEngine_system.Web_access_enabled) return null;
|
||||
if (!gplx.core.ios.IoEngine_system.Web_access_enabled) return null;
|
||||
usr_dlg.Prog_many("", "", "wm.api:calling; wiki=~{0} api=~{1}", domain_str, url);
|
||||
byte[] rslt = inet_conn.Download_as_bytes_or_null(url); if (rslt == null) usr_dlg.Warn_many("", "", "wm.api:wmf api returned nothing; api=~{0}", url);
|
||||
return rslt;
|
||||
|
||||
@@ -16,10 +16,10 @@ 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.bldrs.wms.apis; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.wms.*;
|
||||
import gplx.ios.*; import gplx.xowa.files.repos.*; import gplx.xowa.files.downloads.*;
|
||||
import gplx.core.ios.*; import gplx.xowa.files.repos.*; import gplx.xowa.files.downloads.*;
|
||||
public abstract class Xoapi_orig_base {
|
||||
public boolean Api_query_size(Xoapi_orig_rslts rv, Xof_download_wkr download_wkr, Xow_repo_mgr repo_mgr, byte[] ttl, int width, int height) {
|
||||
if (!gplx.ios.IoEngine_system.Web_access_enabled) return false; // don't check api if download disabled else "download_failed" messages in log (particularly during pkg_make) DATE:2015-02-12
|
||||
if (!gplx.core.ios.IoEngine_system.Web_access_enabled) return false; // don't check api if download disabled else "download_failed" messages in log (particularly during pkg_make) DATE:2015-02-12
|
||||
Gfo_usr_dlg usr_dlg = Gfo_usr_dlg_.Instance;
|
||||
Xof_repo_pair[] repos = repo_mgr.Repos_ary();
|
||||
int len = repos.length;
|
||||
|
||||
@@ -33,7 +33,7 @@ public class Xoapi_orig_wmf extends Xoapi_orig_base {
|
||||
int xml_len = xml.length;
|
||||
int pos = 0;
|
||||
pos = Bry_find_.Find_fwd(xml, Bry_xml_ii , pos, xml_len);
|
||||
if (pos == Bry_.NotFound) {usr_dlg.Log_many(GRP_KEY, "api_failed", "api failed: ~{0}", String_.new_u8(xml)); return false;}
|
||||
if (pos == Bry_find_.Not_found) {usr_dlg.Log_many(GRP_KEY, "api_failed", "api failed: ~{0}", String_.new_u8(xml)); return false;}
|
||||
pos += Bry_xml_ii.length;
|
||||
|
||||
byte[] orig_wiki = null, orig_page = null; int orig_w = 0, orig_h = 0;
|
||||
@@ -48,7 +48,7 @@ public class Xoapi_orig_wmf extends Xoapi_orig_base {
|
||||
orig_wiki = gplx.xowa.wikis.xwikis.Xow_xwiki_mgr.Get_domain_from_url(url_parser, url, file_url);
|
||||
byte[] page = Xoa_ttl.Replace_spaces(url.Segs__get_at_nth());
|
||||
int colon_pos = Bry_find_.Find_fwd(page, Byte_ascii.Colon, 0, page.length);
|
||||
if (colon_pos != Bry_.NotFound)
|
||||
if (colon_pos != Bry_find_.Not_found)
|
||||
page = Bry_.Mid(page, colon_pos + 1, page.length);
|
||||
orig_page = page;
|
||||
}
|
||||
@@ -60,9 +60,9 @@ public class Xoapi_orig_wmf extends Xoapi_orig_base {
|
||||
private static Gfo_url_parser url_parser = new Gfo_url_parser(); private static Gfo_url url = new Gfo_url();
|
||||
private static boolean Parse_xml_val(Int_2_ref rv, Gfo_usr_dlg usr_dlg, byte[] xml, int xml_len, int pos, byte[] key) {
|
||||
int bgn = 0, end = 0;
|
||||
bgn = Bry_find_.Find_fwd(xml, key, pos, xml_len); if (bgn == Bry_.NotFound) return false;
|
||||
bgn = Bry_find_.Find_fwd(xml, key, pos, xml_len); if (bgn == Bry_find_.Not_found) return false;
|
||||
bgn += key.length;
|
||||
end = Bry_find_.Find_fwd(xml, Byte_ascii.Quote , bgn, xml_len); if (end == Bry_.NotFound) return false;
|
||||
end = Bry_find_.Find_fwd(xml, Byte_ascii.Quote , bgn, xml_len); if (end == Bry_find_.Not_found) return false;
|
||||
rv.Val_all_(bgn, end);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -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.bldrs.wms.dumps; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.wms.*;
|
||||
import gplx.ios.*;
|
||||
import gplx.core.ios.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
public class Xowm_dump_file {
|
||||
public Xowm_dump_file(String domain_str, String dump_date, String dump_type_str) {
|
||||
|
||||
@@ -20,8 +20,8 @@ import gplx.xowa.wikis.domains.*; import gplx.xowa.bldrs.installs.*;
|
||||
public class Xowm_dump_file_ {
|
||||
public static Xowm_dump_file parse(byte[] src) {
|
||||
int src_len = src.length;
|
||||
int dash_0 = Bry_find_.Find_fwd(src, Byte_ascii.Dash, 0 , src_len); if (dash_0 == Bry_.NotFound) throw Err_.new_parse_type(Xowm_dump_file.class, String_.new_u8(src));
|
||||
int dash_1 = Bry_find_.Find_fwd(src, Byte_ascii.Dash, dash_0 + 1 , src_len); if (dash_1 == Bry_.NotFound) throw Err_.new_parse_type(Xowm_dump_file.class, String_.new_u8(src));
|
||||
int dash_0 = Bry_find_.Find_fwd(src, Byte_ascii.Dash, 0 , src_len); if (dash_0 == Bry_find_.Not_found) throw Err_.new_parse_type(Xowm_dump_file.class, String_.new_u8(src));
|
||||
int dash_1 = Bry_find_.Find_fwd(src, Byte_ascii.Dash, dash_0 + 1 , src_len); if (dash_1 == Bry_find_.Not_found) throw Err_.new_parse_type(Xowm_dump_file.class, String_.new_u8(src));
|
||||
byte[] domain_bry = Xow_abrv_wm_.Parse_to_domain_bry(Bry_.Mid(src, 0, dash_0));
|
||||
return new Xowm_dump_file(String_.new_u8(domain_bry), String_.new_u8(src, dash_0 + 1, dash_1), String_.new_u8(src, dash_1 + 1, src_len));
|
||||
}
|
||||
@@ -45,7 +45,7 @@ public class Xowm_dump_file_ {
|
||||
Xoa_app_.Usr_dlg().Note_many("", "", "wmf.dump:dump date; server_url=~{0} dump_date=~{1}", dump_server, dump_date);
|
||||
Xoi_mirror_parser mirror_parser = new Xoi_mirror_parser();
|
||||
String dump_wiki_url = dump_server + String_.new_a7(rv.Dump_abrv()) + "/";
|
||||
byte[] dump_url_wiki_html = gplx.ios.IoEngine_xrg_downloadFil.new_("", Io_url_.Empty).Exec_as_bry(dump_wiki_url); if (Bry_.Len_eq_0(dump_url_wiki_html)) return;
|
||||
byte[] dump_url_wiki_html = gplx.core.ios.IoEngine_xrg_downloadFil.new_("", Io_url_.Empty).Exec_as_bry(dump_wiki_url); if (Bry_.Len_eq_0(dump_url_wiki_html)) return;
|
||||
String[] dump_available_dates = mirror_parser.Parse(String_.new_u8(dump_url_wiki_html));
|
||||
String dump_dates_latest = Xoi_mirror_parser.Find_last_lte(dump_available_dates, dump_date);
|
||||
if (String_.Eq(dump_dates_latest, "")) return; // nothing found
|
||||
|
||||
@@ -129,7 +129,7 @@ public class Site_core_db {
|
||||
int len = hash.Count();
|
||||
for (int i = 0; i < len; ++i) {
|
||||
Site_namespace_itm itm = (Site_namespace_itm)hash.Get_at(i);
|
||||
byte case_match = Xow_ns_case_.parse(String_.new_u8(itm.Case_tid()));
|
||||
byte case_match = Xow_ns_case_.To_tid(String_.new_u8(itm.Case_tid()));
|
||||
rv.Add_new(itm.Id(), itm.Localized(), case_match, Bool_.N);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user