Fix parsing from CLI; bumped to version 2.23

Removed references to $wgTitle, $wgUser, and $wgLang.

Follows-up r113297 and I2d9724314f94c216650370071b31390c5c2c97fc.

Bug: 53563
Change-Id: I07fb6939d16a18ecf367ee34ebc176fdc5634dd7
This commit is contained in:
Kevin Israel 2013-09-03 00:55:09 -04:00 committed by Wikinaut
parent f2948e5bee
commit 8e0763a2cb
3 changed files with 19 additions and 8 deletions

View file

@ -27,6 +27,10 @@ git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/RSS.git
The length limitation must be HTML tag-safe, but it is not at the moment.
Length limitation is disabled by default.
=== Version 2.23 2013-09-03 ===
* Fix parsing from CLI:
removed references to $wgTitle, $wgUser, and $wgLang.
=== Version 2.22 2013-06-09 ==
* removing white spaces aroung urls in feed item <link> or <id> tags

View file

@ -14,7 +14,7 @@
* @link http://www.mediawiki.org/wiki/Extension:RSS Documentation
*/
define( "EXTENSION_RSS_VERSION", "2.22" );
define( "EXTENSION_RSS_VERSION", "2.23" );
if ( !defined( 'MEDIAWIKI' ) ) {
die( "This is not a valid entry point.\n" );

View file

@ -290,11 +290,19 @@ class RSSParser {
return $ret;
}
function sandboxParse($wikiText) {
global $wgTitle, $wgUser;
/**
* @see https://bugzilla.wikimedia.org/show_bug.cgi?id=34763
* @param string $wikiText
* @param Parser $origParser
* @return string
*/
protected function sandboxParse( $wikiText, $origParser ) {
$myParser = new Parser();
$myParserOptions = ParserOptions::newFromUser($wgUser);
$result = $myParser->parse($wikiText, $wgTitle, $myParserOptions);
$result = $myParser->parse(
$wikiText,
$origParser->getTitle(),
$origParser->getOptions()
);
return $result->getText();
}
@ -328,7 +336,7 @@ class RSSParser {
}
}
$renderedFeed = $this->sandboxParse( $renderedFeed );
$renderedFeed = $this->sandboxParse( $renderedFeed, $parser );
}
@ -376,8 +384,7 @@ class RSSParser {
break;
default:
$str = $this->escapeTemplateParameter( $item[$info] );
global $wgLang;
$str = $wgLang->truncate( $str, $this->ItemMaxLength );
$str = $parser->getFunctionLang()->truncate( $str, $this->ItemMaxLength );
$str = $this->highlightTerms( $str );
$renderedItem = str_replace( '{{{' . $info . '}}}', $parser->insertStripItem( $str ), $renderedItem );
}