From 6d3b7ce7823e99d50f9ba62771b44ffe8ac8c6e8 Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Sun, 6 Feb 2022 13:11:38 +0100 Subject: [PATCH] Replace deprecated ParserOutput::getProperty Change-Id: I9278120212bcd0c003af899ce9602c292edac947 --- includes/Description2.php | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/includes/Description2.php b/includes/Description2.php index c14e74d..8bb1ab6 100644 --- a/includes/Description2.php +++ b/includes/Description2.php @@ -27,10 +27,18 @@ class Description2 { */ public static function setDescription( Parser $parser, $desc ) { $parserOutput = $parser->getOutput(); - if ( $parserOutput->getProperty( 'description' ) !== false ) { - return; + if ( method_exists( $parserOutput, 'getPageProperty' ) ) { + // 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 ) { // 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 ) { $out->addMeta( 'description', $description ); }