Merge "Stop using the unholy trinity in DatabaseError"
[lhc/web/wiklou.git] / includes / job / jobs / RefreshLinksJob.php
index d8526ee..78ac84d 100644 (file)
@@ -133,6 +133,10 @@ class RefreshLinksJob extends Job {
                if ( isset( $this->params['rootJobTimestamp'] ) ) {
                        $page = WikiPage::factory( $title );
                        $skewedTimestamp = wfTimestamp( TS_UNIX, $this->params['rootJobTimestamp'] ) + 5;
+                       if ( $page->getLinksTimestamp() > wfTimestamp( TS_MW, $skewedTimestamp ) ) {
+                               // Something already updated the backlinks since this job was made
+                               return true;
+                       }
                        if ( $page->getTouched() > wfTimestamp( TS_MW, $skewedTimestamp ) ) {
                                $parserOptions = $page->makeParserOptions( 'canonical' );
                                $parserOutput = ParserCache::singleton()->getDirty( $page, $parserOptions );
@@ -170,4 +174,8 @@ class RefreshLinksJob extends Job {
 
                return $info;
        }
+
+       public function workItemCount() {
+               return isset( $this->params['pages'] ) ? count( $this->params['pages'] ) : 1;
+       }
 }