Avoid usage of deprecated $wgContLang global (dep in 1.32)

Change-Id: I1c3d9b6d9de3c7ef24f24f45aad9510be3f8b588
This commit is contained in:
Derick Alangi 2019-09-02 09:54:59 +01:00
parent a2611d784f
commit aab9a97c96

View file

@ -6,6 +6,8 @@
* @ingroup Extensions * @ingroup Extensions
*/ */
use MediaWiki\MediaWikiServices;
/** /**
* InputBox class * InputBox class
*/ */
@ -128,7 +130,7 @@ class InputBox {
* @return string HTML * @return string HTML
*/ */
public function getSearchForm( $type ) { public function getSearchForm( $type ) {
global $wgContLang, $wgNamespaceAliases; global $wgNamespaceAliases;
// Use button label fallbacks // Use button label fallbacks
if ( !$this->mButtonLabel ) { if ( !$this->mButtonLabel ) {
@ -189,8 +191,9 @@ class InputBox {
// Determine namespace checkboxes // Determine namespace checkboxes
$namespacesArray = explode( ',', $this->mNamespaces ); $namespacesArray = explode( ',', $this->mNamespaces );
if ( $this->mNamespaces ) { if ( $this->mNamespaces ) {
$namespaces = $wgContLang->getNamespaces(); $contLang = MediaWikiServices::getInstance()->getContentLanguage();
$nsAliases = array_merge( $wgContLang->getNamespaceAliases(), $wgNamespaceAliases ); $namespaces = $contLang->getNamespaces();
$nsAliases = array_merge( $contLang->getNamespaceAliases(), $wgNamespaceAliases );
$showNamespaces = []; $showNamespaces = [];
$checkedNS = []; $checkedNS = [];
// Check for valid namespaces // Check for valid namespaces