From d68257cbeec8b201482b750e64413f2ec5b846c5 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 3 Dec 2013 09:24:15 -0800 Subject: [PATCH] Make sure $content is always defined * Fixes 48a77e1 bug: 57916 Change-Id: I3cc0f36467da31a668bf27d5033555fa59e43c39 --- includes/job/jobs/RefreshLinksJob.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/includes/job/jobs/RefreshLinksJob.php b/includes/job/jobs/RefreshLinksJob.php index e5f3ce5d14..e81998d875 100644 --- a/includes/job/jobs/RefreshLinksJob.php +++ b/includes/job/jobs/RefreshLinksJob.php @@ -119,6 +119,18 @@ class RefreshLinksJob extends Job { wfGetLB()->waitFor( $this->params['masterPos'] ); } + // Fetch the current revision... + $revision = Revision::newFromTitle( $title, false, Revision::READ_NORMAL ); + if ( !$revision ) { + $this->setLastError( "refreshLinks: Article not found {$title->getPrefixedDBkey()}" ); + return false; // XXX: what if it was just deleted? + } + $content = $revision->getContent( Revision::RAW ); + if ( !$content ) { + // If there is no content, pretend the content is empty + $content = $revision->getContentHandler()->makeEmptyContent(); + } + $parserOutput = false; // If page_touched changed after this root job (with a good slave lag skew factor), // then it is likely that any views of the pages already resulted in re-parses which @@ -136,18 +148,6 @@ class RefreshLinksJob extends Job { } // Fetch the current revision and parse it if necessary... if ( $parserOutput == false ) { - $revision = Revision::newFromTitle( $title, false, Revision::READ_NORMAL ); - if ( !$revision ) { - $this->setLastError( "refreshLinks: Article not found {$title->getPrefixedDBkey()}" ); - return false; // XXX: what if it was just deleted? - } - - $content = $revision->getContent( Revision::RAW ); - if ( !$content ) { - // If there is no content, pretend the content is empty - $content = $revision->getContentHandler()->makeEmptyContent(); - } - // Revision ID must be passed to the parser output to get revision variables correct $parserOutput = $content->getParserOutput( $title, $revision->getId(), null, false ); } -- 2.20.1