MediaWiki
REL1_22
|
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 wfProfileIn( __METHOD__ ); 00050 00051 $job = new HTMLCacheUpdateJob( 00052 $this->mTitle, 00053 array( 00054 'table' => $this->mTable, 00055 ) + Job::newRootJobParams( // "overall" refresh links job info 00056 "htmlCacheUpdate:{$this->mTable}:{$this->mTitle->getPrefixedText()}" 00057 ) 00058 ); 00059 00060 $count = $this->mTitle->getBacklinkCache()->getNumLinks( $this->mTable, 200 ); 00061 if ( $count >= 200 ) { // many backlinks 00062 JobQueueGroup::singleton()->push( $job ); 00063 JobQueueGroup::singleton()->deduplicateRootJob( $job ); 00064 } else { // few backlinks ($count might be off even if 0) 00065 $dbw = wfGetDB( DB_MASTER ); 00066 $dbw->onTransactionIdle( function() use ( $job ) { 00067 $job->run(); // just do the purge query now 00068 } ); 00069 } 00070 00071 wfProfileOut( __METHOD__ ); 00072 } 00073 }