Merge "Revert "Directly use $wgTitle instead of relying on getContextTitle fallback""

This commit is contained in:
jenkins-bot 2020-01-01 23:31:56 +00:00 committed by Gerrit Code Review
commit d75911245e
2 changed files with 3 additions and 6 deletions

View file

@ -1,8 +1,6 @@
<?xml version="1.0"?>
<ruleset>
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
<exclude name="MediaWiki.Usage.DeprecatedGlobalVariables.Deprecated$wgTitle" />
</rule>
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki" />
<file>.</file>
<arg name="extensions" value="php,php5,inc" />
<arg name="encoding" value="UTF-8" />

View file

@ -41,12 +41,11 @@ class CodeEditorHooks {
* @throws ErrorPageError
*/
public static function editPageShowEditFormInitial( EditPage $editpage, OutputPage $output ) {
global $wgTitle;
$title = $editpage->getContextTitle();
$model = $editpage->contentModel;
$format = $editpage->contentFormat;
$lang = self::getPageLanguage( $wgTitle, $model, $format );
$lang = self::getPageLanguage( $title, $model, $format );
if ( $lang && $output->getUser()->getOption( 'usebetatoolbar' ) ) {
$output->addModules( 'ext.codeEditor' );
$output->addJsConfigVars( 'wgCodeEditorCurrentLanguage', $lang );