mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
'v3.3.4.1'
This commit is contained in:
@@ -58,7 +58,6 @@ public class Xof_fsdb_itm implements Xof_file_itm {
|
||||
public boolean Fsdb_insert() {return fsdb_insert;} public void Fsdb_insert_y_() {fsdb_insert = true;} private boolean fsdb_insert;
|
||||
public int Xfer_idx() {return xfer_idx;} private int xfer_idx;
|
||||
public int Xfer_len() {return xfer_len;} private int xfer_len;
|
||||
|
||||
public void Init_at_lnki(int exec_tid, byte[] wiki_abrv, byte[] lnki_ttl, byte lnki_type, double lnki_upright, int lnki_w, int lnki_h, double lnki_time, int lnki_page, int lnki_upright_patch) {
|
||||
this.lnki_exec_tid = exec_tid; this.lnki_wiki_abrv = wiki_abrv;
|
||||
this.lnki_type = lnki_type; this.lnki_upright = lnki_upright; this.lnki_upright_patch = lnki_upright_patch;
|
||||
|
||||
@@ -58,7 +58,6 @@ public class Xof_img_size {
|
||||
}
|
||||
html_w = Upright_calc(upright_patch, lnki_upright, html_w, lnki_w, lnki_h, lnki_type);
|
||||
if (orig_w == Null) return; // no orig_w; just use html_w and html_h (html_h will likely be -1 and wrong)
|
||||
|
||||
boolean ext_is_svg = orig_ext == Xof_ext_.Id_svg;
|
||||
if (html_w == Xof_img_size.Null) {
|
||||
if ( ext_is_svg // following strange MW logic; REF.MW:Linker.php|makeImageLink|If its a vector image, and user only specifies height, we don't want it to be limited by its "normal" width; DATE: 2013-11-26
|
||||
@@ -159,16 +158,13 @@ MW calls the falling procs
|
||||
. File.php|scaleHeight
|
||||
Note that this proc is a selective culling of the w,h setting code in the above (the procs do a lot of other checks/building)
|
||||
also, MW's if branching can be combined. for now, emulating MW and not enforcing matching if/else
|
||||
|
||||
NOTE_2: lnki_ratio > orig_ratio
|
||||
REF.MW:media/MediaHandler.php|fitBoxWidth
|
||||
COMMENT:"Height is the relative smaller dimension, so scale width accordingly"
|
||||
|
||||
consider file of 200,100 (2:1)
|
||||
EX_1: view is 120,40 (3:1)
|
||||
- dimensions are either (a) 120,80 or (b) 80,40
|
||||
- use (b) 80,40
|
||||
|
||||
EX_2: view is 120,80 (1.5:1)
|
||||
- dimensions are either (a) 120,60 or (b) 160,80
|
||||
- use (a) 120,60
|
||||
|
||||
@@ -47,10 +47,8 @@ public class Xof_img_size_tst {
|
||||
@Test public void Upright() {fxt.Lnki_upright_(1).Lnki_(-1, -1).Orig_(440, 400).Test_html(220, 200);}
|
||||
@Test public void Upright_w_thumb() {fxt.Lnki_type_(Xop_lnki_type.Id_thumb).Lnki_upright_(2).Lnki_(-1, -1).Orig_(1500, 1125).Test_html(440, 330);}
|
||||
@Test public void Upright_ignored_by_w() {fxt.Lnki_type_(Xop_lnki_type.Id_thumb).Lnki_upright_(3.2).Lnki_(900, -1).Orig_(4653, 854).Test_html(900, 165);}// PAGE: fr.w:Bogota; DATE:2014-05-22
|
||||
|
||||
@Test public void Explicit_ratio_large() {fxt.Lnki_(120, 40).Test_html( 80, 40);} // see NOTE_2: lnki_ratio > orig_ratio
|
||||
@Test public void Explicit_ratio_small() {fxt.Lnki_(120, 80).Test_html(120, 60);} // see NOTE_2: lnki_ratio > orig_ratio
|
||||
|
||||
@Test public void Lnki_gt_orig_null_svg_example() { // EX:[[File:Crystal Clear app kedit.svg|50x40px]]
|
||||
fxt.Lnki_ext_(Xof_ext_.Id_svg).Lnki_type_(Xop_lnki_type.Id_null).Lnki_( 50, 40).Orig_( 40, 40).Test_html( 40, 40);
|
||||
}
|
||||
|
||||
@@ -47,8 +47,8 @@ class Xof_bin_wkr__http_wmf__fxt {
|
||||
private Io_stream_rdr get_as_rdr__rdr;
|
||||
public Xof_fsdb_itm_fxt Fsdb_itm_mkr() {return fsdb_itm_mkr;} private final Xof_fsdb_itm_fxt fsdb_itm_mkr = new Xof_fsdb_itm_fxt();
|
||||
public Xof_bin_wkr__http_wmf__fxt() {
|
||||
Xoae_app app = Xoa_app_fxt.app_();
|
||||
Xowe_wiki wiki = Xoa_app_fxt.wiki_tst_(app);
|
||||
Xoae_app app = Xoa_app_fxt.Make__app__edit();
|
||||
Xowe_wiki wiki = Xoa_app_fxt.Make__wiki__edit(app);
|
||||
Xoa_app_fxt.repo2_(app, wiki);
|
||||
this.download_mgr = Io_download_mgr_.new_memory();
|
||||
this.wkr = Xof_bin_wkr__http_wmf.new_(wiki, download_mgr);
|
||||
|
||||
@@ -34,7 +34,7 @@ class Xofc_dir_tbl implements Rls_able {
|
||||
Dbmeta_tbl_itm meta = Dbmeta_tbl_itm.New(tbl_name, flds
|
||||
, Dbmeta_idx_itm.new_normal_by_tbl(tbl_name, "name", fld_name)
|
||||
);
|
||||
conn.Ddl_create_tbl(meta);
|
||||
conn.Meta_tbl_create(meta);
|
||||
}
|
||||
stmt_bldr.Conn_(conn, tbl_name, flds, fld_id);
|
||||
conn.Rls_reg(this);
|
||||
@@ -80,7 +80,7 @@ class Xofc_dir_tbl implements Rls_able {
|
||||
}
|
||||
finally {rdr.Rls();}
|
||||
}
|
||||
public int Select_max_uid() {return Db_conn_.Select_fld0_as_int_or(conn, "SELECT Max(uid) AS MaxId FROM cache_dir;", -1);}
|
||||
public int Select_max_uid() {return conn.Exec_select_as_int("SELECT Max(uid) AS MaxId FROM cache_dir;", -1);}
|
||||
private Xofc_dir_itm new_itm(Db_rdr rdr) {
|
||||
return new Xofc_dir_itm(rdr.Read_int(fld_id), rdr.Read_bry_by_str(fld_name), Db_cmd_mode.Tid_ignore);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ class Xofc_fil_tbl implements Rls_able {
|
||||
Dbmeta_tbl_itm meta = Dbmeta_tbl_itm.New(tbl_name, flds
|
||||
, Dbmeta_idx_itm.new_normal_by_tbl(tbl_name, "fil", fld_name, fld_is_orig, fld_w, fld_h, fld_time, fld_cache_time, fld_uid)
|
||||
);
|
||||
conn.Ddl_create_tbl(meta);
|
||||
conn.Meta_tbl_create(meta);
|
||||
}
|
||||
select_itm_stmt = select_itm_v2_stmt = null;
|
||||
stmt_bldr.Conn_(conn, tbl_name, flds, fld_uid);
|
||||
@@ -135,7 +135,7 @@ class Xofc_fil_tbl implements Rls_able {
|
||||
}
|
||||
finally {rdr.Rls();}
|
||||
}
|
||||
public int Select_max_uid() {return Db_conn_.Select_fld0_as_int_or(conn, "SELECT Max(uid) AS MaxId FROM cache_fil;", -1);}
|
||||
public int Select_max_uid() {return conn.Exec_select_as_int("SELECT Max(uid) AS MaxId FROM cache_fil;", -1);}
|
||||
private Xofc_fil_itm new_itm(Db_rdr rdr) {
|
||||
return new Xofc_fil_itm
|
||||
( rdr.Read_int(fld_uid)
|
||||
|
||||
@@ -32,7 +32,7 @@ public class Xou_cache_mgr {
|
||||
public long Fsys_size_cur() {return fsys_size_cur;} private long fsys_size_cur = 0;
|
||||
public long Fsys_size_min() {return fsys_size_min;} public void Fsys_size_min_(long v) {fsys_size_min = v;} private long fsys_size_min = Io_mgr.Len_mb * 75;
|
||||
public long Fsys_size_max() {return fsys_size_max;} public void Fsys_size_max_(long v) {fsys_size_max = v;} private long fsys_size_max = Io_mgr.Len_mb * 100;
|
||||
public KeyVal[] Info() {
|
||||
public Keyval[] Info() {
|
||||
long view_date = Long_.Max_value;
|
||||
long fsys_size = 0;
|
||||
int len = hash.Count();
|
||||
@@ -41,11 +41,11 @@ public class Xou_cache_mgr {
|
||||
fsys_size += itm.File_size();
|
||||
if (itm.View_date() < view_date) view_date = itm.View_date();
|
||||
}
|
||||
return KeyVal_.Ary
|
||||
( KeyVal_.new_("cache folder", cache_dir.Xto_api())
|
||||
, KeyVal_.new_("space used", gplx.core.ios.Io_size_.To_str(fsys_size))
|
||||
, KeyVal_.new_("file count", len)
|
||||
, KeyVal_.new_("oldest file", view_date == Long_.Max_value ? "" : DateAdp_.unixtime_utc_seconds_(view_date).XtoStr_fmt_iso_8561())
|
||||
return Keyval_.Ary
|
||||
( Keyval_.new_("cache folder", cache_dir.Xto_api())
|
||||
, Keyval_.new_("space used", gplx.core.ios.Io_size_.To_str(fsys_size))
|
||||
, Keyval_.new_("file count", len)
|
||||
, Keyval_.new_("oldest file", view_date == Long_.Max_value ? "" : DateAdp_.unixtime_utc_seconds_(view_date).XtoStr_fmt_iso_8561())
|
||||
);
|
||||
}
|
||||
public Xou_cache_itm Get_or_null(Xof_fsdb_itm fsdb) {return Get_or_null(fsdb.Lnki_wiki_abrv(), fsdb.Lnki_ttl(), fsdb.Lnki_type(), fsdb.Lnki_upright(), fsdb.Lnki_w(), fsdb.Lnki_h(), fsdb.Lnki_time(), fsdb.Lnki_page(), fsdb.User_thumb_w());}
|
||||
|
||||
@@ -63,10 +63,10 @@ class Xou_cache_mgr_fxt {
|
||||
Tfds.Now_set(DateAdp_.new_(1970, 1, 1, 0, 0, 0, 0));
|
||||
Io_mgr.Instance.InitEngine_mem();
|
||||
Db_conn_bldr.Instance.Reg_default_mem();
|
||||
Xoae_app app = Xoa_app_fxt.app_();
|
||||
Xoae_app app = Xoa_app_fxt.Make__app__edit();
|
||||
app.User().User_db_mgr().Init_by_app(Bool_.N, app.Fsys_mgr().Root_dir().GenSubFil_nest("user", "xowa.user.anonymous.sqlite3"));
|
||||
Xoa_app_fxt.repo_(app, Xoa_app_fxt.wiki_(app, "en.wikipedia.org"));
|
||||
Xoa_app_fxt.repo_(app, Xoa_app_fxt.wiki_(app, "fr.wikipedia.org"));
|
||||
Xoa_app_fxt.repo_(app, Xoa_app_fxt.Make__wiki__edit(app, "en.wikipedia.org"));
|
||||
Xoa_app_fxt.repo_(app, Xoa_app_fxt.Make__wiki__edit(app, "fr.wikipedia.org"));
|
||||
this.mgr = new Xou_cache_mgr(app.Wiki_mgr(), app.Fsys_mgr().File_dir(), app.User().User_db_mgr().Db_file());
|
||||
}
|
||||
public void Init_delete(long min, long max) {
|
||||
|
||||
@@ -70,7 +70,7 @@ public class Xou_cache_tbl implements Rls_able {
|
||||
, Dbmeta_idx_itm.new_normal_by_tbl(tbl_name, "size", fld_file_size)
|
||||
, Dbmeta_idx_itm.new_normal_by_tbl(tbl_name, "date", fld_view_date)
|
||||
);
|
||||
conn.Ddl_create_tbl(meta);
|
||||
conn.Meta_tbl_create(meta);
|
||||
}
|
||||
public Xou_cache_itm Select_one(byte[] lnki_wiki_abrv, byte[] lnki_ttl, int lnki_type, double lnki_upright, int lnki_w, int lnki_h, double lnki_time, int lnki_page, int user_thumb_w) {
|
||||
if (select_stmt == null) select_stmt = conn.Stmt_select(tbl_name, flds, String_.Ary(fld_lnki_wiki_abrv, fld_lnki_ttl, fld_lnki_type, fld_lnki_upright, fld_lnki_w, fld_lnki_h, fld_lnki_time, fld_lnki_page, fld_user_thumb_w));
|
||||
|
||||
@@ -37,7 +37,7 @@ public class Orig_fil_tbl implements Rls_able {
|
||||
Dbmeta_tbl_itm meta = Dbmeta_tbl_itm.New(tbl_name, flds
|
||||
, Dbmeta_idx_itm.new_unique_by_tbl(tbl_name, "main", fld_name)
|
||||
);
|
||||
conn.Ddl_create_tbl(meta);
|
||||
conn.Meta_tbl_create(meta);
|
||||
}
|
||||
stmt_insert = stmt_select = null;
|
||||
conn.Rls_reg(this);
|
||||
|
||||
@@ -30,8 +30,8 @@ class Xof_file_fxt {
|
||||
Io_mgr.Instance.InitEngine_mem(); // NOTE: files are downloaded to mem_engine, regardless of Db being mem or sqlite; always reset
|
||||
Io_url root_url = Xoa_test_.Url_root();
|
||||
Xoa_test_.Db_init(root_url);
|
||||
app = Xoa_app_fxt.app_(Op_sys.Cur().Os_name(), root_url);
|
||||
wiki = Xoa_app_fxt.wiki_tst_(app);
|
||||
app = Xoa_app_fxt.Make__app__edit(Op_sys.Cur().Os_name(), root_url);
|
||||
wiki = Xoa_app_fxt.Make__wiki__edit(app);
|
||||
wiki.File__fsdb_mode().Tid_v2_bld_y_();
|
||||
this.fsdb_mgr = (Xof_fsdb_mgr__sql)wiki.File_mgr().Fsdb_mgr();
|
||||
this.orig_mgr = wiki.File__orig_mgr();
|
||||
|
||||
@@ -30,7 +30,7 @@ public class Xob_orig_tbl_bldr extends Xob_itm_basic_base implements Xob_cmd {
|
||||
Fsdb_db_mgr db_core_mgr = Fsdb_db_mgr_.new_detect(wiki, wiki.Fsys_mgr().Root_dir(), wiki.Fsys_mgr().File_dir());
|
||||
this.schema_1 = db_core_mgr.File__schema_is_1();
|
||||
conn = db_core_mgr.File__orig_tbl_ary()[gplx.fsdb.meta.Fsm_mnt_mgr.Mnt_idx_main].Conn();
|
||||
Io_url make_db_url = Xob_db_file.new__file_make(wiki.Fsys_mgr().Root_dir()).Url();
|
||||
Io_url make_db_url = Xob_db_file.New__file_make(wiki.Fsys_mgr().Root_dir()).Url();
|
||||
Sqlite_engine_.Db_attach(conn, "make_db", make_db_url.Raw());
|
||||
}
|
||||
public void Cmd_run() {Exec();}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class Xof_orig_tbl implements Rls_able {
|
||||
conn.Rls_reg(this);
|
||||
}
|
||||
public void Rls() {}
|
||||
public void Create_tbl() {conn.Ddl_create_tbl(Dbmeta_tbl_itm.New(tbl_name, flds, Dbmeta_idx_itm.new_normal_by_tbl(tbl_name, "main", fld_ttl)));}
|
||||
public void Create_tbl() {conn.Meta_tbl_create(Dbmeta_tbl_itm.New(tbl_name, flds, Dbmeta_idx_itm.new_normal_by_tbl(tbl_name, "main", fld_ttl)));}
|
||||
public void Select_by_list(Ordered_hash rv, List_adp itms) {select_in_wkr.Init(rv, itms).Select_in(Cancelable_.Never, conn, 0, itms.Count());}
|
||||
public Xof_orig_itm Select_itm(byte[] ttl) {
|
||||
Xof_orig_itm rv = Xof_orig_itm.Null;
|
||||
|
||||
@@ -30,7 +30,6 @@ public class Xof_orig_wkr_ {
|
||||
rv.Add(fsdb_ttl, orig);
|
||||
}
|
||||
}
|
||||
|
||||
public static final byte
|
||||
Tid_xowa_db = 1
|
||||
, Tid_wmf_api = 2
|
||||
|
||||
@@ -26,9 +26,9 @@ public class Xof_xfer_queue_base_fxt {
|
||||
@gplx.Virtual public void Clear(boolean src_repo_is_wmf) {
|
||||
Io_mgr.Instance.InitEngine_mem();
|
||||
if (app == null) {
|
||||
app = Xoa_app_fxt.app_();
|
||||
en_wiki = Xoa_app_fxt.wiki_(app, Xow_domain_itm_.Str__enwiki);
|
||||
commons = Xoa_app_fxt.wiki_(app, Xow_domain_itm_.Str__commons);
|
||||
app = Xoa_app_fxt.Make__app__edit();
|
||||
en_wiki = Xoa_app_fxt.Make__wiki__edit(app, Xow_domain_itm_.Str__enwiki);
|
||||
commons = Xoa_app_fxt.Make__wiki__edit(app, Xow_domain_itm_.Str__commons);
|
||||
app.Wiki_mgr().Add(commons);
|
||||
app.Wiki_mgr().Add(en_wiki);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user