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

This reverts commit b3fb04b463.

The problem is *not* getContextTitle() - that's the correct
function to call here. The problem is that something is creating
an EditPage instance without calling setContextTitle() - that's
what needs to be fixed.

Change-Id: Ibc8280c7434bee4c4697142bcdbc1194f00c53c1
This commit is contained in:
Legoktm 2020-01-01 23:16:28 +00:00
parent b3fb04b463
commit 212477a083
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 );