Merge "MessagesGom_deva: Correct syntax in namespace alias"
[lhc/web/wiklou.git] / includes / jobqueue / jobs / DeleteLinksJob.php
index 9767d9f..f39f8fd 100644 (file)
@@ -42,15 +42,21 @@ class DeleteLinksJob extends Job {
                }
 
                $pageId = $this->params['pageId'];
+
+               // Serialize links updates by page ID so they see each others' changes
+               $scopedLock = LinksUpdate::acquirePageLock( wfGetDB( DB_MASTER ), $pageId, 'job' );
+
                if ( WikiPage::newFromID( $pageId, WikiPage::READ_LATEST ) ) {
                        // The page was restored somehow or something went wrong
                        $this->setLastError( "deleteLinks: Page #$pageId exists" );
                        return false;
                }
 
+               $timestamp = isset( $this->params['timestamp'] ) ? $this->params['timestamp'] : null;
+
                $page = WikiPage::factory( $this->title ); // title when deleted
-               $update = new LinksDeletionUpdate( $page, $pageId );
-               DataUpdate::runUpdates( array( $update ) );
+               $update = new LinksDeletionUpdate( $page, $pageId, $timestamp );
+               DataUpdate::runUpdates( [ $update ] );
 
                return true;
        }