示例#1
0
 public static Xob_db_file New__deletion_db(Xow_wiki wiki) {
   String name =
       String_.Format(
           "{0}-file-deletion-{1}.xowa",
           wiki.Domain_str(), Datetime_now.Get().XtoStr_fmt("yyyy.MM"));
   return New(wiki.Fsys_mgr().Root_dir(), name);
 }
 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;
 }
示例#4
0
 public static Xob_db_file New__page_file_map(Xow_wiki wiki) {
   return New(wiki.Fsys_mgr().Root_dir(), wiki.Domain_str() + "-file-page_map.xowa");
 }