*
* @ingroup Cache
*/
-class HTMLCacheUpdate implements DeferrableUpdate {
+class HTMLCacheUpdate extends DataUpdate {
/** @var Title */
public $mTitle;
/**
* @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 );
}
}