Profiler::instance()->getTransactionProfiler()->resetExpectations();
// Do any deferred jobs
- DeferredUpdates::doUpdates( 'commit' );
+ DeferredUpdates::doUpdates( 'commit', 'enqueue' );
// Make sure any lazy jobs are pushed
JobQueueGroup::pushLazyJobs();
* Do any deferred updates and clear the list
*
* @param string $commit Set to 'commit' to commit after every update to
+ * @param string $mode Use "enqueue" to use the job queue when possible [Default: run]
* prevent lock contention
*/
- public static function doUpdates( $commit = '' ) {
+ public static function doUpdates( $commit = '', $mode = 'run' ) {
$updates = self::$updates;
while ( count( $updates ) ) {
}
// Delegate DataUpdate execution to the DataUpdate class
- DataUpdate::runUpdates( $dataUpdates, 'run' );
+ DataUpdate::runUpdates( $dataUpdates, $mode );
// Execute the non-DataUpdate tasks
foreach ( $otherUpdates as $update ) {
try {
$update->doUpdate();
-
if ( $commit === 'commit' ) {
wfGetLBFactory()->commitMasterChanges();
}
*
* @todo document (e.g. one-sentence top-level class description).
*/
-class LinksUpdate extends SqlDataUpdate {
+class LinksUpdate extends SqlDataUpdate implements EnqueueableDataUpdate {
// @todo make members protected, but make sure extensions don't break
/** @var int Page ID of the article linked from */
);
}
}
+
+ public function getAsJobSpecification() {
+ return array(
+ 'wiki' => $this->mDb->getWikiID(),
+ 'job' => new JobSpecification(
+ 'refreshLinks',
+ array( 'prioritize' => true ),
+ array( 'removeDuplicates' => true ),
+ $this->getTitle()
+ )
+ );
+ }
}
// Delete pagelinks, update secondary indexes, etc
$updates = $this->getDeletionUpdates( $content );
- // Make sure an enqueued jobs run after commit so they see the deletion
- wfGetDB( DB_MASTER )->onTransactionIdle( function() use ( $updates ) {
- DataUpdate::runUpdates( $updates, 'enqueue' );
- } );
+ foreach ( $updates as $update ) {
+ DeferredUpdates::addUpdate( $update );
+ }
// Reparse any pages transcluding this page
LinksUpdate::queueRecursiveJobsForTable( $this->mTitle, 'templatelinks' );