aboutsummaryrefslogtreecommitdiffstats
path: root/includes/content
diff options
context:
space:
mode:
authorAaron Schulz <aschulz@wikimedia.org>2024-01-14 21:04:04 -0800
committerBartosz DziewoƄski <dziewonski@fastmail.fm>2024-01-15 17:58:55 +0000
commitb509d763295f489bdc7e5625cd98bcb9cdad89fa (patch)
treed08c3e790c3342e37616c9b3d8d8eec1d2d8303a /includes/content
parenta4f585537757171260054c9103718c350c05e187 (diff)
downloadmediawikicore-b509d763295f489bdc7e5625cd98bcb9cdad89fa.tar.gz
mediawikicore-b509d763295f489bdc7e5625cd98bcb9cdad89fa.zip
Stop unstubbing and passing $wgLang to onPageContentLanguage hook handlers
All handlers in WMF-hosted repos no longer make use of nor type-hint against this field. For compatibility with such handlers, pass null and document the value as being deprecated and of type mixed. Bug: T299369 Change-Id: Ie192beb6018ed40e2bc1920b23802ea62d1b105c
Diffstat (limited to 'includes/content')
-rw-r--r--includes/content/ContentHandler.php10
-rw-r--r--includes/content/Hook/PageContentLanguageHook.php2
2 files changed, 4 insertions, 8 deletions
diff --git a/includes/content/ContentHandler.php b/includes/content/ContentHandler.php
index b11b998f5c08..29e9fbae9066 100644
--- a/includes/content/ContentHandler.php
+++ b/includes/content/ContentHandler.php
@@ -44,7 +44,6 @@ use MediaWiki\Revision\RevisionRecord;
use MediaWiki\Revision\SlotRecord;
use MediaWiki\Revision\SlotRenderingProvider;
use MediaWiki\Search\ParserOutputSearchDataExtractor;
-use MediaWiki\StubObject\StubObject;
use MediaWiki\Title\Title;
use Wikimedia\Assert\Assert;
use Wikimedia\ScopedCallback;
@@ -734,7 +733,6 @@ abstract class ContentHandler {
* @return Language
*/
public function getPageLanguage( Title $title, Content $content = null ) {
- global $wgLang;
$services = MediaWikiServices::getInstance();
$pageLang = $services->getContentLanguage();
@@ -744,11 +742,9 @@ abstract class ContentHandler {
$pageLang = $services->getLanguageFactory()->getLanguage( $lang );
}
- // Simplify hook handlers by only passing objects of one type, in case nothing
- // else has unstubbed the MediaWiki\StubObject\StubUserLang object by now.
- StubObject::unstub( $wgLang );
-
- $this->getHookRunner()->onPageContentLanguage( $title, $pageLang, $wgLang );
+ // Unused, T299369
+ $userLang = null;
+ $this->getHookRunner()->onPageContentLanguage( $title, $pageLang, $userLang );
if ( !$pageLang instanceof Language ) {
throw new MWException( 'onPageContentLanguage() hook provided an invalid $pageLang object.' );
diff --git a/includes/content/Hook/PageContentLanguageHook.php b/includes/content/Hook/PageContentLanguageHook.php
index f8c4975eb253..8a96f0fb7d04 100644
--- a/includes/content/Hook/PageContentLanguageHook.php
+++ b/includes/content/Hook/PageContentLanguageHook.php
@@ -21,7 +21,7 @@ interface PageContentLanguageHook {
*
* @param Title $title
* @param Language &$pageLang Page content language
- * @param Language $userLang User language
+ * @param mixed $userLang Unused (always null), T299369
* @return bool|void True or no return value to continue or false to abort
*/
public function onPageContentLanguage( $title, &$pageLang, $userLang );