* @param $title Title of the page we're updating
* @param $parserOutput ParserOutput: output from a full parse of this page
* @param $recursive Boolean: queue jobs for recursive updates?
+ * @throws MWException
*/
function __construct( $title, $parserOutput, $recursive = true ) {
parent::__construct( false ); // no implicit transaction
}
function queueRecursiveJobs() {
- global $wgUpdateRowsPerJob;
wfProfileIn( __METHOD__ );
- $cache = $this->mTitle->getBacklinkCache();
- $batches = $cache->partition( 'templatelinks', $wgUpdateRowsPerJob );
- if ( !$batches ) {
- wfProfileOut( __METHOD__ );
- return;
- }
- $jobs = array();
- foreach ( $batches as $batch ) {
- list( $start, $end ) = $batch;
- $params = array(
- 'table' => 'templatelinks',
- 'start' => $start,
- 'end' => $end,
+ if ( $this->mTitle->getBacklinkCache()->hasLinks( 'templatelinks' ) ) {
+ $job = new RefreshLinksJob2(
+ $this->mTitle,
+ array(
+ 'table' => 'templatelinks',
+ ) + Job::newRootJobParams( // "overall" refresh links job info
+ "refreshlinks:templatelinks:{$this->mTitle->getPrefixedText()}"
+ )
);
- $jobs[] = new RefreshLinksJob2( $this->mTitle, $params );
+ JobQueueGroup::singleton()->push( $job );
+ JobQueueGroup::singleton()->deduplicateRootJob( $job );
}
- Job::batchInsert( $jobs );
wfProfileOut( __METHOD__ );
}
}
if ( count( $insertions ) ) {
$this->mDb->insert( $table, $insertions, __METHOD__, 'IGNORE' );
+ wfRunHooks( 'LinksUpdateAfterInsert', array( $this, $table, $insertions ) );
}
}
* Constructor
*
* @param $page WikiPage Page we are updating
+ * @throws MWException
*/
function __construct( WikiPage $page ) {
parent::__construct( false ); // no implicit transaction
$this->mPage = $page;
- if ( !$page->getId() ) {
+ if ( !$page->exists() ) {
throw new MWException( "Page ID not known, perhaps the page doesn't exist?" );
}
}