Drop wgContLang, deprecated in 1.32
Bug: T245940 Depends-On: Ib7fe7318100c0aadc3aa759416bf787913a9b788 Change-Id: I75c3b6715abd5eaf3619337cab8b1844e9a8349a
This commit is contained in:
parent
c58f3ba2e9
commit
bdddfb92ba
8 changed files with 16 additions and 25 deletions
|
|
@ -16,7 +16,6 @@
|
||||||
<exclude name="MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName" />
|
<exclude name="MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName" />
|
||||||
<exclude name="MediaWiki.PHPUnit.AssertCount.NotUsed" />
|
<exclude name="MediaWiki.PHPUnit.AssertCount.NotUsed" />
|
||||||
<exclude name="MediaWiki.Usage.DbrQueryUsage.DbrQueryFound" />
|
<exclude name="MediaWiki.Usage.DbrQueryUsage.DbrQueryFound" />
|
||||||
<exclude name="MediaWiki.Usage.DeprecatedGlobalVariables.Deprecated$wgContLang" />
|
|
||||||
<exclude name="MediaWiki.Usage.DeprecatedGlobalVariables.Deprecated$wgTitle" />
|
<exclude name="MediaWiki.Usage.DeprecatedGlobalVariables.Deprecated$wgTitle" />
|
||||||
<exclude name="MediaWiki.Usage.DeprecatedGlobalVariables.Deprecated$wgUser" />
|
<exclude name="MediaWiki.Usage.DeprecatedGlobalVariables.Deprecated$wgUser" />
|
||||||
<exclude name="MediaWiki.Usage.DeprecatedGlobalVariables.Deprecated$wgVersion" />
|
<exclude name="MediaWiki.Usage.DeprecatedGlobalVariables.Deprecated$wgVersion" />
|
||||||
|
|
|
||||||
|
|
@ -400,6 +400,8 @@ because of Phabricator reports.
|
||||||
* Command::execute() now returns a Shellbox\Command\UnboxedResult instead of a
|
* Command::execute() now returns a Shellbox\Command\UnboxedResult instead of a
|
||||||
MediaWiki\Shell\Result. Any type hints should be updated.
|
MediaWiki\Shell\Result. Any type hints should be updated.
|
||||||
* ObjectCache::detectLocalServerCache(), deprecated in 1.35, was removed.
|
* ObjectCache::detectLocalServerCache(), deprecated in 1.35, was removed.
|
||||||
|
* The $wgContLang variable, deprecated in 1.32, was removed. You can instead use
|
||||||
|
MediaWikiServices::getInstance()->getContentLanguage().
|
||||||
* …
|
* …
|
||||||
|
|
||||||
=== Deprecations in 1.36 ===
|
=== Deprecations in 1.36 ===
|
||||||
|
|
|
||||||
|
|
@ -52,9 +52,6 @@ $wgUser
|
||||||
$wgLang
|
$wgLang
|
||||||
Language object selected by user preferences.
|
Language object selected by user preferences.
|
||||||
|
|
||||||
$wgContLang
|
|
||||||
Language object associated with the wiki being viewed.
|
|
||||||
|
|
||||||
$wgParser
|
$wgParser
|
||||||
Parser object. Parser extensions used to register their hooks here;
|
Parser object. Parser extensions used to register their hooks here;
|
||||||
modern code should use the ParserFirstCallInit hook.
|
modern code should use the ParserFirstCallInit hook.
|
||||||
|
|
|
||||||
|
|
@ -695,12 +695,6 @@ if ( $wgRequest->getCookie( 'UseDC', '' ) === 'master' ) {
|
||||||
// Most of the config is out, some might want to run hooks here.
|
// Most of the config is out, some might want to run hooks here.
|
||||||
Hooks::runner()->onSetupAfterCache();
|
Hooks::runner()->onSetupAfterCache();
|
||||||
|
|
||||||
/**
|
|
||||||
* @var Language $wgContLang
|
|
||||||
* @deprecated since 1.32, use the ContentLanguage service directly
|
|
||||||
*/
|
|
||||||
$wgContLang = MediaWikiServices::getInstance()->getContentLanguage();
|
|
||||||
|
|
||||||
// Now that variant lists may be available...
|
// Now that variant lists may be available...
|
||||||
$wgRequest->interpolateTitle();
|
$wgRequest->interpolateTitle();
|
||||||
|
|
||||||
|
|
@ -723,6 +717,8 @@ if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||||
|
|
||||||
// Initialize the session
|
// Initialize the session
|
||||||
try {
|
try {
|
||||||
$session = MediaWiki\Session\SessionManager::getGlobalSession();
|
$session = MediaWiki\Session\SessionManager::getGlobalSession();
|
||||||
|
|
@ -731,14 +727,16 @@ if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
|
||||||
// sessions tied for top priority. Report this to the user.
|
// sessions tied for top priority. Report this to the user.
|
||||||
$list = [];
|
$list = [];
|
||||||
foreach ( $ex->getSessionInfos() as $info ) {
|
foreach ( $ex->getSessionInfos() as $info ) {
|
||||||
$list[] = $info->getProvider()->describe( $wgContLang );
|
$list[] = $info->getProvider()->describe( $contLang );
|
||||||
}
|
}
|
||||||
$list = $wgContLang->listToText( $list );
|
$list = $contLang->listToText( $list );
|
||||||
throw new HttpError( 400,
|
throw new HttpError( 400,
|
||||||
Message::newFromKey( 'sessionmanager-tie', $list )->inLanguage( $wgContLang )
|
Message::newFromKey( 'sessionmanager-tie', $list )->inLanguage( $contLang )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unset( $contLang );
|
||||||
|
|
||||||
if ( $session->isPersistent() ) {
|
if ( $session->isPersistent() ) {
|
||||||
$wgInitialSessionId = $session->getSessionId();
|
$wgInitialSessionId = $session->getSessionId();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ class CliInstaller extends Installer {
|
||||||
* @throws InstallException
|
* @throws InstallException
|
||||||
*/
|
*/
|
||||||
public function __construct( $siteName, $admin = null, array $options = [] ) {
|
public function __construct( $siteName, $admin = null, array $options = [] ) {
|
||||||
global $wgContLang, $wgPasswordPolicy;
|
global $wgPasswordPolicy;
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
|
|
@ -75,7 +75,6 @@ class CliInstaller extends Installer {
|
||||||
$this->setVar( '_UserLang', $options['lang'] );
|
$this->setVar( '_UserLang', $options['lang'] );
|
||||||
$wgLanguageCode = $options['lang'];
|
$wgLanguageCode = $options['lang'];
|
||||||
$this->setVar( 'wgLanguageCode', $wgLanguageCode );
|
$this->setVar( 'wgLanguageCode', $wgLanguageCode );
|
||||||
$wgContLang = MediaWikiServices::getInstance()->getContentLanguage();
|
|
||||||
$wgLang = MediaWikiServices::getInstance()->getLanguageFactory()
|
$wgLang = MediaWikiServices::getInstance()->getLanguageFactory()
|
||||||
->getLanguage( $options['lang'] );
|
->getLanguage( $options['lang'] );
|
||||||
RequestContext::getMain()->setLanguage( $wgLang );
|
RequestContext::getMain()->setLanguage( $wgLang );
|
||||||
|
|
@ -83,7 +82,8 @@ class CliInstaller extends Installer {
|
||||||
|
|
||||||
$this->setVar( 'wgSitename', $siteName );
|
$this->setVar( 'wgSitename', $siteName );
|
||||||
|
|
||||||
$metaNS = $wgContLang->ucfirst( str_replace( ' ', '_', $siteName ) );
|
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||||
|
$metaNS = $contLang->ucfirst( str_replace( ' ', '_', $siteName ) );
|
||||||
if ( $metaNS == 'MediaWiki' ) {
|
if ( $metaNS == 'MediaWiki' ) {
|
||||||
$metaNS = 'Project';
|
$metaNS = 'Project';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -499,7 +499,7 @@ class WebInstaller extends Installer {
|
||||||
* Initializes language-related variables.
|
* Initializes language-related variables.
|
||||||
*/
|
*/
|
||||||
public function setupLanguage() {
|
public function setupLanguage() {
|
||||||
global $wgLang, $wgContLang, $wgLanguageCode;
|
global $wgLang, $wgLanguageCode;
|
||||||
|
|
||||||
if ( $this->getSession( 'test' ) === null && !$this->request->wasPosted() ) {
|
if ( $this->getSession( 'test' ) === null && !$this->request->wasPosted() ) {
|
||||||
$wgLanguageCode = $this->getAcceptLanguage();
|
$wgLanguageCode = $this->getAcceptLanguage();
|
||||||
|
|
@ -511,7 +511,6 @@ class WebInstaller extends Installer {
|
||||||
} else {
|
} else {
|
||||||
$wgLanguageCode = $this->getVar( 'wgLanguageCode' );
|
$wgLanguageCode = $this->getVar( 'wgLanguageCode' );
|
||||||
}
|
}
|
||||||
$wgContLang = MediaWikiServices::getInstance()->getContentLanguage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1251,7 +1251,6 @@ class ParserTestRunner {
|
||||||
// In addition the ParserFactory needs to be recreated as well.
|
// In addition the ParserFactory needs to be recreated as well.
|
||||||
$lang = MediaWikiServices::getInstance()->getLanguageFactory()->getLanguage( $langCode );
|
$lang = MediaWikiServices::getInstance()->getLanguageFactory()->getLanguage( $langCode );
|
||||||
$lang->resetNamespaces();
|
$lang->resetNamespaces();
|
||||||
$setup['wgContLang'] = $lang;
|
|
||||||
$setup[] = static function () use ( $lang ) {
|
$setup[] = static function () use ( $lang ) {
|
||||||
MediaWikiServices::getInstance()->disableService( 'ContentLanguage' );
|
MediaWikiServices::getInstance()->disableService( 'ContentLanguage' );
|
||||||
MediaWikiServices::getInstance()->redefineService(
|
MediaWikiServices::getInstance()->redefineService(
|
||||||
|
|
@ -1310,7 +1309,6 @@ class ParserTestRunner {
|
||||||
|
|
||||||
// Reset context to the restored globals
|
// Reset context to the restored globals
|
||||||
$context->setUser( $GLOBALS['wgUser'] );
|
$context->setUser( $GLOBALS['wgUser'] );
|
||||||
$context->setLanguage( $GLOBALS['wgContLang'] );
|
|
||||||
$context->setSkin( $oldSkin );
|
$context->setSkin( $oldSkin );
|
||||||
$context->setOutput( $GLOBALS['wgOut'] );
|
$context->setOutput( $GLOBALS['wgOut'] );
|
||||||
};
|
};
|
||||||
|
|
@ -1707,7 +1705,6 @@ class ParserTestRunner {
|
||||||
if ( $services->getContentLanguage()->getCode() !== 'en' ) {
|
if ( $services->getContentLanguage()->getCode() !== 'en' ) {
|
||||||
$setup['wgLanguageCode'] = 'en';
|
$setup['wgLanguageCode'] = 'en';
|
||||||
$lang = $services->getLanguageFactory()->getLanguage( 'en' );
|
$lang = $services->getLanguageFactory()->getLanguage( 'en' );
|
||||||
$setup['wgContLang'] = $lang;
|
|
||||||
$setup[] = static function () use ( $lang ) {
|
$setup[] = static function () use ( $lang ) {
|
||||||
$services = MediaWikiServices::getInstance();
|
$services = MediaWikiServices::getInstance();
|
||||||
$services->disableService( 'ContentLanguage' );
|
$services->disableService( 'ContentLanguage' );
|
||||||
|
|
|
||||||
|
|
@ -1131,19 +1131,18 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace legacy globals like $wgParser and $wgContLang with fresh ones so they pick up any
|
* Replace legacy global $wgParser with a fresh one so it picks up any
|
||||||
* config changes. They're deprecated, but we still support them for now.
|
* config changes. It's deprecated, but we still support it for now.
|
||||||
*/
|
*/
|
||||||
private static function resetLegacyGlobals() {
|
private static function resetLegacyGlobals() {
|
||||||
// phpcs:ignore MediaWiki.Usage.DeprecatedGlobalVariables.Deprecated$wgParser
|
// phpcs:ignore MediaWiki.Usage.DeprecatedGlobalVariables.Deprecated$wgParser
|
||||||
global $wgParser, $wgContLang;
|
global $wgParser;
|
||||||
// We don't have to replace the parser if it wasn't unstubbed
|
// We don't have to replace the parser if it wasn't unstubbed
|
||||||
if ( !( $wgParser instanceof StubObject ) ) {
|
if ( !( $wgParser instanceof StubObject ) ) {
|
||||||
$wgParser = new StubObject( 'wgParser', static function () {
|
$wgParser = new StubObject( 'wgParser', static function () {
|
||||||
return MediaWikiServices::getInstance()->getParser();
|
return MediaWikiServices::getInstance()->getParser();
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
$wgContLang = MediaWikiServices::getInstance()->getContentLanguage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue