コード例 #1
0
ファイル: Title.php プロジェクト: arlendotcn/ilias
 /**
  * Updates page_touched for this page; called from LinksUpdate.php
  * @return bool true if the update succeded
  */
 public function invalidateCache()
 {
     global $wgUseFileCache;
     if (wfReadOnly()) {
         return;
     }
     $dbw = wfGetDB(DB_MASTER);
     $success = $dbw->update('page', array('page_touched' => $dbw->timestamp()), array('page_namespace' => $this->getNamespace(), 'page_title' => $this->getDBkey()), 'Title::invalidateCache');
     if ($wgUseFileCache) {
         $cache = new HTMLFileCache($this);
         @unlink($cache->fileCacheName());
     }
     return $success;
 }
コード例 #2
0
ファイル: Article.php プロジェクト: negabaro/alfresco
 /**
  * Purge caches on page update etc
  */
 static function onArticleEdit($title)
 {
     global $wgDeferredUpdateList, $wgUseFileCache;
     // Invalidate caches of articles which include this page
     $update = new HTMLCacheUpdate($title, 'templatelinks');
     $wgDeferredUpdateList[] = $update;
     # Purge squid for this page only
     $title->purgeSquid();
     # Clear file cache
     if ($wgUseFileCache) {
         $cm = new HTMLFileCache($title);
         @unlink($cm->fileCacheName());
     }
 }
コード例 #3
0
 /**
  * Invalidate a set of IDs, right now
  */
 function invalidateIDs(ResultWrapper $res)
 {
     global $wgUseFileCache, $wgUseSquid;
     if ($res->numRows() == 0) {
         return;
     }
     $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)) {
             break;
         }
         # Update page_touched
         $dbw->update('page', array('page_touched' => $timestamp), array('page_id IN (' . $dbw->makeList($ids) . ')'), __METHOD__);
         # Update squid
         if ($wgUseSquid || $wgUseFileCache) {
             $titles = Title::newFromIDs($ids);
             if ($wgUseSquid) {
                 $u = SquidUpdate::newFromTitles($titles);
                 $u->doUpdate();
             }
             # Update file cache
             if ($wgUseFileCache) {
                 foreach ($titles as $title) {
                     $cm = new HTMLFileCache($title);
                     @unlink($cm->fileCacheName());
                 }
             }
         }
     }
 }
コード例 #4
0
ファイル: Article.php プロジェクト: ErdemA/wikihow
 /**
  * Purge caches on page update etc
  */
 static function onArticleEdit($title)
 {
     global $wgDeferredUpdateList, $wgUseFileCache;
     $title->touchLinks();
     // 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
     if ($wgUseFileCache) {
         $cm = new HTMLFileCache($title);
         @unlink($cm->fileCacheName());
     }
 }