MediaWiki
REL1_24
|
00001 <?php 00029 class HTMLCacheUpdate implements DeferrableUpdate { 00031 public $mTitle; 00032 00034 public $mTable; 00035 00040 function __construct( Title $titleTo, $table ) { 00041 $this->mTitle = $titleTo; 00042 $this->mTable = $table; 00043 } 00044 00045 public function doUpdate() { 00046 wfProfileIn( __METHOD__ ); 00047 00048 $job = new HTMLCacheUpdateJob( 00049 $this->mTitle, 00050 array( 00051 'table' => $this->mTable, 00052 ) + Job::newRootJobParams( // "overall" refresh links job info 00053 "htmlCacheUpdate:{$this->mTable}:{$this->mTitle->getPrefixedText()}" 00054 ) 00055 ); 00056 00057 $count = $this->mTitle->getBacklinkCache()->getNumLinks( $this->mTable, 100 ); 00058 if ( $count >= 100 ) { // many backlinks 00059 JobQueueGroup::singleton()->push( $job ); 00060 JobQueueGroup::singleton()->deduplicateRootJob( $job ); 00061 } else { // few backlinks ($count might be off even if 0) 00062 $dbw = wfGetDB( DB_MASTER ); 00063 $dbw->onTransactionIdle( function () use ( $job ) { 00064 $job->run(); // just do the purge query now 00065 } ); 00066 } 00067 00068 wfProfileOut( __METHOD__ ); 00069 } 00070 }