当前位置: 首页>>代码示例>>PHP>>正文


PHP HTMLFileCache::clearFileCache方法代码示例

本文整理汇总了PHP中HTMLFileCache::clearFileCache方法的典型用法代码示例。如果您正苦于以下问题:PHP HTMLFileCache::clearFileCache方法的具体用法?PHP HTMLFileCache::clearFileCache怎么用?PHP HTMLFileCache::clearFileCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTMLFileCache的用法示例。


在下文中一共展示了HTMLFileCache::clearFileCache方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: purge

 /**
  * Purge the cache for pages containing gallery tags
  */
 public function purge()
 {
     global $wgUseFileCache, $wgUseSquid;
     $totalGalleryPageCount = 0;
     // Keeps track of actual existing titles with gallery
     $dbGalleryCount = $this->getGalleryPageCount();
     // All counts including those with missing titles
     // Paginate the operation to prevent db/memory overload
     for ($limitCount = 0; $limitCount < $dbGalleryCount; $limitCount += self::PAGE_COUNT_LIMIT) {
         $galleryPageIds = $this->getGalleryPageIds($limitCount);
         $galleryPageTitles = \Title::newFromIDs($galleryPageIds);
         $galleryPageCount = count($galleryPageTitles);
         // abort if no pages were found
         if ($galleryPageCount == 0) {
             continue;
         }
         // Update squid/varnish/parser cache
         if ($wgUseSquid) {
             foreach ($galleryPageTitles as $title) {
                 $title->purgeSquid();
             }
         }
         // Update file cache if used
         if ($wgUseFileCache) {
             foreach ($galleryPageTitles as $title) {
                 \HTMLFileCache::clearFileCache($title);
             }
         }
         $totalGalleryPageCount += $galleryPageCount;
     }
     $this->info('Gallery page purge request', ['title' => __METHOD__, 'count' => $totalGalleryPageCount]);
     return $totalGalleryPageCount;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:36,代码来源:GalleryCachePurgeTask.class.php

示例2: purge

 /**
  * Purge the cache for backlinking pages (that is, pages containing
  * a reference to the Title associated with this task)
  *
  * @param string|array $tables
  */
 public function purge($tables)
 {
     global $wgUseFileCache, $wgUseSquid;
     $affectedTitles = $this->getAffectedTitles((array) $tables);
     $affectedCount = count($affectedTitles);
     $this->info("Purge Request", ['title' => $this->title->getPrefixedText(), 'count' => $affectedCount, 'tables' => $tables]);
     // abort if no pages link to the associated Title
     if ($affectedCount == 0) {
         return 0;
     }
     $dbw = wfGetDB(DB_MASTER);
     (new \WikiaSQL())->UPDATE('page')->SET('page_touched', $dbw->timestamp())->WHERE('page_id')->IN(array_map(function ($t) {
         return $t->getArticleID();
     }, $affectedTitles))->run($dbw);
     // Update squid/varnish
     if ($wgUseSquid) {
         \SquidUpdate::newFromTitles($affectedTitles)->doUpdate();
     }
     // Update file cache
     if ($wgUseFileCache) {
         foreach ($affectedTitles as $title) {
             \HTMLFileCache::clearFileCache($title);
         }
     }
     return $affectedCount;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:32,代码来源:HTMLCacheUpdateTask.class.php

示例3: doPurgeHtmlCache

 /**
  * @since 2.1
  */
 public function doPurgeHtmlCache()
 {
     foreach ($this->titles as $title) {
         $title->touchLinks();
         // @see MW 1.19 Title::invalidateCache
         \HTMLFileCache::clearFileCache($title);
     }
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:11,代码来源:PageUpdater.php

示例4: onArticleEdit

 /**
  * Purge caches on page update etc
  *
  * @param $title Title object
  * @todo:  verify that $title is always a Title object (and never false or null), add Title hint to parameter $title
  */
 public static function onArticleEdit($title)
 {
     global $wgDeferredUpdateList;
     // Invalidate caches of articles which include this page
     $wgDeferredUpdateList[] = new HTMLCacheUpdate($title, 'templatelinks');
     // Invalidate the caches of all pages which redirect here
     $wgDeferredUpdateList[] = new HTMLCacheUpdate($title, 'redirect');
     # Purge squid for this page only
     $title->purgeSquid();
     # Clear file cache for this page only
     HTMLFileCache::clearFileCache($title);
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:18,代码来源:Article.php

示例5: invalidateCache

 /**
  * Updates page_touched for this page; called from LinksUpdate.php
  *
  * @return Bool true if the update succeded
  */
 public function invalidateCache()
 {
     if (wfReadOnly()) {
         return;
     }
     $dbw = wfGetDB(DB_MASTER);
     $success = $dbw->update('page', array('page_touched' => $dbw->timestamp()), $this->pageCond(), __METHOD__);
     HTMLFileCache::clearFileCache($this);
     return $success;
 }
开发者ID:namrenni,项目名称:mediawiki,代码行数:15,代码来源:Title.php

示例6: invalidateTitles

 /**
  * @param array $pages Map of (page ID => (namespace, DB key)) entries
  */
 protected function invalidateTitles(array $pages)
 {
     global $wgUpdateRowsPerQuery, $wgUseFileCache;
     // Get all page IDs in this query into an array
     $pageIds = array_keys($pages);
     if (!$pageIds) {
         return;
     }
     // The page_touched field will need to be bumped for these pages.
     // Only bump it to the present time if no "rootJobTimestamp" was known.
     // If it is known, it can be used instead, which avoids invalidating output
     // that was in fact generated *after* the relevant dependency change time
     // (e.g. template edit). This is particularily useful since refreshLinks jobs
     // save back parser output and usually run along side htmlCacheUpdate jobs;
     // their saved output would be invalidated by using the current timestamp.
     if (isset($this->params['rootJobTimestamp'])) {
         $touchTimestamp = $this->params['rootJobTimestamp'];
     } else {
         $touchTimestamp = wfTimestampNow();
     }
     $dbw = wfGetDB(DB_MASTER);
     // Update page_touched (skipping pages already touched since the root job).
     // Check $wgUpdateRowsPerQuery for sanity; batch jobs are sized by that already.
     foreach (array_chunk($pageIds, $wgUpdateRowsPerQuery) as $batch) {
         $dbw->commit(__METHOD__, 'flush');
         wfWaitForSlaves();
         $dbw->update('page', array('page_touched' => $dbw->timestamp($touchTimestamp)), array('page_id' => $batch, "page_touched < " . $dbw->addQuotes($dbw->timestamp($touchTimestamp))), __METHOD__);
     }
     // Get the list of affected pages (races only mean something else did the purge)
     $titleArray = TitleArray::newFromResult($dbw->select('page', array('page_namespace', 'page_title'), array('page_id' => $pageIds, 'page_touched' => $dbw->timestamp($touchTimestamp)), __METHOD__));
     // Update squid
     $u = SquidUpdate::newFromTitles($titleArray);
     $u->doUpdate();
     // Update file cache
     if ($wgUseFileCache) {
         foreach ($titleArray as $title) {
             HTMLFileCache::clearFileCache($title);
         }
     }
 }
开发者ID:mb720,项目名称:mediawiki,代码行数:43,代码来源:HTMLCacheUpdateJob.php

示例7: invalidateCache

 /**
  * Updates page_touched for this page; called from LinksUpdate.php
  *
  * @return Bool true if the update succeded
  */
 public function invalidateCache()
 {
     if (wfReadOnly()) {
         return false;
     }
     $dbw = wfGetDB(DB_MASTER);
     $success = $dbw->update('page', array('page_touched' => $dbw->timestamp()), $this->pageCond(), __METHOD__);
     # start wikia change
     global $wgMemc;
     $wgMemc->set(wfMemcKey("page_touched", implode("_", $this->pageCond())), $dbw->timestamp(), 60);
     $this->mTouchedCached = null;
     # end wikia change
     HTMLFileCache::clearFileCache($this);
     return $success;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:20,代码来源:Title.php

示例8: updateData

 /**
  * Update the semantic data stored for some individual. The data is
  * given as a SMWSemanticData object, which contains all semantic data
  * for one particular subject.
  *
  * @param $data SMWSemanticData
  */
 public function updateData(SMWSemanticData $data)
 {
     /**
      * @since 1.6
      */
     wfRunHooks('SMWStore::updateDataBefore', array($this, $data));
     // Invalidate the page, so data stored on it gets displayed immediately in queries.
     global $smwgAutoRefreshSubject;
     if ($smwgAutoRefreshSubject && !wfReadOnly()) {
         $title = Title::makeTitle($data->getSubject()->getNamespace(), $data->getSubject()->getDBkey());
         $dbw = wfGetDB(DB_MASTER);
         $dbw->update('page', array('page_touched' => $dbw->timestamp(time() + 4)), $title->pageCond(), __METHOD__);
         HTMLFileCache::clearFileCache($title);
     }
     $this->doDataUpdate($data);
     /**
      * @since 1.6
      */
     wfRunHooks('SMWStore::updateDataAfter', array($this, $data));
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:27,代码来源:SMW_Store.php

示例9: purge_reviewable_pages

 protected function purge_reviewable_pages($fileHandle)
 {
     global $wgUseSquid, $wgUseFileCache;
     $this->output("Purging squid cache for list of pages to purge ...\n");
     if (!$wgUseSquid && !$wgUseFileCache) {
         $this->output("Squid/file cache not enabled ... nothing to purge.\n");
         return;
     }
     $count = 0;
     while (!feof($fileHandle)) {
         $dbKey = trim(fgets($fileHandle));
         if ($dbKey == '') {
             continue;
             // last line?
         }
         $title = Title::newFromDBkey($dbKey);
         if ($title) {
             $title->purgeSquid();
             // send PURGE
             HTMLFileCache::clearFileCache($title);
             // purge poor-mans's squid
             $this->output("... {$dbKey}\n");
             $count++;
             if ($count % $this->mBatchSize == 0) {
                 wfWaitForSlaves(5);
                 // not really needed
             }
         } else {
             $this->output("Invalid title - cannot purge: {$dbKey}\n");
         }
     }
     $this->output("Squid/file cache purge of page list complete ... {$count} pages\n");
 }
开发者ID:crippsy14,项目名称:orange-smorange,代码行数:33,代码来源:purgeReviewablePages.php

示例10: invalidateTitles

 /**
  * Invalidate an array (or iterator) of Title objects, right now
  * @param $titleArray array
  */
 protected function invalidateTitles($titleArray)
 {
     global $wgUseFileCache, $wgUseSquid;
     $dbw = wfGetDB(DB_MASTER);
     $timestamp = $dbw->timestamp();
     # Get all IDs in this query into an array
     $ids = array();
     foreach ($titleArray as $title) {
         $ids[] = $title->getArticleID();
     }
     if (!$ids) {
         return;
     }
     # Update page_touched
     $batches = array_chunk($ids, $this->mRowsPerQuery);
     foreach ($batches as $batch) {
         $dbw->update('page', array('page_touched' => $timestamp), array('page_id' => $batch), __METHOD__);
     }
     # Update squid
     if ($wgUseSquid) {
         $u = SquidUpdate::newFromTitles($titleArray);
         $u->doUpdate();
     }
     # Update file cache
     if ($wgUseFileCache) {
         foreach ($titleArray as $title) {
             HTMLFileCache::clearFileCache($title);
         }
     }
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:34,代码来源:HTMLCacheUpdate.php

示例11: invalidateTitles

 /**
  * @param array $pages Map of (page ID => (namespace, DB key)) entries
  */
 protected function invalidateTitles(array $pages)
 {
     global $wgUpdateRowsPerQuery, $wgUseFileCache;
     // Get all page IDs in this query into an array
     $pageIds = array_keys($pages);
     if (!$pageIds) {
         return;
     }
     // Bump page_touched to the current timestamp. This used to use the root job timestamp
     // (e.g. template/file edit time), which was a bit more efficient when template edits are
     // rare and don't effect the same pages much. However, this way allows for better
     // de-duplication, which is much more useful for wikis with high edit rates. Note that
     // RefreshLinksJob, which is enqueued alongside HTMLCacheUpdateJob, saves the parser output
     // since it has to parse anyway. We assume that vast majority of the cache jobs finish
     // before the link jobs, so using the current timestamp instead of the root timestamp is
     // not expected to invalidate these cache entries too often.
     $touchTimestamp = wfTimestampNow();
     $dbw = wfGetDB(DB_MASTER);
     $factory = wfGetLBFactory();
     $ticket = $factory->getEmptyTransactionTicket(__METHOD__);
     // Update page_touched (skipping pages already touched since the root job).
     // Check $wgUpdateRowsPerQuery for sanity; batch jobs are sized by that already.
     foreach (array_chunk($pageIds, $wgUpdateRowsPerQuery) as $batch) {
         $factory->commitAndWaitForReplication(__METHOD__, $ticket);
         $dbw->update('page', ['page_touched' => $dbw->timestamp($touchTimestamp)], ['page_id' => $batch, "page_touched < " . $dbw->addQuotes($dbw->timestamp($touchTimestamp))], __METHOD__);
     }
     // Get the list of affected pages (races only mean something else did the purge)
     $titleArray = TitleArray::newFromResult($dbw->select('page', ['page_namespace', 'page_title'], ['page_id' => $pageIds, 'page_touched' => $dbw->timestamp($touchTimestamp)], __METHOD__));
     // Update CDN
     $u = CdnCacheUpdate::newFromTitles($titleArray);
     $u->doUpdate();
     // Update file cache
     if ($wgUseFileCache) {
         foreach ($titleArray as $title) {
             HTMLFileCache::clearFileCache($title);
         }
     }
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:41,代码来源:HTMLCacheUpdateJob.php

示例12: invalidateIDs

 /**
  * Invalidate a set of IDs, right now
  */
 public function invalidateIDs(ResultWrapper $res)
 {
     global $wgUseFileCache, $wgUseSquid;
     if ($res->numRows() == 0) {
         return;
     }
     // sanity check
     $dbw = wfGetDB(DB_MASTER);
     $timestamp = $dbw->timestamp();
     $done = false;
     while (!$done) {
         # Get all IDs in this query into an array
         $ids = array();
         for ($i = 0; $i < $this->mRowsPerQuery; $i++) {
             $row = $res->fetchRow();
             if ($row) {
                 $ids[] = $row[0];
             } else {
                 $done = true;
                 break;
             }
         }
         if (count($ids) == 0) {
             break;
         }
         # Update page_touched
         $dbw->update('page', array('page_touched' => $timestamp), array('page_id' => $ids), __METHOD__);
         # Update static caches
         if ($wgUseSquid || $wgUseFileCache) {
             $titles = Title::newFromIDs($ids);
             # Update squid cache
             if ($wgUseSquid) {
                 $u = SquidUpdate::newFromTitles($titles);
                 $u->doUpdate();
             }
             # Update file cache
             if ($wgUseFileCache) {
                 foreach ($titles as $title) {
                     HTMLFileCache::clearFileCache($title);
                 }
             }
         }
     }
 }
开发者ID:crippsy14,项目名称:orange-smorange,代码行数:47,代码来源:FRExtraCacheUpdate.php

示例13: doUpdate

 function doUpdate()
 {
     # Purge squid for this page only
     $this->title->purgeSquid();
     # Clear file cache for this page only
     HTMLFileCache::clearFileCache($this->title);
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:7,代码来源:FRExtraCacheUpdate.php

示例14: invalidate

 /**
  * Invalidate a set of pages, right now
  */
 public function invalidate($startId = false, $endId = false)
 {
     global $wgUseFileCache, $wgUseSquid;
     $titleArray = $this->mCache->getLinks($this->mTable, $startId, $endId);
     if ($titleArray->count() == 0) {
         return;
     }
     $dbw = wfGetDB(DB_MASTER);
     $timestamp = $dbw->timestamp();
     # Get all IDs in this query into an array
     $ids = array();
     foreach ($titleArray as $title) {
         $ids[] = $title->getArticleID();
     }
     # Update page_touched
     $dbw->update('page', array('page_touched' => $timestamp), array('page_id IN (' . $dbw->makeList($ids) . ')'), __METHOD__);
     # Update squid
     if ($wgUseSquid) {
         $u = SquidUpdate::newFromTitles($titleArray);
         $u->doUpdate();
     }
     # Update file cache
     if ($wgUseFileCache) {
         foreach ($titleArray as $title) {
             HTMLFileCache::clearFileCache($title);
         }
     }
 }
开发者ID:ruizrube,项目名称:spdef,代码行数:31,代码来源:HTMLCacheUpdate.php

示例15: invalidateTitles

 /**
  * Invalidate an array (or iterator) of Title objects, right now
  * @param $titleArray array
  */
 protected function invalidateTitles($titleArray)
 {
     global $wgUseFileCache, $wgUseSquid;
     $dbw = wfGetDB(DB_MASTER);
     $timestamp = $dbw->timestamp();
     # Get all IDs in this query into an array
     $ids = array();
     foreach ($titleArray as $title) {
         $ids[] = $title->getArticleID();
     }
     if (!$ids) {
         return;
     }
     # Don't invalidated pages that were already invalidated
     $touchedCond = isset($this->params['rootJobTimestamp']) ? array("page_touched < " . $dbw->addQuotes($dbw->timestamp($this->params['rootJobTimestamp']))) : array();
     # Update page_touched
     $batches = array_chunk($ids, $this->rowsPerQuery);
     foreach ($batches as $batch) {
         $dbw->update('page', array('page_touched' => $timestamp), array('page_id' => $batch) + $touchedCond, __METHOD__);
     }
     # Update squid
     if ($wgUseSquid) {
         $u = SquidUpdate::newFromTitles($titleArray);
         $u->doUpdate();
     }
     # Update file cache
     if ($wgUseFileCache) {
         foreach ($titleArray as $title) {
             HTMLFileCache::clearFileCache($title);
         }
     }
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:36,代码来源:HTMLCacheUpdateJob.php


注:本文中的HTMLFileCache::clearFileCache方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。