X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fdeferred%2FHTMLCacheUpdate.php;h=29846bfb77f829b57f759a0f708aaa4f2b242196;hb=f938f15bea1a27f098fc7a0f93673adba31d2efe;hp=20e4a4c680cb1d3f7d9df7f5373afdc8c1ad216c;hpb=977f7ad8ade23a7ce5326a993bdf48c8beb42db0;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/deferred/HTMLCacheUpdate.php b/includes/deferred/HTMLCacheUpdate.php index 20e4a4c680..29846bfb77 100644 --- a/includes/deferred/HTMLCacheUpdate.php +++ b/includes/deferred/HTMLCacheUpdate.php @@ -26,7 +26,7 @@ * * @ingroup Cache */ -class HTMLCacheUpdate implements DeferrableUpdate { +class HTMLCacheUpdate extends DataUpdate { /** @var Title */ public $mTitle; @@ -36,32 +36,25 @@ class HTMLCacheUpdate implements DeferrableUpdate { /** * @param Title $titleTo * @param string $table + * @param string $causeAction Triggering action + * @param string $causeAgent Triggering user */ - function __construct( Title $titleTo, $table ) { + function __construct( + Title $titleTo, $table, $causeAction = 'unknown', $causeAgent = 'unknown' + ) { $this->mTitle = $titleTo; $this->mTable = $table; + $this->causeAction = $causeAction; + $this->causeAgent = $causeAgent; } public function doUpdate() { - $job = new HTMLCacheUpdateJob( + $job = HTMLCacheUpdateJob::newForBacklinks( $this->mTitle, - array( - 'table' => $this->mTable, - 'recursive' => true - ) + Job::newRootJobParams( // "overall" refresh links job info - "htmlCacheUpdate:{$this->mTable}:{$this->mTitle->getPrefixedText()}" - ) + $this->mTable, + [ 'causeAction' => $this->getCauseAction(), 'causeAgent' => $this->getCauseAgent() ] ); - $count = $this->mTitle->getBacklinkCache()->getNumLinks( $this->mTable, 100 ); - if ( $count >= 100 ) { // many backlinks - JobQueueGroup::singleton()->lazyPush( $job ); - JobQueueGroup::singleton()->deduplicateRootJob( $job ); - } else { // few backlinks ($count might be off even if 0) - $dbw = wfGetDB( DB_MASTER ); - $dbw->onTransactionIdle( function () use ( $job ) { - $job->run(); // just do the purge query now - } ); - } + JobQueueGroup::singleton()->lazyPush( $job ); } }