public void Init_by_wiki(Xow_wiki wiki) {
   if (init) return;
   try {
     init = true;
     //				if (wiki.File__fsdb_mode().Tid_v0()) return;
     this.url_bldr = Xof_url_bldr.new_v2();
     this.repo_mgr = wiki.File__repo_mgr();
     Fsdb_db_mgr fsdb_core = wiki.File__fsdb_core();
     // Fsdb_db_mgr fsdb_core = Fsdb_db_mgr_.new_detect(wiki, wiki.Fsys_mgr().Root_dir(),
     // wiki.Fsys_mgr().File_dir());
     if (fsdb_core == null) return;
     fsdb_enabled = true;
     mnt_mgr.Ctor_by_load(fsdb_core);
     this.bin_mgr =
         new Xof_bin_mgr(
             mnt_mgr,
             repo_mgr,
             wiki.App().File__img_mgr().Wkr_resize_img(),
             wiki.App().Wmf_mgr().Download_wkr().Download_xrg().Download_fmt());
     bin_mgr.Wkrs__add(Xof_bin_wkr__fsdb_sql.new_(mnt_mgr));
     bin_mgr.Wkrs__add(Xof_bin_wkr__http_wmf.new_(wiki));
   } catch (Exception e) {
     throw Err_.new_exc(e, "xo", "failed to initialize fsdb_mgr}", "wiki", wiki.Domain_str());
   }
 }
 public static Fsdb_db_mgr new_src_bin_db_mgr(Xow_wiki wiki, String version) {
   String domain_str = wiki.Domain_str();
   Fsdb_db_mgr rv = null;
   Io_url url = null;
   if (String_.Eq(version, "v1")) {
     url =
         wiki.Fsys_mgr()
             .File_dir()
             .OwnerDir()
             .GenSubDir(domain_str + "-prv"); // v1: EX: /xowa/file/en.wikipedia.org-prv/
     rv = new Fsdb_db_mgr__v1(url);
   } else if (String_.Eq(version, "v2")) {
     url = wiki.Fsys_mgr().Root_dir().GenSubDir("prv"); // v2: EX: /xowa/wiki/en.wikipedia.org/prv/
     rv = Fsdb_db_mgr_.new_detect(wiki, url, url); // note that v2 is prioritized over v1
   } else throw Err_.new_wo_type("fsdb.make:unknown fsdb_type", "version", version);
   if (rv == null)
     throw Err_.new_wo_type(
         "fsdb.make:source fsdb not found", "version", version, "url", url.Raw());
   return rv;
 }
 public void Fsdb_search_by_list(
     List_adp itms, Xow_wiki cur_wiki, Xoa_page page, Xog_js_wkr js_wkr) {
   if (!fsdb_enabled) return;
   int len = itms.Count();
   Gfo_usr_dlg usr_dlg = Gfo_usr_dlg_.Instance;
   Xow_wiki wiki = page.Commons_mgr().Source_wiki_or(cur_wiki);
   Xou_cache_mgr cache_mgr = wiki.App().User().User_db_mgr().Cache_mgr();
   for (int i = 0; i < len; i++) {
     if (usr_dlg.Canceled()) return;
     Xof_fsdb_itm fsdb = (Xof_fsdb_itm) itms.Get_at(i);
     if (fsdb.Hdump_mode() == Xof_fsdb_itm.Hdump_mode__null) {
       Xof_orig_itm orig = wiki.File__orig_mgr().Find_by_ttl_or_null(fsdb.Lnki_ttl(), i, len);
       if (orig != Xof_orig_itm.Null) { // orig exists;
         gplx.xowa.files.repos.Xof_repo_itm repo =
             wiki.File__repo_mgr().Get_trg_by_id_or_null(orig.Repo(), fsdb.Lnki_ttl(), Bry_.Empty);
         if (repo == null) continue;
         fsdb.Init_at_orig(
             orig.Repo(),
             repo.Wiki_domain(),
             orig.Ttl(),
             orig.Ext(),
             orig.W(),
             orig.H(),
             orig.Redirect());
       }
     }
     fsdb.Init_at_xfer(i, len);
     Xof_file_wkr.Show_img(
         fsdb,
         usr_dlg,
         wiki.File__bin_mgr(),
         wiki.File__mnt_mgr(),
         cache_mgr,
         wiki.File__repo_mgr(),
         js_wkr,
         img_size,
         url_bldr,
         page);
   }
 }