mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.8.3.1
This commit is contained in:
@@ -35,7 +35,7 @@ public class Xoa_gfs_mgr implements GfoInvkAble, GfoInvkRootWkr {
|
||||
else if (String_.Eq(type, "xowa_cfg_custom")) url = usr_fsys_mgr.App_data_cfg_custom_fil();
|
||||
else if (String_.Eq(type, "xowa_cfg_user")) url = usr_fsys_mgr.App_data_cfg_user_fil();
|
||||
else if (String_.Eq(type, "xowa_cfg_os")) {url = app_fsys_mgr.Bin_data_os_cfg_fil(); Xoa_gfs_mgr_.Cfg_os_assert(url);}
|
||||
else if (String_.Eq(type, "xowa_cfg_app")) url = app_fsys_mgr.Root_dir().GenSubFil("xowa.gfs");
|
||||
else if (String_.Eq(type, "xowa_cfg_app")) url = app_fsys_mgr.Cfg_app_fil();
|
||||
else throw Err_.new_wo_type("invalid gfs type", "type", type);
|
||||
try {Run_url(url);}
|
||||
catch (Exception e) { // gfs is corrupt; may happen if multiple XOWAs opened, and "Close all" chosen in OS; DATE:2014-07-01
|
||||
|
||||
@@ -16,6 +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.apps.fsys; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*;
|
||||
import gplx.xowa.wikis.*;
|
||||
public class Xoa_fsys_mgr implements GfoInvkAble {
|
||||
public Xoa_fsys_mgr(String plat_name, Io_url root_dir, Io_url wiki_dir, Io_url file_dir, Io_url css_dir) {
|
||||
this.root_dir = root_dir;
|
||||
@@ -25,9 +26,12 @@ public class Xoa_fsys_mgr implements GfoInvkAble {
|
||||
this.bin_plat_dir = root_dir.GenSubDir("bin").GenSubDir(plat_name);
|
||||
this.bin_any_dir = root_dir.GenSubDir("bin").GenSubDir("any");
|
||||
this.bin_xowa_dir = bin_any_dir.GenSubDir("xowa");
|
||||
this.bin_xtns_dir = bin_any_dir.GenSubDir_nest("xowa", "xtns");
|
||||
this.cfg_lang_core_dir = bin_any_dir.GenSubDir_nest("xowa", "cfg", "lang", "core");
|
||||
this.cfg_wiki_core_dir = bin_any_dir.GenSubDir_nest("xowa", "cfg", "wiki", "core");
|
||||
this.bin_xtns_dir = bin_xowa_dir.GenSubDir_nest("xtns");
|
||||
this.cfg_app_fil = bin_xowa_dir.GenSubFil_nest("cfg", "app", "xowa.gfs");
|
||||
this.cfg_lang_core_dir = bin_xowa_dir.GenSubDir_nest("cfg", "lang", "core");
|
||||
this.cfg_wiki_core_dir = bin_xowa_dir.GenSubDir_nest("cfg", "wiki", "core");
|
||||
this.cfg_site_meta_fil = bin_xowa_dir.GenSubDir_nest("cfg", "wiki", "site_meta.sqlite3");
|
||||
this.home_wiki_dir = bin_xowa_dir.GenSubDir_nest("wiki", Xow_domain_.Domain_str_home);
|
||||
}
|
||||
public Io_url Root_dir() {return root_dir;} private final Io_url root_dir;
|
||||
public Io_url Wiki_dir() {return wiki_dir;} private final Io_url wiki_dir;
|
||||
@@ -39,9 +43,12 @@ public class Xoa_fsys_mgr implements GfoInvkAble {
|
||||
public Io_url Bin_xtns_dir() {return bin_xtns_dir;} private final Io_url bin_xtns_dir;
|
||||
public Io_url Cfg_lang_core_dir() {return cfg_lang_core_dir;} private final Io_url cfg_lang_core_dir;
|
||||
public Io_url Cfg_wiki_core_dir() {return cfg_wiki_core_dir;} private final Io_url cfg_wiki_core_dir;
|
||||
public Io_url Cfg_site_meta_fil() {return cfg_site_meta_fil;} private final Io_url cfg_site_meta_fil;
|
||||
public Io_url Bin_data_os_cfg_fil() {return bin_plat_dir.GenSubFil_nest("xowa", "cfg", Xoa_gfs_mgr.Cfg_os);}
|
||||
public Io_url Wiki_css_dir(String wiki) {return css_dir.GenSubDir_nest(wiki, "html");} // EX: /xowa/temp/simple.wikipedia.org/html/xowa_common.css
|
||||
public Io_url Wiki_file_dir(String wiki) {return file_dir.GenSubDir_nest(wiki);} // EX: /xowa/temp/simple.wikipedia.org/orig/
|
||||
public Io_url Home_wiki_dir() {return home_wiki_dir;} private final Io_url home_wiki_dir;
|
||||
public Io_url Cfg_app_fil() {return cfg_app_fil;} private final Io_url cfg_app_fil;
|
||||
public void Init_by_app(GfoInvkAble app_mgr_invk) {this.app_mgr_invk = app_mgr_invk;} private GfoInvkAble app_mgr_invk; // for gfs and app.launcher
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_apps)) return app_mgr_invk;
|
||||
|
||||
@@ -18,11 +18,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.apps.metas; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*;
|
||||
import gplx.dbs.*;
|
||||
import gplx.xowa.langs.cases.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
import gplx.xowa.wmfs.data.*;
|
||||
public class Xoa_ns_mgr {
|
||||
private final Xoa_app app;
|
||||
private final Hash_adp_bry hash = Hash_adp_bry.cs();
|
||||
private Xowmf_site_tbl wmf_site_tbl; private Xowmf_ns_tbl wmf_ns_tbl;
|
||||
private Site_core_db core_db;
|
||||
public Xoa_ns_mgr(Xoa_app app) {
|
||||
this.app = app;
|
||||
}
|
||||
@@ -30,20 +31,10 @@ public class Xoa_ns_mgr {
|
||||
public Xow_ns_mgr Get_or_load(byte[] wiki_domain) {
|
||||
Xow_ns_mgr rv = (Xow_ns_mgr)hash.Get_by_bry(wiki_domain);
|
||||
if (rv == null) {
|
||||
rv = Load(wiki_domain);
|
||||
if (core_db == null) core_db = new Site_core_db(app.Fsys_mgr().Cfg_site_meta_fil());
|
||||
rv = core_db.Load_ns(wiki_domain);
|
||||
Add(wiki_domain, rv);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
private Xow_ns_mgr Load(byte[] wiki_domain) {
|
||||
Xow_ns_mgr rv = new Xow_ns_mgr(Xol_case_mgr_.U8());
|
||||
if (wmf_site_tbl == null) {
|
||||
Db_conn conn = Xowmf_site_tbl.Get_conn_or_new(app.Fsys_mgr().Root_dir());
|
||||
wmf_site_tbl = new Xowmf_site_tbl(conn);
|
||||
wmf_ns_tbl = new Xowmf_ns_tbl(conn);
|
||||
}
|
||||
int site_id = wmf_site_tbl.Select_id(String_.new_u8(wiki_domain));
|
||||
wmf_ns_tbl.Select_all(rv, site_id);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user