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

v1.10.1.1

This commit is contained in:
gnosygnu
2014-10-05 21:38:11 -04:00
parent 81c8e2554c
commit cd5a440404
111 changed files with 3365 additions and 1298 deletions

View File

@@ -167,11 +167,14 @@ public class Xoa_css_extractor {
return mainpage_html != null;
}
private byte[] Mainpage_download_html() {
String log_msg = usr_dlg.Prog_many("", "main_page.download", "downloading main page for '~{0}'", wiki_domain);
byte[] main_page_html = download_xrg.Prog_fmt_hdr_(log_msg).Exec_as_bry(mainpage_url);
if (main_page_html == null) usr_dlg.Warn_many("", "", "failed to download main_page: src_url=~{0};", mainpage_url);
String main_page_url_temp = mainpage_url;
if (Bry_.Eq(wiki_domain, Xow_wiki_domain_.Url_wikidata)) // if wikidata, download css for a Q* page; Main_Page has less css; DATE:2014-09-30
main_page_url_temp = main_page_url_temp + "/wiki/Q2";
String log_msg = usr_dlg.Prog_many("", "main_page.download", "downloading main page for '~{0}'", main_page_url_temp);
byte[] main_page_html = download_xrg.Prog_fmt_hdr_(log_msg).Exec_as_bry(main_page_url_temp);
if (main_page_html == null) usr_dlg.Warn_many("", "", "failed to download main_page: src_url=~{0};", main_page_url_temp);
return main_page_html;
}
}
private void Failover(Io_url trg_fil) {
usr_dlg.Note_many("", "", "copying failover file: trg_fil=~{0};", trg_fil.Raw());
Io_mgr._.CopyFil(failover_dir.GenSubFil(trg_fil.NameAndExt()), trg_fil, true);

View File

@@ -30,12 +30,12 @@ public class Xob_dump_file {
public Xob_dump_file Ctor(String wiki_domain, String dump_date, String dump_file_type) {
this.dump_date = dump_date; this.dump_file_type = dump_file_type;
this.wiki_type = Xow_wiki_domain_.parse_by_domain(Bry_.new_ascii_(wiki_domain));
this.wiki_alias = Xob_bz2_file.Build_alias(wiki_type);
this.wiki_alias = Xow_wiki_alias.Build_alias(wiki_type);
byte[] dump_file_bry = Bry_.new_utf8_(dump_file_type);
byte dump_file_tid = Xob_bz2_file.Parse__tid(dump_file_bry);
byte dump_file_tid = Xow_wiki_alias.Parse__tid(dump_file_bry);
byte[] ext = Xob_dump_file_.Ext_xml_bz2;
switch (dump_file_tid) {
case Xob_bz2_file.Tid_page_props: case Xob_bz2_file.Tid_categorylinks: case Xob_bz2_file.Tid_image:
case Xow_wiki_alias.Tid_page_props: case Xow_wiki_alias.Tid_categorylinks: case Xow_wiki_alias.Tid_image:
ext = Xob_dump_file_.Ext_sql_gz;
break;
}

View File

@@ -15,8 +15,8 @@ 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; import gplx.*;
import gplx.threads.*;
package gplx.xowa; import gplx.*;
import gplx.threads.*; import gplx.xowa.wikis.*;
abstract class Xoi_cmd_base implements Gfo_thread_cmd {
public void Ctor(Xoi_setup_mgr install_mgr, String wiki_key) {
this.install_mgr = install_mgr; this.wiki_key = wiki_key;
@@ -68,11 +68,11 @@ abstract class Xoi_cmd_base implements Gfo_thread_cmd {
return this;
} private static final String Invk_process_async = "run_async", Invk_owner = "owner";
}
class Xoi_cmd_category2_page_props extends Xoi_cmd_wiki_download { public Xoi_cmd_category2_page_props(Xoi_setup_mgr install_mgr, String wiki_key, String dump_date) {this.Ctor_download_(install_mgr, wiki_key, dump_date, Xob_bz2_file.Key_page_props);}
class Xoi_cmd_category2_page_props extends Xoi_cmd_wiki_download { public Xoi_cmd_category2_page_props(Xoi_setup_mgr install_mgr, String wiki_key, String dump_date) {this.Ctor_download_(install_mgr, wiki_key, dump_date, Xow_wiki_alias.Key_page_props);}
@Override public String Download_file_ext() {return ".sql.gz2";}
public static final String KEY_category2 = "wiki.category2.download.page_props";
}
class Xoi_cmd_category2_categorylinks extends Xoi_cmd_wiki_download { public Xoi_cmd_category2_categorylinks(Xoi_setup_mgr install_mgr, String wiki_key, String dump_date) {this.Ctor_download_(install_mgr, wiki_key, dump_date, Xob_bz2_file.Key_categorylinks);}
class Xoi_cmd_category2_categorylinks extends Xoi_cmd_wiki_download { public Xoi_cmd_category2_categorylinks(Xoi_setup_mgr install_mgr, String wiki_key, String dump_date) {this.Ctor_download_(install_mgr, wiki_key, dump_date, Xow_wiki_alias.Key_categorylinks);}
@Override public String Download_file_ext() {return ".sql.gz2";}
public static final String KEY_category2 = "wiki.category2.download.categorylinks";
}

View File

@@ -41,7 +41,7 @@ class Xoi_cmd_wiki_download extends Gfo_thread_cmd_download implements Gfo_threa
Dump_servers_offline_msg_shown = true;
}
}
Xow_wiki wiki = app.Wiki_mgr().Get_by_key_or_make(dump_file.Wiki_type().Raw());
Xow_wiki wiki = app.Wiki_mgr().Get_by_key_or_make(dump_file.Wiki_type().Domain_bry());
Io_url root_dir = wiki.Fsys_mgr().Root_dir();
Io_url[] trg_fil_ary = Io_mgr._.QueryDir_args(root_dir).FilPath_("*." + dump_type + Download_file_ext() + "*").ExecAsUrlAry();
Io_url trg = trg_fil_ary.length == 0 ? root_dir.GenSubFil(dump_file.File_name()) : trg_fil_ary[0];

View File

@@ -30,7 +30,7 @@ public class Xoi_cmd_wiki_tst {
Xob_dump_file dump_file = new Xob_dump_file();
for (int i = 0; i < ary_len; i++) {
String itm = ary[i];
dump_file.Ctor(itm, "latest", Xob_bz2_file.Key_pages_articles);
dump_file.Ctor(itm, "latest", Xow_wiki_alias.Key_pages_articles);
int count = 0;
while (count++ < 10) {
dump_file.Server_url_(Xob_dump_file_.Server_wmf);
@@ -46,7 +46,7 @@ public class Xoi_cmd_wiki_tst {
Tfds.WriteText(String_.Format("passed: {0}\n", itm));
bfr.Add_str(itm).Add_byte_pipe();
bfr.Add_str(dump_file.File_url()).Add_byte_pipe();
bfr.Add(Xow_wiki_domain_.Key_by_tid(dump_file.Wiki_type().Tid())).Add_byte_pipe();
bfr.Add(Xow_wiki_domain_.Key_by_tid(dump_file.Wiki_type().Wiki_tid())).Add_byte_pipe();
// Xol_lang_itm lang_itm = Xol_lang_itm_.Get_by_key(wiki_type.Lang_key());
// if (lang_itm == null) lang_itm = Xol_lang_itm_.Get_by_key(Xol_lang_.Key_en); // commons, species, meta, etc will have no lang
// bfr.Add(lang_itm.Local_name()).Add_byte_pipe();