From d552225cc042ba8cc2ab246a7b69061aec6cf47d Mon Sep 17 00:00:00 2001 From: Jack Phoenix Date: Sun, 27 Oct 2024 11:10:35 +0200 Subject: [PATCH] Work around an E_DEPRECATED in MW 1.37+ (#32) Introduces a new method to work around the deprecation warning in MW 1.37+. The new method is essentially the same as ContentHandler#getContentText in core (master) as of today. Closes #29. --- LibertyTemplate.php | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/LibertyTemplate.php b/LibertyTemplate.php index 8584df7d..71cacc5e 100644 --- a/LibertyTemplate.php +++ b/LibertyTemplate.php @@ -883,13 +883,13 @@ protected function parseNavbar() { $skin = $this->getSkin(); $userName = $skin->getUser()->getName(); $userLang = $skin->getLanguage()->mCode; - $globalData = ContentHandler::getContentText( $this->getContentOfTitle( + $globalData = $this->getContentText( $this->getContentOfTitle( Title::newFromText( 'Liberty-Navbar', NS_MEDIAWIKI ) ) ); - $globalLangData = ContentHandler::getContentText( $this->getContentOfTitle( + $globalLangData = $this->getContentText( $this->getContentOfTitle( Title::newFromText( 'Liberty-Navbar/' . $userLang, NS_MEDIAWIKI ) ) ); - $userData = ContentHandler::getContentText( $this->getContentOfTitle( + $userData = $this->getContentText( $this->getContentOfTitle( Title::newFromText( $userName . '/Liberty-Navbar', NS_USER ) ) ); if ( !empty( $userData ) ) { @@ -1241,6 +1241,25 @@ protected function buildAd( $position ) { getText(); + } + + return null; + } + private function getContentOfTitle( Title $title ): ?Content { $page = null;