From: Fomafix Date: Tue, 27 Aug 2019 10:29:39 +0000 (+0200) Subject: Use ->getTitle() instead of ->mTitle to get the title from Parser X-Git-Tag: 1.34.0-rc.0~561^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22brouteur%22%2C%28%24id_rubrique%20?a=commitdiff_plain;h=d2b0f2960b654ea774326dcacf128894c75bc88c;p=lhc%2Fweb%2Fwiklou.git Use ->getTitle() instead of ->mTitle to get the title from Parser This allows to make mTitle a private property. Change-Id: If953546cf4bb0324e4ae41d2195254c37c0ad3b4 --- diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php index a7916c5796..e1f4f38a59 100644 --- a/includes/parser/CoreParserFunctions.php +++ b/includes/parser/CoreParserFunctions.php @@ -434,7 +434,7 @@ class CoreParserFunctions { if ( !$wgRestrictDisplayTitle || ( $title instanceof Title && !$title->hasFragment() - && $title->equals( $parser->mTitle ) ) + && $title->equals( $parser->getTitle() ) ) ) { $old = $parser->mOutput->getProperty( 'displaytitle' ); if ( $old === false || $arg !== 'displaytitle_noreplace' ) { @@ -845,10 +845,7 @@ class CoreParserFunctions { * @return string */ public static function protectionlevel( $parser, $type = '', $title = '' ) { - $titleObject = Title::newFromText( $title ); - if ( !( $titleObject instanceof Title ) ) { - $titleObject = $parser->mTitle; - } + $titleObject = Title::newFromText( $title ) ?? $parser->getTitle(); if ( $titleObject->areRestrictionsLoaded() || $parser->incrementExpensiveFunctionCount() ) { $restrictions = $titleObject->getRestrictions( strtolower( $type ) ); # Title::getRestrictions returns an array, its possible it may have @@ -871,10 +868,7 @@ class CoreParserFunctions { * @return string */ public static function protectionexpiry( $parser, $type = '', $title = '' ) { - $titleObject = Title::newFromText( $title ); - if ( !( $titleObject instanceof Title ) ) { - $titleObject = $parser->mTitle; - } + $titleObject = Title::newFromText( $title ) ?? $parser->getTitle(); if ( $titleObject->areRestrictionsLoaded() || $parser->incrementExpensiveFunctionCount() ) { $expiry = $titleObject->getRestrictionExpiry( strtolower( $type ) ); // getRestrictionExpiry() returns false on invalid type; trying to @@ -1377,10 +1371,7 @@ class CoreParserFunctions { * @since 1.23 */ public static function cascadingsources( $parser, $title = '' ) { - $titleObject = Title::newFromText( $title ); - if ( !( $titleObject instanceof Title ) ) { - $titleObject = $parser->mTitle; - } + $titleObject = Title::newFromText( $title ) ?? $parser->getTitle(); if ( $titleObject->areCascadeProtectionSourcesLoaded() || $parser->incrementExpensiveFunctionCount() ) { diff --git a/includes/parser/PPFrame_DOM.php b/includes/parser/PPFrame_DOM.php index 452bab1259..e3c12eb597 100644 --- a/includes/parser/PPFrame_DOM.php +++ b/includes/parser/PPFrame_DOM.php @@ -70,7 +70,7 @@ class PPFrame_DOM implements PPFrame { public function __construct( $preprocessor ) { $this->preprocessor = $preprocessor; $this->parser = $preprocessor->parser; - $this->title = $this->parser->mTitle; + $this->title = $this->parser->getTitle(); $this->titleCache = [ $this->title ? $this->title->getPrefixedDBkey() : false ]; $this->loopCheckHash = []; $this->depth = 0; diff --git a/includes/parser/PPFrame_Hash.php b/includes/parser/PPFrame_Hash.php index 845ec73c7e..f38cb06968 100644 --- a/includes/parser/PPFrame_Hash.php +++ b/includes/parser/PPFrame_Hash.php @@ -69,7 +69,7 @@ class PPFrame_Hash implements PPFrame { public function __construct( $preprocessor ) { $this->preprocessor = $preprocessor; $this->parser = $preprocessor->parser; - $this->title = $this->parser->mTitle; + $this->title = $this->parser->getTitle(); $this->titleCache = [ $this->title ? $this->title->getPrefixedDBkey() : false ]; $this->loopCheckHash = []; $this->depth = 0;