MediaWiki
REL1_21
|
00001 <?php 00029 class HTMLCacheUpdate implements DeferrableUpdate { 00033 public $mTitle; 00034 00035 public $mTable; 00036 00043 function __construct( Title $titleTo, $table ) { 00044 $this->mTitle = $titleTo; 00045 $this->mTable = $table; 00046 } 00047 00048 public function doUpdate() { 00049 global $wgMaxBacklinksInvalidate; 00050 00051 wfProfileIn( __METHOD__ ); 00052 00053 $job = new HTMLCacheUpdateJob( 00054 $this->mTitle, 00055 array( 00056 'table' => $this->mTable, 00057 ) + Job::newRootJobParams( // "overall" refresh links job info 00058 "htmlCacheUpdate:{$this->mTable}:{$this->mTitle->getPrefixedText()}" 00059 ) 00060 ); 00061 00062 $count = $this->mTitle->getBacklinkCache()->getNumLinks( $this->mTable, 200 ); 00063 if ( $wgMaxBacklinksInvalidate !== false && $count > $wgMaxBacklinksInvalidate ) { 00064 wfDebug( "Skipped HTML cache invalidation of {$this->mTitle->getPrefixedText()}." ); 00065 } elseif ( $count >= 200 ) { // many backlinks 00066 JobQueueGroup::singleton()->push( $job ); 00067 JobQueueGroup::singleton()->deduplicateRootJob( $job ); 00068 } else { // few backlinks ($count might be off even if 0) 00069 $job->run(); // just do the purge query now 00070 } 00071 00072 wfProfileOut( __METHOD__ ); 00073 } 00074 }