Esempio n. 1
0
 public void Special__gen(Xoa_app app, Xow_wiki wiki, Xoa_page page, Xoa_url url, Xoa_ttl ttl) {
   int slash_pos =
       Bry_find_.Find_fwd(ttl.Page_txt_wo_qargs(), Xoa_ttl.Subpage_spr); // check for slash
   byte[] special_name =
       slash_pos == Bry_find_.Not_found
           ? ttl
               .Base_txt_wo_qarg() // no slash found; use base_txt; ignore qry args and just get
                                   // page_names; EX: Search/Earth?fulltext=y;
                                   // Allpages?from=Earth...
           : Bry_.Mid(
               ttl.Page_txt_wo_qargs(),
               0,
               slash_pos); // slash found; use root page; EX: Special:ItemByTitle/enwiki/Earth
   special_name =
       Xoa_ttl.Replace_spaces(special_name); // handle spaces; EX:Spezial:Zufällige_Seite
   Xow_special_page special = (Xow_special_page) hash.Get_by_bry(special_name);
   if (special != null) { // special found; generate it;
     special = special.Special__clone();
     page.Db().Page().Modified_on_(Datetime_now.Get());
     try {
       special.Special__gen(wiki, page, url, ttl);
     } catch (Exception e) {
       Gfo_log_.Instance.Warn(
           "failed to generate special page",
           "url",
           url.To_str(),
           "err",
           Err_.Message_gplx_log(e));
     }
   }
 }
Esempio n. 2
0
 public static Xof_fsdb_itm Make_fsdb(
     Xowe_wiki wiki, byte[] lnki_ttl, Xof_img_size img_size, Xof_url_bldr url_bldr) {
   Xof_fsdb_itm fsdb = new Xof_fsdb_itm();
   lnki_ttl = Xoa_ttl.Replace_spaces(Xoa_app_.Utl__encoder_mgr().Http_url().Decode(lnki_ttl));
   fsdb.Init_at_lnki(
       Xof_exec_tid.Tid_viewer_app,
       wiki.Domain_itm().Abrv_xo(),
       lnki_ttl,
       Xop_lnki_type.Id_none,
       Xop_lnki_tkn.Upright_null,
       Xof_img_size.Size_null_deprecated,
       Xof_img_size.Size_null_deprecated,
       Xof_lnki_time.Null,
       Xof_lnki_page.Null,
       Xof_patch_upright_tid_.Tid_all);
   fsdb.Init_at_hdoc(
       Int_.MaxValue,
       Xof_html_elem
           .Tid_img); // NOTE: set elem_id to "impossible" number, otherwise it will auto-update an
   // image on the page with a super-large size; [[File:Alfred Sisley 062.jpg]]
   Xof_orig_itm orig = wiki.File__orig_mgr().Find_by_ttl_or_null(lnki_ttl);
   if (orig == Xof_orig_itm.Null) return null; // orig not found; need orig in order to get repo
   Xof_repo_itm repo =
       wiki.File__repo_mgr().Get_trg_by_id_or_null(orig.Repo(), lnki_ttl, Bry_.Empty);
   if (repo == null) return null; // repo not found
   fsdb.Init_at_orig(
       orig.Repo(),
       repo.Wiki_domain(),
       orig.Ttl(),
       orig.Ext(),
       orig.W(),
       orig.H(),
       orig.Redirect());
   fsdb.Init_at_html(Xof_exec_tid.Tid_viewer_app, img_size, repo, url_bldr);
   fsdb.File_is_orig_(true);
   return fsdb;
 }