Skip to content

Commit

Permalink
Merge pull request #420 from SemanticMediaWiki/bug-62856
Browse files Browse the repository at this point in the history
MW 1.24+ / Hotfix for missing Redirect caused by bug 62856
  • Loading branch information
JeroenDeDauw committed Jul 18, 2014
2 parents e399b95 + 682cbec commit 87c8436
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
16 changes: 15 additions & 1 deletion includes/ContentParser.php
Expand Up @@ -37,6 +37,11 @@ class ContentParser {
/** @var array */
protected $errors = array();

/**
* @var boolean
*/
private $enabledToUseContentHandler = true;

/**
* @note Injecting new Parser() alone will not yield an expected result and
* doing new Parser( $GLOBALS['wgParserConf'] brings no benefits therefore
Expand Down Expand Up @@ -66,6 +71,15 @@ public function setRevision( Revision $revision = null ) {
return $this;
}

/**
* @bug 62856 and #212
*
* @since 2.0
*/
public function forceToUseParser() {
$this->enabledToUseContentHandler = false;
}

/**
* @since 1.9
*
Expand Down Expand Up @@ -108,7 +122,7 @@ public function parse( $text = null ) {
return $this->parseText( $text );
}

if ( $this->hasContentHandler() ) {
if ( $this->hasContentHandler() && $this->enabledToUseContentHandler ) {
return $this->fetchFromContent();
}

Expand Down
1 change: 1 addition & 0 deletions includes/src/MediaWiki/Jobs/UpdateJob.php
Expand Up @@ -103,6 +103,7 @@ private function runContentParser() {
'Title' => $this->getTitle()
) );

$contentParser->forceToUseParser();
$contentParser->parse();

if ( !( $contentParser->getOutput() instanceof ParserOutput ) ) {
Expand Down
1 change: 1 addition & 0 deletions tests/phpunit/Util/PageRefresher.php
Expand Up @@ -55,6 +55,7 @@ public function doRefresh( $title ) {
}

$contentParser = new ContentParser( $title );
$contentParser->forceToUseParser();

$parserData = Application::getInstance()->newParserData(
$title,
Expand Down

0 comments on commit 87c8436

Please sign in to comment.