* @file
* @ingroup JobQueue
*/
+use MediaWiki\MediaWikiServices;
/**
* Job to update link tables for pages
$revision = Revision::newFromTitle( $title, false, Revision::READ_LATEST );
}
+ $stats = MediaWikiServices::getInstance()->getStatsdDataFactory();
+
if ( !$revision ) {
+ $stats->increment( 'refreshlinks.rev_not_found' );
$this->setLastError( "Revision not found for {$title->getPrefixedDBkey()}" );
return false; // just deleted?
- }
-
- if ( !$revision->isCurrent() ) {
+ } elseif ( !$revision->isCurrent() ) {
// If the revision isn't current, there's no point in doing a bunch
// of work just to fail at the lockAndGetLatest() check later.
+ $stats->increment( 'refreshlinks.rev_not_current' );
$this->setLastError( "Revision {$revision->getId()} is not current" );
return false;
}
if ( $page->getLinksTimestamp() > $skewedTimestamp ) {
// Something already updated the backlinks since this job was made
+ $stats->increment( 'refreshlinks.update_skipped' );
return true;
}
- if ( $page->getTouched() >= $skewedTimestamp || $opportunistic ) {
- // Something bumped page_touched since this job was made or the cache is
- // otherwise suspected to be up-to-date. As long as the cache rev ID matches
+ if ( $page->getTouched() >= $this->params['rootJobTimestamp'] || $opportunistic ) {
+ // Cache is suspected to be up-to-date. As long as the cache rev ID matches
// and it reflects the job's triggering change, then it is usable.
$parserOutput = ParserCache::singleton()->getDirty( $page, $parserOptions );
if ( !$parserOutput
}
// Fetch the current revision and parse it if necessary...
- if ( !$parserOutput ) {
+ if ( $parserOutput ) {
+ $stats->increment( 'refreshlinks.parser_cached' );
+ } else {
$start = microtime( true );
// Revision ID must be passed to the parser output to get revision variables correct
$parserOutput = $content->getParserOutput(
$parserOutput, $page, $parserOptions, $ctime, $revision->getId()
);
}
+ $stats->increment( 'refreshlinks.parser_uncached' );
}
$updates = $content->getSecondaryDataUpdates(
// serialized, it would be OK to update links based on older revisions since it
// would eventually get to the latest. Since that is not the case (by design),
// only update the link tables to a state matching the current revision's output.
+ $stats->increment( 'refreshlinks.rev_cas_failure' );
$this->setLastError( "page_latest changed from {$revision->getId()} to $latestNow" );
return false;
}