public void Chk(byte[] wiki_domain, Io_url css_fil) {
   this.wiki_domain = wiki_domain;
   List_adp img_list = List_adp_.New();
   byte[] old_bry = Io_mgr.Instance.LoadFilBry(css_fil);
   byte[] rel_url_prefix = Bry_.Add(Bry_fwd_slashes, wiki_domain);
   byte[] new_bry = Convert_to_local_urls(rel_url_prefix, old_bry, img_list);
   Io_url img_dir = css_fil.OwnerDir();
   Download_fils(img_dir, img_list.To_str_ary());
   Io_mgr.Instance.SaveFilBry(css_fil, new_bry);
 }
 private void Download_fils(Io_url css_dir, String[] ary) {
   int ary_len = ary.length;
   for (int i = 0; i < ary_len; i++) {
     String src = ary[i];
     Io_url trg =
         css_dir.GenSubFil_nest(
             Op_sys.Cur().Fsys_http_frag_to_url_str(Replace_invalid_chars_str(src)));
     if (Io_mgr.Instance.ExistsFil(trg)) continue;
     download_wkr.Download(true, "https://" + src, trg, "download: " + src); // ILN
     if (Io_mgr.Instance.QueryFil(trg).Size()
         == 0) { // warn if 0 byte files downloaded; DATE:2015-07-06
       Xoa_app_.Usr_dlg()
           .Warn_many("", "", "css.download; 0 byte file downloaded; file=~{0}", trg.Raw());
     }
   }
 }
 @Override
 public void Cmd_end() {
   usr_dlg.Note_many(
       "",
       "",
       "fsdb_make.done: count=~{0} rate=~{1}",
       exec_count,
       Decimal_adp_.divide_safe_(exec_count, System_.Ticks__elapsed_in_sec(time_bgn))
           .To_str("#,###.000"));
   if (src_fsdb_wkr != null) {
     src_fsdb_wkr.Mnt_mgr()
         .Mnts__get_main()
         .Txn_end(); // NOTE: src_fsdb_wkr will be null if no src db defined
   }
   trg_atr_fil.Conn().Txn_end();
   trg_atr_fil.Conn().Rls_conn();
   if (!trg_atr_fil.Conn().Eq(trg_cfg_mgr.Tbl().Conn())) // need to create txn for v1
   trg_cfg_mgr.Tbl().Conn().Txn_end();
   trg_cfg_mgr.Tbl().Conn().Rls_conn();
   if (!trg_mnt_itm.Db_mgr().File__solo_file()) {
     trg_bin_fil.Conn().Txn_end();
     trg_bin_fil.Conn().Rls_conn();
   }
   if (exec_done) {
     bldr_cfg_tbl.Delete_grp(Cfg_fsdb_make); // delete bmks for future reruns; DATE:2014-08-20
     Io_mgr.Instance.DeleteFil_args(wiki.Fsys_mgr().Root_dir().GenSubFil("xowa.file.make.cfg.gfs"))
         .MissingFails_off()
         .Exec();
   }
   bldr_conn.Rls_conn();
 }
Esempio n. 4
0
 public static Xopg_tag_itm New_htm_frag(Io_url url, String id) {
   byte[] html = Io_mgr.Instance.LoadFilBry(url);
   return new Xopg_tag_itm(
       Tid__htm_frag, Gfh_tag_.Bry__script, null, html, Tag__type_html, Keyval_.new_("id", id));
 }