mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Description2
synced 2024-12-04 02:58:10 +00:00
Replace deprecated ParserOutput::getProperty
Change-Id: I9278120212bcd0c003af899ce9602c292edac947
This commit is contained in:
parent
838ef90fe0
commit
6d3b7ce782
|
@ -27,10 +27,18 @@ class Description2 {
|
||||||
*/
|
*/
|
||||||
public static function setDescription( Parser $parser, $desc ) {
|
public static function setDescription( Parser $parser, $desc ) {
|
||||||
$parserOutput = $parser->getOutput();
|
$parserOutput = $parser->getOutput();
|
||||||
if ( $parserOutput->getProperty( 'description' ) !== false ) {
|
if ( method_exists( $parserOutput, 'getPageProperty' ) ) {
|
||||||
return;
|
// MW 1.38+
|
||||||
|
if ( $parserOutput->getPageProperty( 'description' ) !== false ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$parserOutput->setPageProperty( 'description', $desc );
|
||||||
|
} else {
|
||||||
|
if ( $parserOutput->getProperty( 'description' ) !== false ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$parserOutput->setProperty( 'description', $desc );
|
||||||
}
|
}
|
||||||
$parserOutput->setProperty( 'description', $desc );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -102,7 +110,12 @@ class Description2 {
|
||||||
*/
|
*/
|
||||||
public static function onOutputPageParserOutput( OutputPage &$out, ParserOutput $parserOutput ) {
|
public static function onOutputPageParserOutput( OutputPage &$out, ParserOutput $parserOutput ) {
|
||||||
// Export the description from the main parser output into the OutputPage
|
// Export the description from the main parser output into the OutputPage
|
||||||
$description = $parserOutput->getProperty( 'description' );
|
if ( method_exists( $parserOutput, 'getPageProperty' ) ) {
|
||||||
|
// MW 1.38+
|
||||||
|
$description = $parserOutput->getPageProperty( 'description' );
|
||||||
|
} else {
|
||||||
|
$description = $parserOutput->getProperty( 'description' );
|
||||||
|
}
|
||||||
if ( $description !== false ) {
|
if ( $description !== false ) {
|
||||||
$out->addMeta( 'description', $description );
|
$out->addMeta( 'description', $description );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue