X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fdeferred%2FHTMLCacheUpdate.php;h=29846bfb77f829b57f759a0f708aaa4f2b242196;hb=0d58c1dddadfc97a3c56c77dd0fdfb84f8b5bd3f;hp=a480aec83af81a871fc862f9914de740d7a35d7d;hpb=a77c09c03baf8ee1dd7527db4c20c5be2cd2c298;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/deferred/HTMLCacheUpdate.php b/includes/deferred/HTMLCacheUpdate.php index a480aec83a..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,31 +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 ); - } 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 ); } }