當前位置: 首頁>>代碼示例>>PHP>>正文


PHP HTMLFileCache::isCached方法代碼示例

本文整理匯總了PHP中HTMLFileCache::isCached方法的典型用法代碼示例。如果您正苦於以下問題:PHP HTMLFileCache::isCached方法的具體用法?PHP HTMLFileCache::isCached怎麽用?PHP HTMLFileCache::isCached使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在HTMLFileCache的用法示例。


在下文中一共展示了HTMLFileCache::isCached方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: fileCachedPage

 /**
  * @return string
  */
 private function fileCachedPage()
 {
     $context = RequestContext::getMain();
     if ($context->getOutput()->isDisabled()) {
         // Done already?
         return '';
     }
     if ($context->getTitle()) {
         // Use the main context's title if we managed to set it
         $t = $context->getTitle()->getPrefixedDBkey();
     } else {
         // Fallback to the raw title URL param. We can't use the Title
         // class is it may hit the interwiki table and give a DB error.
         // We may get a cache miss due to not sanitizing the title though.
         $t = str_replace(' ', '_', $context->getRequest()->getVal('title'));
         if ($t == '') {
             // fallback to main page
             $t = Title::newFromText($this->msg('mainpage', 'Main Page'))->getPrefixedDBkey();
         }
     }
     $cache = new HTMLFileCache($t, 'view');
     if ($cache->isCached()) {
         return $cache->fetchText();
     } else {
         return '';
     }
 }
開發者ID:D66Ha,項目名稱:mediawiki,代碼行數:30,代碼來源:DatabaseError.php

示例2: run

 /**
  * Run the current MediaWiki instance; index.php just calls this
  */
 public function run()
 {
     try {
         $this->setDBProfilingAgent();
         try {
             $this->main();
         } catch (ErrorPageError $e) {
             // Bug 62091: while exceptions are convenient to bubble up GUI errors,
             // they are not internal application faults. As with normal requests, this
             // should commit, print the output, do deferred updates, jobs, and profiling.
             $this->doPreOutputCommit();
             $e->report();
             // display the GUI error
         }
     } catch (Exception $e) {
         $context = $this->context;
         $action = $context->getRequest()->getVal('action', 'view');
         if ($e instanceof DBConnectionError && $context->hasTitle() && $context->getTitle()->canExist() && in_array($action, ['view', 'history'], true) && HTMLFileCache::useFileCache($this->context, HTMLFileCache::MODE_OUTAGE)) {
             // Try to use any (even stale) file during outages...
             $cache = new HTMLFileCache($context->getTitle(), 'view');
             if ($cache->isCached()) {
                 $cache->loadFromFileCache($context, HTMLFileCache::MODE_OUTAGE);
                 print MWExceptionRenderer::getHTML($e);
                 exit;
             }
         }
         MWExceptionHandler::handleException($e);
     }
     $this->doPostOutputShutdown('normal');
 }
開發者ID:paladox,項目名稱:mediawiki,代碼行數:33,代碼來源:MediaWiki.php


注:本文中的HTMLFileCache::isCached方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。