Mass conversion of $wgContLang to service
Brought to you by vim macros. Bug: T200246 Change-Id: I79e919f4553e3bd3eb714073fed7a43051b4fb2a
This commit is contained in:
parent
8f8851325e
commit
90d4f56fe4
148 changed files with 730 additions and 712 deletions
|
|
@ -221,8 +221,6 @@ class CategoryViewer extends ContextSource {
|
|||
* @return string
|
||||
*/
|
||||
function getSubcategorySortChar( $title, $sortkey ) {
|
||||
global $wgContLang;
|
||||
|
||||
if ( $title->getPrefixedText() == $sortkey ) {
|
||||
$word = $title->getDBkey();
|
||||
} else {
|
||||
|
|
@ -231,7 +229,7 @@ class CategoryViewer extends ContextSource {
|
|||
|
||||
$firstChar = $this->collation->getFirstLetter( $word );
|
||||
|
||||
return $wgContLang->convert( $firstChar );
|
||||
return MediaWikiServices::getInstance()->getContentLanguage()->convert( $firstChar );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -242,7 +240,6 @@ class CategoryViewer extends ContextSource {
|
|||
* @param bool $isRedirect
|
||||
*/
|
||||
function addImage( Title $title, $sortkey, $pageLength, $isRedirect = false ) {
|
||||
global $wgContLang;
|
||||
if ( $this->showGallery ) {
|
||||
$flip = $this->flip['file'];
|
||||
if ( $flip ) {
|
||||
|
|
@ -253,8 +250,8 @@ class CategoryViewer extends ContextSource {
|
|||
} else {
|
||||
$this->imgsNoGallery[] = $this->generateLink( 'image', $title, $isRedirect );
|
||||
|
||||
$this->imgsNoGallery_start_char[] = $wgContLang->convert(
|
||||
$this->collation->getFirstLetter( $sortkey ) );
|
||||
$this->imgsNoGallery_start_char[] = MediaWikiServices::getInstance()->
|
||||
getContentLanguage()->convert( $this->collation->getFirstLetter( $sortkey ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -266,12 +263,10 @@ class CategoryViewer extends ContextSource {
|
|||
* @param bool $isRedirect
|
||||
*/
|
||||
function addPage( $title, $sortkey, $pageLength, $isRedirect = false ) {
|
||||
global $wgContLang;
|
||||
|
||||
$this->articles[] = $this->generateLink( 'page', $title, $isRedirect );
|
||||
|
||||
$this->articles_start_char[] = $wgContLang->convert(
|
||||
$this->collation->getFirstLetter( $sortkey ) );
|
||||
$this->articles_start_char[] = MediaWikiServices::getInstance()->
|
||||
getContentLanguage()->convert( $this->collation->getFirstLetter( $sortkey ) );
|
||||
}
|
||||
|
||||
function finaliseCategoryState() {
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ class CommentStore {
|
|||
|
||||
/**
|
||||
* @param Language $lang Language to use for comment truncation. Defaults
|
||||
* to $wgContLang.
|
||||
* to content language.
|
||||
* @param int $migrationStage One of the MIGRATION_* constants
|
||||
*/
|
||||
public function __construct( Language $lang, $migrationStage ) {
|
||||
|
|
@ -114,10 +114,11 @@ class CommentStore {
|
|||
* @return CommentStore
|
||||
*/
|
||||
public static function newKey( $key ) {
|
||||
global $wgCommentTableSchemaMigrationStage, $wgContLang;
|
||||
global $wgCommentTableSchemaMigrationStage;
|
||||
// TODO uncomment once not used in extensions
|
||||
// wfDeprecated( __METHOD__, '1.31' );
|
||||
$store = new CommentStore( $wgContLang, $wgCommentTableSchemaMigrationStage );
|
||||
$store = new CommentStore( MediaWikiServices::getInstance()->getContentLanguage(),
|
||||
$wgCommentTableSchemaMigrationStage );
|
||||
$store->key = $key;
|
||||
return $store;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
*
|
||||
* @file
|
||||
*/
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* CommentStoreComment represents a comment stored by CommentStore. The fields
|
||||
|
|
@ -63,8 +64,6 @@ class CommentStoreComment {
|
|||
* @return CommentStoreComment
|
||||
*/
|
||||
public static function newUnsavedComment( $comment, array $data = null ) {
|
||||
global $wgContLang;
|
||||
|
||||
if ( $comment instanceof CommentStoreComment ) {
|
||||
return $comment;
|
||||
}
|
||||
|
|
@ -79,7 +78,8 @@ class CommentStoreComment {
|
|||
|
||||
if ( $comment instanceof Message ) {
|
||||
$message = clone $comment;
|
||||
$text = $message->inLanguage( $wgContLang ) // Avoid $wgForceUIMsgAsContentMsg
|
||||
// Avoid $wgForceUIMsgAsContentMsg
|
||||
$text = $message->inLanguage( MediaWikiServices::getInstance()->getContentLanguage() )
|
||||
->setInterfaceMessageFlag( true )
|
||||
->text();
|
||||
return new CommentStoreComment( null, $text, $message, $data );
|
||||
|
|
|
|||
|
|
@ -1171,8 +1171,6 @@ class EditPage {
|
|||
* @since 1.21
|
||||
*/
|
||||
protected function getContentObject( $def_content = null ) {
|
||||
global $wgContLang;
|
||||
|
||||
$content = false;
|
||||
|
||||
$user = $this->context->getUser();
|
||||
|
|
@ -1235,7 +1233,8 @@ class EditPage {
|
|||
|
||||
if ( $undoMsg === null ) {
|
||||
$oldContent = $this->page->getContent( Revision::RAW );
|
||||
$popts = ParserOptions::newFromUserAndLang( $user, $wgContLang );
|
||||
$popts = ParserOptions::newFromUserAndLang(
|
||||
$user, MediaWikiServices::getInstance()->getContentLanguage() );
|
||||
$newContent = $content->preSaveTransform( $this->mTitle, $user, $popts );
|
||||
if ( $newContent->getModel() !== $oldContent->getModel() ) {
|
||||
// The undo may change content
|
||||
|
|
@ -3461,8 +3460,6 @@ ERROR;
|
|||
* save and then make a comparison.
|
||||
*/
|
||||
public function showDiff() {
|
||||
global $wgContLang;
|
||||
|
||||
$oldtitlemsg = 'currentrev';
|
||||
# if message does not exist, show diff against the preloaded default
|
||||
if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI && !$this->mTitle->exists() ) {
|
||||
|
|
@ -3492,7 +3489,8 @@ ERROR;
|
|||
Hooks::run( 'EditPageGetDiffContent', [ $this, &$newContent ] );
|
||||
|
||||
$user = $this->context->getUser();
|
||||
$popts = ParserOptions::newFromUserAndLang( $user, $wgContLang );
|
||||
$popts = ParserOptions::newFromUserAndLang( $user,
|
||||
MediaWikiServices::getInstance()->getContentLanguage() );
|
||||
$newContent = $newContent->preSaveTransform( $this->mTitle, $user, $popts );
|
||||
}
|
||||
|
||||
|
|
@ -4047,8 +4045,7 @@ ERROR;
|
|||
* @return string
|
||||
*/
|
||||
public static function getEditToolbar( $title = null ) {
|
||||
global $wgContLang, $wgOut;
|
||||
global $wgEnableUploads, $wgForeignFileRepos;
|
||||
global $wgOut, $wgEnableUploads, $wgForeignFileRepos;
|
||||
|
||||
$imagesAvailable = $wgEnableUploads || count( $wgForeignFileRepos );
|
||||
$showSignature = true;
|
||||
|
|
@ -4056,6 +4053,8 @@ ERROR;
|
|||
$showSignature = MWNamespace::wantSignatures( $title->getNamespace() );
|
||||
}
|
||||
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
|
||||
/**
|
||||
* $toolarray is an array of arrays each of which includes the
|
||||
* opening tag, the closing tag, optionally a sample text that is
|
||||
|
|
@ -4103,14 +4102,14 @@ ERROR;
|
|||
],
|
||||
$imagesAvailable ? [
|
||||
'id' => 'mw-editbutton-image',
|
||||
'open' => '[[' . $wgContLang->getNsText( NS_FILE ) . ':',
|
||||
'open' => '[[' . $contLang->getNsText( NS_FILE ) . ':',
|
||||
'close' => ']]',
|
||||
'sample' => wfMessage( 'image_sample' )->text(),
|
||||
'tip' => wfMessage( 'image_tip' )->text(),
|
||||
] : false,
|
||||
$imagesAvailable ? [
|
||||
'id' => 'mw-editbutton-media',
|
||||
'open' => '[[' . $wgContLang->getNsText( NS_MEDIA ) . ':',
|
||||
'open' => '[[' . $contLang->getNsText( NS_MEDIA ) . ':',
|
||||
'close' => ']]',
|
||||
'sample' => wfMessage( 'media_sample' )->text(),
|
||||
'tip' => wfMessage( 'media_tip' )->text(),
|
||||
|
|
|
|||
|
|
@ -1308,11 +1308,11 @@ function wfGetLangObj( $langcode = false ) {
|
|||
return $langcode;
|
||||
}
|
||||
|
||||
global $wgContLang, $wgLanguageCode;
|
||||
global $wgLanguageCode;
|
||||
if ( $langcode === true || $langcode === $wgLanguageCode ) {
|
||||
# $langcode is the language code of the wikis content language object.
|
||||
# or it is a boolean and value is true
|
||||
return $wgContLang;
|
||||
return MediaWikiServices::getInstance()->getContentLanguage();
|
||||
}
|
||||
|
||||
global $wgLang;
|
||||
|
|
@ -1330,7 +1330,7 @@ function wfGetLangObj( $langcode = false ) {
|
|||
|
||||
# $langcode is a string, but not a valid language code; use content language.
|
||||
wfDebug( "Invalid language code passed to wfGetLangObj, falling back to content language.\n" );
|
||||
return $wgContLang;
|
||||
return MediaWikiServices::getInstance()->getContentLanguage();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
*
|
||||
* @file
|
||||
*/
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* This class is a collection of static functions that serve two purposes:
|
||||
|
|
@ -824,8 +825,6 @@ class Html {
|
|||
* @return array
|
||||
*/
|
||||
public static function namespaceSelectorOptions( array $params = [] ) {
|
||||
global $wgContLang;
|
||||
|
||||
$options = [];
|
||||
|
||||
if ( !isset( $params['exclude'] ) || !is_array( $params['exclude'] ) ) {
|
||||
|
|
@ -838,7 +837,8 @@ class Html {
|
|||
$options[$params['all']] = wfMessage( 'namespacesall' )->text();
|
||||
}
|
||||
// Add all namespaces as options (in the content language)
|
||||
$options += $wgContLang->getFormattedNamespaces();
|
||||
$options +=
|
||||
MediaWikiServices::getInstance()->getContentLanguage()->getFormattedNamespaces();
|
||||
|
||||
$optionsOut = [];
|
||||
// Filter out namespaces below 0 and massage labels
|
||||
|
|
@ -851,7 +851,8 @@ class Html {
|
|||
// main we don't use "" but the user message describing it (e.g. "(Main)" or "(Article)")
|
||||
$nsName = wfMessage( 'blanknamespace' )->text();
|
||||
} elseif ( is_int( $nsId ) ) {
|
||||
$nsName = $wgContLang->convertNamespace( $nsId );
|
||||
$nsName = MediaWikiServices::getInstance()->getContentLanguage()->
|
||||
convertNamespace( $nsId );
|
||||
}
|
||||
$optionsOut[$nsId] = $nsName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -184,14 +184,13 @@ class Linker {
|
|||
* @return string
|
||||
*/
|
||||
public static function getInvalidTitleDescription( IContextSource $context, $namespace, $title ) {
|
||||
global $wgContLang;
|
||||
|
||||
// First we check whether the namespace exists or not.
|
||||
if ( MWNamespace::exists( $namespace ) ) {
|
||||
if ( $namespace == NS_MAIN ) {
|
||||
$name = $context->msg( 'blanknamespace' )->text();
|
||||
} else {
|
||||
$name = $wgContLang->getFormattedNsText( $namespace );
|
||||
$name = MediaWikiServices::getInstance()->getContentLanguage()->
|
||||
getFormattedNsText( $namespace );
|
||||
}
|
||||
return $context->msg( 'invalidtitle-knownnamespace', $namespace, $name, $title )->text();
|
||||
} else {
|
||||
|
|
@ -1227,10 +1226,11 @@ class Linker {
|
|||
([^[]*) # 3. link trail (the text up until the next link)
|
||||
/x',
|
||||
function ( $match ) use ( $title, $local, $wikiId ) {
|
||||
global $wgContLang;
|
||||
|
||||
$medians = '(?:' . preg_quote( MWNamespace::getCanonicalName( NS_MEDIA ), '/' ) . '|';
|
||||
$medians .= preg_quote( $wgContLang->getNsText( NS_MEDIA ), '/' ) . '):';
|
||||
$medians .= preg_quote(
|
||||
MediaWikiServices::getInstance()->getContentLanguage()->getNsText( NS_MEDIA ),
|
||||
'/'
|
||||
) . '):';
|
||||
|
||||
$comment = $match[0];
|
||||
|
||||
|
|
@ -1264,7 +1264,11 @@ class Linker {
|
|||
$match[1] = substr( $match[1], 1 );
|
||||
}
|
||||
if ( $match[1] !== false && $match[1] !== '' ) {
|
||||
if ( preg_match( $wgContLang->linkTrail(), $match[3], $submatch ) ) {
|
||||
if ( preg_match(
|
||||
MediaWikiServices::getInstance()->getContentLanguage()->linkTrail(),
|
||||
$match[3],
|
||||
$submatch
|
||||
) ) {
|
||||
$trail = $submatch[1];
|
||||
} else {
|
||||
$trail = "";
|
||||
|
|
@ -1655,8 +1659,7 @@ class Linker {
|
|||
* @return array
|
||||
*/
|
||||
static function splitTrail( $trail ) {
|
||||
global $wgContLang;
|
||||
$regex = $wgContLang->linkTrail();
|
||||
$regex = MediaWikiServices::getInstance()->getContentLanguage()->linkTrail();
|
||||
$inside = '';
|
||||
if ( $trail !== '' ) {
|
||||
$m = [];
|
||||
|
|
|
|||
|
|
@ -193,12 +193,10 @@ class MWGrants {
|
|||
* @return string Wikitext
|
||||
*/
|
||||
public static function getGrantsWikiText( $grantsFilter, $lang = null ) {
|
||||
global $wgContLang;
|
||||
|
||||
if ( is_string( $lang ) ) {
|
||||
$lang = Language::factory( $lang );
|
||||
} elseif ( $lang === null ) {
|
||||
$lang = $wgContLang;
|
||||
$lang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
}
|
||||
|
||||
$s = '';
|
||||
|
|
|
|||
|
|
@ -66,8 +66,6 @@ class MediaWiki {
|
|||
* @return Title Title object to be $wgTitle
|
||||
*/
|
||||
private function parseTitle() {
|
||||
global $wgContLang;
|
||||
|
||||
$request = $this->context->getRequest();
|
||||
$curid = $request->getInt( 'curid' );
|
||||
$title = $request->getVal( 'title' );
|
||||
|
|
@ -88,12 +86,13 @@ class MediaWiki {
|
|||
if ( !is_null( $ret ) && $ret->getNamespace() == NS_MEDIA ) {
|
||||
$ret = Title::makeTitle( NS_FILE, $ret->getDBkey() );
|
||||
}
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
// Check variant links so that interwiki links don't have to worry
|
||||
// about the possible different language variants
|
||||
if ( $wgContLang->hasVariants()
|
||||
&& !is_null( $ret ) && $ret->getArticleID() == 0
|
||||
if (
|
||||
$contLang->hasVariants() && !is_null( $ret ) && $ret->getArticleID() == 0
|
||||
) {
|
||||
$wgContLang->findVariantLink( $title, $ret );
|
||||
$contLang->findVariantLink( $title, $ret );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
* @file
|
||||
* @author Niklas Laxström
|
||||
*/
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* The Message class provides methods which fulfil two basic services:
|
||||
|
|
@ -469,18 +470,20 @@ class Message implements MessageSpecifier, Serializable {
|
|||
* @since 1.26
|
||||
*/
|
||||
public function getTitle() {
|
||||
global $wgContLang, $wgForceUIMsgAsContentMsg;
|
||||
global $wgForceUIMsgAsContentMsg;
|
||||
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
$title = $this->key;
|
||||
if (
|
||||
!$this->language->equals( $wgContLang )
|
||||
!$this->language->equals( $contLang )
|
||||
&& in_array( $this->key, (array)$wgForceUIMsgAsContentMsg )
|
||||
) {
|
||||
$code = $this->language->getCode();
|
||||
$title .= '/' . $code;
|
||||
}
|
||||
|
||||
return Title::makeTitle( NS_MEDIAWIKI, $wgContLang->ucfirst( strtr( $title, ' ', '_' ) ) );
|
||||
return Title::makeTitle(
|
||||
NS_MEDIAWIKI, $contLang->ucfirst( strtr( $title, ' ', '_' ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -766,8 +769,7 @@ class Message implements MessageSpecifier, Serializable {
|
|||
return $this;
|
||||
}
|
||||
|
||||
global $wgContLang;
|
||||
$this->inLanguage( $wgContLang );
|
||||
$this->inLanguage( MediaWikiServices::getInstance()->getContentLanguage() );
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1245,8 +1245,6 @@ class OutputPage extends ContextSource {
|
|||
* @param array $categories Mapping category name => sort key
|
||||
*/
|
||||
public function addCategoryLinks( array $categories ) {
|
||||
global $wgContLang;
|
||||
|
||||
if ( !$categories ) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -1270,7 +1268,8 @@ class OutputPage extends ContextSource {
|
|||
'OutputPageMakeCategoryLinks',
|
||||
[ &$outputPage, $categories, &$this->mCategoryLinks ] )
|
||||
) {
|
||||
$linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
|
||||
$services = MediaWikiServices::getInstance();
|
||||
$linkRenderer = $services->getLinkRenderer();
|
||||
foreach ( $categories as $category => $type ) {
|
||||
// array keys will cast numeric category names to ints, so cast back to string
|
||||
$category = (string)$category;
|
||||
|
|
@ -1279,11 +1278,11 @@ class OutputPage extends ContextSource {
|
|||
if ( !$title ) {
|
||||
continue;
|
||||
}
|
||||
$wgContLang->findVariantLink( $category, $title, true );
|
||||
$services->getContentLanguage()->findVariantLink( $category, $title, true );
|
||||
if ( $category != $origcategory && array_key_exists( $category, $categories ) ) {
|
||||
continue;
|
||||
}
|
||||
$text = $wgContLang->convertHtml( $title->getText() );
|
||||
$text = $services->getContentLanguage()->convertHtml( $title->getText() );
|
||||
$this->mCategories[$type][] = $title->getText();
|
||||
$this->mCategoryLinks[$type][] = $linkRenderer->makeLink( $title, new HtmlArmor( $text ) );
|
||||
}
|
||||
|
|
@ -1881,9 +1880,9 @@ class OutputPage extends ContextSource {
|
|||
*
|
||||
* @param string $text
|
||||
* @param bool $linestart Is this the start of a line?
|
||||
* @param bool $interface Use interface language ($wgLang instead of
|
||||
* $wgContLang) while parsing language sensitive magic words like GRAMMAR and PLURAL.
|
||||
* This also disables LanguageConverter.
|
||||
* @param bool $interface Use interface language (instead of content language) while parsing
|
||||
* language sensitive magic words like GRAMMAR and PLURAL. This also disables
|
||||
* LanguageConverter.
|
||||
* @param Language|null $language Target language object, will override $interface
|
||||
* @throws MWException
|
||||
* @return string HTML
|
||||
|
|
@ -1925,9 +1924,8 @@ class OutputPage extends ContextSource {
|
|||
*
|
||||
* @param string $text
|
||||
* @param bool $linestart Is this the start of a line?
|
||||
* @param bool $interface Use interface language ($wgLang instead of
|
||||
* $wgContLang) while parsing language sensitive magic
|
||||
* words like GRAMMAR and PLURAL
|
||||
* @param bool $interface Use interface language (instead of content language) while parsing
|
||||
* language sensitive magic words like GRAMMAR and PLURAL
|
||||
* @return string HTML
|
||||
*/
|
||||
public function parseInline( $text, $linestart = true, $interface = false ) {
|
||||
|
|
@ -2315,8 +2313,6 @@ class OutputPage extends ContextSource {
|
|||
* @throws MWException
|
||||
*/
|
||||
public function output( $return = false ) {
|
||||
global $wgContLang;
|
||||
|
||||
if ( $this->mDoNothing ) {
|
||||
return $return ? '' : null;
|
||||
}
|
||||
|
|
@ -2363,7 +2359,8 @@ class OutputPage extends ContextSource {
|
|||
ob_start();
|
||||
|
||||
$response->header( 'Content-type: ' . $config->get( 'MimeType' ) . '; charset=UTF-8' );
|
||||
$response->header( 'Content-language: ' . $wgContLang->getHtmlCode() );
|
||||
$response->header( 'Content-language: ' .
|
||||
MediaWikiServices::getInstance()->getContentLanguage()->getHtmlCode() );
|
||||
|
||||
if ( !$this->mArticleBodyOnly ) {
|
||||
$sk = $this->getSkin();
|
||||
|
|
@ -2861,10 +2858,8 @@ class OutputPage extends ContextSource {
|
|||
* @return string The doctype, opening "<html>", and head element.
|
||||
*/
|
||||
public function headElement( Skin $sk, $includeStyle = true ) {
|
||||
global $wgContLang;
|
||||
|
||||
$userdir = $this->getLanguage()->getDir();
|
||||
$sitedir = $wgContLang->getDir();
|
||||
$sitedir = MediaWikiServices::getInstance()->getContentLanguage()->getDir();
|
||||
|
||||
$pieces = [];
|
||||
$pieces[] = Html::htmlHeader( Sanitizer::mergeAttributes(
|
||||
|
|
@ -3062,8 +3057,6 @@ class OutputPage extends ContextSource {
|
|||
* @return array
|
||||
*/
|
||||
public function getJSVars() {
|
||||
global $wgContLang;
|
||||
|
||||
$curRevisionId = 0;
|
||||
$articleId = 0;
|
||||
$canonicalSpecialPageName = false; # T23115
|
||||
|
|
@ -3147,8 +3140,9 @@ class OutputPage extends ContextSource {
|
|||
$vars['wgUserNewMsgRevisionId'] = $user->getNewMessageRevisionId();
|
||||
}
|
||||
|
||||
if ( $wgContLang->hasVariants() ) {
|
||||
$vars['wgUserVariant'] = $wgContLang->getPreferredVariant();
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
if ( $contLang->hasVariants() ) {
|
||||
$vars['wgUserVariant'] = $contLang->getPreferredVariant();
|
||||
}
|
||||
// Same test as SkinTemplate
|
||||
$vars['wgIsProbablyEditable'] = $title->quickUserCan( 'edit', $user )
|
||||
|
|
|
|||
|
|
@ -35,12 +35,12 @@ class Preferences {
|
|||
* @return DefaultPreferencesFactory
|
||||
*/
|
||||
protected static function getDefaultPreferencesFactory() {
|
||||
global $wgContLang;
|
||||
$authManager = AuthManager::singleton();
|
||||
$linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
|
||||
$config = MediaWikiServices::getInstance()->getMainConfig();
|
||||
$preferencesFactory = new DefaultPreferencesFactory(
|
||||
$config, $wgContLang, $authManager, $linkRenderer
|
||||
$config, MediaWikiServices::getInstance()->getContentLanguage(), $authManager,
|
||||
$linkRenderer
|
||||
);
|
||||
return $preferencesFactory;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* Handles searching prefixes of titles and finding any page
|
||||
* names that match. Used largely by the OpenSearch implementation.
|
||||
|
|
@ -81,9 +83,8 @@ abstract class PrefixSearch {
|
|||
// if the content language has variants, try to retrieve fallback results
|
||||
$fallbackLimit = $limit - count( $searches );
|
||||
if ( $fallbackLimit > 0 ) {
|
||||
global $wgContLang;
|
||||
|
||||
$fallbackSearches = $wgContLang->autoConvertToAllVariants( $search );
|
||||
$fallbackSearches = MediaWikiServices::getInstance()->getContentLanguage()->
|
||||
autoConvertToAllVariants( $search );
|
||||
$fallbackSearches = array_diff( array_unique( $fallbackSearches ), [ $search ] );
|
||||
|
||||
foreach ( $fallbackSearches as $fbs ) {
|
||||
|
|
@ -167,8 +168,6 @@ abstract class PrefixSearch {
|
|||
* @return array
|
||||
*/
|
||||
protected function specialSearch( $search, $limit, $offset ) {
|
||||
global $wgContLang;
|
||||
|
||||
$searchParts = explode( '/', $search, 2 );
|
||||
$searchKey = $searchParts[0];
|
||||
$subpageSearch = $searchParts[1] ?? null;
|
||||
|
|
@ -192,23 +191,24 @@ abstract class PrefixSearch {
|
|||
}
|
||||
|
||||
# normalize searchKey, so aliases with spaces can be found - T27675
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
$searchKey = str_replace( ' ', '_', $searchKey );
|
||||
$searchKey = $wgContLang->caseFold( $searchKey );
|
||||
$searchKey = $contLang->caseFold( $searchKey );
|
||||
|
||||
// Unlike SpecialPage itself, we want the canonical forms of both
|
||||
// canonical and alias title forms...
|
||||
$keys = [];
|
||||
foreach ( SpecialPageFactory::getNames() as $page ) {
|
||||
$keys[$wgContLang->caseFold( $page )] = [ 'page' => $page, 'rank' => 0 ];
|
||||
$keys[$contLang->caseFold( $page )] = [ 'page' => $page, 'rank' => 0 ];
|
||||
}
|
||||
|
||||
foreach ( $wgContLang->getSpecialPageAliases() as $page => $aliases ) {
|
||||
foreach ( $contLang->getSpecialPageAliases() as $page => $aliases ) {
|
||||
if ( !in_array( $page, SpecialPageFactory::getNames() ) ) {# T22885
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ( $aliases as $key => $alias ) {
|
||||
$keys[$wgContLang->caseFold( $alias )] = [ 'page' => $alias, 'rank' => $key ];
|
||||
$keys[$contLang->caseFold( $alias )] = [ 'page' => $alias, 'rank' => $key ];
|
||||
}
|
||||
}
|
||||
ksort( $keys );
|
||||
|
|
@ -307,10 +307,8 @@ abstract class PrefixSearch {
|
|||
* @return array (default: contains only NS_MAIN)
|
||||
*/
|
||||
protected function validateNamespaces( $namespaces ) {
|
||||
global $wgContLang;
|
||||
|
||||
// We will look at each given namespace against wgContLang namespaces
|
||||
$validNamespaces = $wgContLang->getNamespaces();
|
||||
// We will look at each given namespace against content language namespaces
|
||||
$validNamespaces = MediaWikiServices::getInstance()->getContentLanguage()->getNamespaces();
|
||||
if ( is_array( $namespaces ) && count( $namespaces ) > 0 ) {
|
||||
$valid = [];
|
||||
foreach ( $namespaces as $ns ) {
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ class DerivedPageDataUpdater implements IDBAccessObject {
|
|||
/**
|
||||
* @var Language
|
||||
*/
|
||||
private $contentLanguage;
|
||||
private $contLang;
|
||||
|
||||
/**
|
||||
* @var LoggerInterface
|
||||
|
|
@ -251,7 +251,7 @@ class DerivedPageDataUpdater implements IDBAccessObject {
|
|||
* @param ParserCache $parserCache
|
||||
* @param JobQueueGroup $jobQueueGroup
|
||||
* @param MessageCache $messageCache
|
||||
* @param Language $contentLanguage
|
||||
* @param Language $contLang
|
||||
* @param LoggerInterface|null $saveParseLogger
|
||||
*/
|
||||
public function __construct(
|
||||
|
|
@ -260,7 +260,7 @@ class DerivedPageDataUpdater implements IDBAccessObject {
|
|||
ParserCache $parserCache,
|
||||
JobQueueGroup $jobQueueGroup,
|
||||
MessageCache $messageCache,
|
||||
Language $contentLanguage,
|
||||
Language $contLang,
|
||||
LoggerInterface $saveParseLogger = null
|
||||
) {
|
||||
$this->wikiPage = $wikiPage;
|
||||
|
|
@ -269,7 +269,7 @@ class DerivedPageDataUpdater implements IDBAccessObject {
|
|||
$this->revisionStore = $revisionStore;
|
||||
$this->jobQueueGroup = $jobQueueGroup;
|
||||
$this->messageCache = $messageCache;
|
||||
$this->contentLanguage = $contentLanguage;
|
||||
$this->contLang = $contLang;
|
||||
|
||||
// XXX: replace all wfDebug calls with a Logger. Do we nede more than one logger here?
|
||||
$this->saveParseLogger = $saveParseLogger ?: new NullLogger();
|
||||
|
|
@ -762,7 +762,7 @@ class DerivedPageDataUpdater implements IDBAccessObject {
|
|||
$this->canonicalParserOutput = $output;
|
||||
}
|
||||
|
||||
$userPopts = ParserOptions::newFromUserAndLang( $user, $this->contentLanguage );
|
||||
$userPopts = ParserOptions::newFromUserAndLang( $user, $this->contLang );
|
||||
Hooks::run( 'ArticlePrepareTextForEdit', [ $wikiPage, $userPopts ] );
|
||||
|
||||
$this->user = $user;
|
||||
|
|
|
|||
|
|
@ -745,12 +745,10 @@ class Title implements LinkTarget {
|
|||
public static function makeName( $ns, $title, $fragment = '', $interwiki = '',
|
||||
$canonicalNamespace = false
|
||||
) {
|
||||
global $wgContLang;
|
||||
|
||||
if ( $canonicalNamespace ) {
|
||||
$namespace = MWNamespace::getCanonicalName( $ns );
|
||||
} else {
|
||||
$namespace = $wgContLang->getNsText( $ns );
|
||||
$namespace = MediaWikiServices::getInstance()->getContentLanguage()->getNsText( $ns );
|
||||
}
|
||||
$name = $namespace == '' ? $title : "$namespace:$title";
|
||||
if ( strval( $interwiki ) != '' ) {
|
||||
|
|
@ -1051,8 +1049,8 @@ class Title implements LinkTarget {
|
|||
* @return string Namespace text
|
||||
*/
|
||||
public function getSubjectNsText() {
|
||||
global $wgContLang;
|
||||
return $wgContLang->getNsText( MWNamespace::getSubject( $this->mNamespace ) );
|
||||
return MediaWikiServices::getInstance()->getContentLanguage()->
|
||||
getNsText( MWNamespace::getSubject( $this->mNamespace ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1061,8 +1059,8 @@ class Title implements LinkTarget {
|
|||
* @return string Namespace text
|
||||
*/
|
||||
public function getTalkNsText() {
|
||||
global $wgContLang;
|
||||
return $wgContLang->getNsText( MWNamespace::getTalk( $this->mNamespace ) );
|
||||
return MediaWikiServices::getInstance()->getContentLanguage()->
|
||||
getNsText( MWNamespace::getTalk( $this->mNamespace ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1632,8 +1630,6 @@ class Title implements LinkTarget {
|
|||
* @return string The prefixed text
|
||||
*/
|
||||
private function prefix( $name ) {
|
||||
global $wgContLang;
|
||||
|
||||
$p = '';
|
||||
if ( $this->isExternal() ) {
|
||||
$p = $this->mInterwiki . ':';
|
||||
|
|
@ -1644,7 +1640,8 @@ class Title implements LinkTarget {
|
|||
|
||||
if ( $nsText === false ) {
|
||||
// See T165149. Awkward, but better than erroneously linking to the main namespace.
|
||||
$nsText = $wgContLang->getNsText( NS_SPECIAL ) . ":Badtitle/NS{$this->mNamespace}";
|
||||
$nsText = MediaWikiServices::getInstance()->getContentLanguage()->
|
||||
getNsText( NS_SPECIAL ) . ":Badtitle/NS{$this->mNamespace}";
|
||||
}
|
||||
|
||||
$p .= $nsText . ':';
|
||||
|
|
@ -1979,7 +1976,7 @@ class Title implements LinkTarget {
|
|||
$titleRef = $this;
|
||||
Hooks::run( 'GetLocalURL::Article', [ &$titleRef, &$url ] );
|
||||
} else {
|
||||
global $wgVariantArticlePath, $wgActionPaths, $wgContLang;
|
||||
global $wgVariantArticlePath, $wgActionPaths;
|
||||
$url = false;
|
||||
$matches = [];
|
||||
|
||||
|
|
@ -2002,7 +1999,8 @@ class Title implements LinkTarget {
|
|||
if ( $url === false
|
||||
&& $wgVariantArticlePath
|
||||
&& preg_match( '/^variant=([^&]*)$/', $query, $matches )
|
||||
&& $this->getPageLanguage()->equals( $wgContLang )
|
||||
&& $this->getPageLanguage()->equals(
|
||||
MediaWikiServices::getInstance()->getContentLanguage() )
|
||||
&& $this->getPageLanguage()->hasVariants()
|
||||
) {
|
||||
$variant = urldecode( $matches[1] );
|
||||
|
|
@ -3677,10 +3675,8 @@ class Title implements LinkTarget {
|
|||
* @return string Containing capitalized title
|
||||
*/
|
||||
public static function capitalize( $text, $ns = NS_MAIN ) {
|
||||
global $wgContLang;
|
||||
|
||||
if ( MWNamespace::isCapitalized( $ns ) ) {
|
||||
return $wgContLang->ucfirst( $text );
|
||||
return MediaWikiServices::getInstance()->getContentLanguage()->ucfirst( $text );
|
||||
} else {
|
||||
return $text;
|
||||
}
|
||||
|
|
@ -4227,8 +4223,6 @@ class Title implements LinkTarget {
|
|||
* $parent => $currentarticle
|
||||
*/
|
||||
public function getParentCategories() {
|
||||
global $wgContLang;
|
||||
|
||||
$data = [];
|
||||
|
||||
$titleKey = $this->getArticleID();
|
||||
|
|
@ -4247,9 +4241,11 @@ class Title implements LinkTarget {
|
|||
);
|
||||
|
||||
if ( $res->numRows() > 0 ) {
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
foreach ( $res as $row ) {
|
||||
// $data[] = Title::newFromText($wgContLang->getNsText ( NS_CATEGORY ).':'.$row->cl_to);
|
||||
$data[$wgContLang->getNsText( NS_CATEGORY ) . ':' . $row->cl_to] = $this->getFullText();
|
||||
// $data[] = Title::newFromText( $contLang->getNsText ( NS_CATEGORY ).':'.$row->cl_to);
|
||||
$data[$contLang->getNsText( NS_CATEGORY ) . ':' . $row->cl_to] =
|
||||
$this->getFullText();
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
|
|
@ -4733,11 +4729,11 @@ class Title implements LinkTarget {
|
|||
// message content will be displayed, same for language subpages-
|
||||
// Use always content language to avoid loading hundreds of languages
|
||||
// to get the link color.
|
||||
global $wgContLang;
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
list( $name, ) = MessageCache::singleton()->figureMessage(
|
||||
$wgContLang->lcfirst( $this->getText() )
|
||||
$contLang->lcfirst( $this->getText() )
|
||||
);
|
||||
$message = wfMessage( $name )->inLanguage( $wgContLang )->useDatabase( false );
|
||||
$message = wfMessage( $name )->inLanguage( $contLang )->useDatabase( false );
|
||||
return $message->exists();
|
||||
}
|
||||
|
||||
|
|
@ -4750,14 +4746,12 @@ class Title implements LinkTarget {
|
|||
* @return string|bool
|
||||
*/
|
||||
public function getDefaultMessageText() {
|
||||
global $wgContLang;
|
||||
|
||||
if ( $this->getNamespace() != NS_MEDIAWIKI ) { // Just in case
|
||||
return false;
|
||||
}
|
||||
|
||||
list( $name, $lang ) = MessageCache::singleton()->figureMessage(
|
||||
$wgContLang->lcfirst( $this->getText() )
|
||||
MediaWikiServices::getInstance()->getContentLanguage()->lcfirst( $this->getText() )
|
||||
);
|
||||
$message = wfMessage( $name )->inLanguage( $lang )->useDatabase( false );
|
||||
|
||||
|
|
@ -4884,7 +4878,6 @@ class Title implements LinkTarget {
|
|||
* @return string XML 'id' name
|
||||
*/
|
||||
public function getNamespaceKey( $prepend = 'nstab-' ) {
|
||||
global $wgContLang;
|
||||
// Gets the subject namespace of this title
|
||||
$subjectNS = MWNamespace::getSubject( $this->getNamespace() );
|
||||
// Prefer canonical namespace name for HTML IDs
|
||||
|
|
@ -4894,7 +4887,7 @@ class Title implements LinkTarget {
|
|||
$namespaceKey = $this->getSubjectNsText();
|
||||
}
|
||||
// Makes namespace key lowercase
|
||||
$namespaceKey = $wgContLang->lc( $namespaceKey );
|
||||
$namespaceKey = MediaWikiServices::getInstance()->getContentLanguage()->lc( $namespaceKey );
|
||||
// Uses main
|
||||
if ( $namespaceKey == '' ) {
|
||||
$namespaceKey = 'main';
|
||||
|
|
@ -5043,7 +5036,7 @@ class Title implements LinkTarget {
|
|||
|
||||
/**
|
||||
* Get the language in which the content of this page is written in
|
||||
* wikitext. Defaults to $wgContLang, but in certain cases it can be
|
||||
* wikitext. Defaults to content language, but in certain cases it can be
|
||||
* e.g. $wgLang (such as special pages, which are in the user language).
|
||||
*
|
||||
* @since 1.18
|
||||
|
|
@ -5081,7 +5074,7 @@ class Title implements LinkTarget {
|
|||
|
||||
/**
|
||||
* Get the language in which the content of this page is written when
|
||||
* viewed by user. Defaults to $wgContLang, but in certain cases it can be
|
||||
* viewed by user. Defaults to content language, but in certain cases it can be
|
||||
* e.g. $wgLang (such as special pages, which are in the user language).
|
||||
*
|
||||
* @since 1.20
|
||||
|
|
|
|||
|
|
@ -162,11 +162,12 @@ class WebRequest {
|
|||
$router->add( $wgActionPaths, [ 'action' => '$key' ] );
|
||||
}
|
||||
|
||||
global $wgVariantArticlePath, $wgContLang;
|
||||
global $wgVariantArticlePath;
|
||||
if ( $wgVariantArticlePath ) {
|
||||
$router->add( $wgVariantArticlePath,
|
||||
[ 'variant' => '$2' ],
|
||||
[ '$2' => $wgContLang->getVariants() ]
|
||||
[ '$2' => MediaWikiServices::getInstance()->getContentLanguage()->
|
||||
getVariants() ]
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -306,7 +307,7 @@ class WebRequest {
|
|||
/**
|
||||
* Check for title, action, and/or variant data in the URL
|
||||
* and interpolate it into the GET variables.
|
||||
* This should only be run after $wgContLang is available,
|
||||
* This should only be run after the content language is available,
|
||||
* as we may need the list of language variants to determine
|
||||
* available variant URLs.
|
||||
*/
|
||||
|
|
@ -364,9 +365,8 @@ class WebRequest {
|
|||
$data[$key] = $this->normalizeUnicode( $val );
|
||||
}
|
||||
} else {
|
||||
global $wgContLang;
|
||||
$data = isset( $wgContLang ) ?
|
||||
$wgContLang->normalize( $data ) :
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
$data = $contLang ? $contLang->normalize( $data ) :
|
||||
UtfNormal\Validator::cleanUp( $data );
|
||||
}
|
||||
return $data;
|
||||
|
|
@ -386,12 +386,12 @@ class WebRequest {
|
|||
# Work around PHP *feature* to avoid *bugs* elsewhere.
|
||||
$name = strtr( $name, '.', '_' );
|
||||
if ( isset( $arr[$name] ) ) {
|
||||
global $wgContLang;
|
||||
$data = $arr[$name];
|
||||
if ( isset( $_GET[$name] ) && !is_array( $data ) ) {
|
||||
# Check for alternate/legacy character encoding.
|
||||
if ( isset( $wgContLang ) ) {
|
||||
$data = $wgContLang->checkTitleEncoding( $data );
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
if ( $contLang ) {
|
||||
$data = $contLang->checkTitleEncoding( $data );
|
||||
}
|
||||
}
|
||||
$data = $this->normalizeUnicode( $data );
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* Object to access the $_FILES array
|
||||
*
|
||||
|
|
@ -63,13 +65,12 @@ class WebRequestUpload {
|
|||
return null;
|
||||
}
|
||||
|
||||
global $wgContLang;
|
||||
$name = $this->fileInfo['name'];
|
||||
|
||||
# Safari sends filenames in HTML-encoded Unicode form D...
|
||||
# Horrid and evil! Let's try to make some kind of sense of it.
|
||||
$name = Sanitizer::decodeCharReferences( $name );
|
||||
$name = $wgContLang->normalize( $name );
|
||||
$name = MediaWikiServices::getInstance()->getContentLanguage()->normalize( $name );
|
||||
wfDebug( __METHOD__ . ": {$this->fileInfo['name']} normalized to '$name'\n" );
|
||||
return $name;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* Module of static functions for generating XML
|
||||
*/
|
||||
|
|
@ -79,9 +81,8 @@ class Xml {
|
|||
}
|
||||
|
||||
/**
|
||||
* Format an XML element as with self::element(), but run text through the
|
||||
* $wgContLang->normalize() validator first to ensure that no invalid UTF-8
|
||||
* is passed.
|
||||
* Format an XML element as with self::element(), but run text through the content language's
|
||||
* normalize() validator first to ensure that no invalid UTF-8 is passed.
|
||||
*
|
||||
* @param string $element
|
||||
* @param array $attribs Name=>value pairs. Values will be escaped.
|
||||
|
|
@ -89,12 +90,12 @@ class Xml {
|
|||
* @return string
|
||||
*/
|
||||
public static function elementClean( $element, $attribs = [], $contents = '' ) {
|
||||
global $wgContLang;
|
||||
if ( $attribs ) {
|
||||
$attribs = array_map( [ 'UtfNormal\Validator', 'cleanUp' ], $attribs );
|
||||
}
|
||||
if ( $contents ) {
|
||||
$contents = $wgContLang->normalize( $contents );
|
||||
$contents =
|
||||
MediaWikiServices::getInstance()->getContentLanguage()->normalize( $contents );
|
||||
}
|
||||
return self::element( $element, $attribs, $contents );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* @defgroup Actions Action done on pages
|
||||
*/
|
||||
|
|
@ -386,8 +388,7 @@ abstract class Action implements MessageLocalizer {
|
|||
* @since 1.25
|
||||
*/
|
||||
public function addHelpLink( $to, $overrideBaseUrl = false ) {
|
||||
global $wgContLang;
|
||||
$msg = wfMessage( $wgContLang->lc(
|
||||
$msg = wfMessage( MediaWikiServices::getInstance()->getContentLanguage()->lc(
|
||||
self::getActionName( $this->getContext() )
|
||||
) . '-helppage' );
|
||||
|
||||
|
|
|
|||
|
|
@ -358,12 +358,13 @@ class HistoryAction extends FormlessAction {
|
|||
$rev->getComment()
|
||||
);
|
||||
if ( $rev->getComment() == '' ) {
|
||||
global $wgContLang;
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
$title = $this->msg( 'history-feed-item-nocomment',
|
||||
$rev->getUserText(),
|
||||
$wgContLang->timeanddate( $rev->getTimestamp() ),
|
||||
$wgContLang->date( $rev->getTimestamp() ),
|
||||
$wgContLang->time( $rev->getTimestamp() ) )->inContentLanguage()->text();
|
||||
$contLang->timeanddate( $rev->getTimestamp() ),
|
||||
$contLang->date( $rev->getTimestamp() ),
|
||||
$contLang->time( $rev->getTimestamp() )
|
||||
)->inContentLanguage()->text();
|
||||
} else {
|
||||
$title = $rev->getUserText() .
|
||||
$this->msg( 'colon-separator' )->inContentLanguage()->text() .
|
||||
|
|
|
|||
|
|
@ -207,8 +207,6 @@ class InfoAction extends FormlessAction {
|
|||
* @return array
|
||||
*/
|
||||
protected function pageInfo() {
|
||||
global $wgContLang;
|
||||
|
||||
$services = MediaWikiServices::getInstance();
|
||||
|
||||
$user = $this->getUser();
|
||||
|
|
@ -607,7 +605,7 @@ class InfoAction extends FormlessAction {
|
|||
$wordIDs = $magicWords->names;
|
||||
|
||||
// Array of IDs => localized magic words
|
||||
$localizedWords = $wgContLang->getMagicWords();
|
||||
$localizedWords = $services->getContentLanguage()->getMagicWords();
|
||||
|
||||
$listItems = [];
|
||||
foreach ( $pageProperties as $property => $value ) {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@
|
|||
* @author Rob Church <robchur@gmail.com>
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* File reversion user interface
|
||||
*
|
||||
|
|
@ -78,8 +80,6 @@ class RevertAction extends FormAction {
|
|||
}
|
||||
|
||||
protected function getFormFields() {
|
||||
global $wgContLang;
|
||||
|
||||
$timestamp = $this->oldFile->getTimestamp();
|
||||
|
||||
$user = $this->getUser();
|
||||
|
|
@ -88,8 +88,9 @@ class RevertAction extends FormAction {
|
|||
$userTime = $lang->userTime( $timestamp, $user );
|
||||
$siteTs = MWTimestamp::getLocalInstance( $timestamp );
|
||||
$ts = $siteTs->format( 'YmdHis' );
|
||||
$siteDate = $wgContLang->date( $ts, false, false );
|
||||
$siteTime = $wgContLang->time( $ts, false, false );
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
$siteDate = $contLang->date( $ts, false, false );
|
||||
$siteTime = $contLang->time( $ts, false, false );
|
||||
$tzMsg = $siteTs->getTimezoneMessage()->inContentLanguage()->text();
|
||||
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -1246,8 +1246,8 @@ abstract class ApiBase extends ContextSource {
|
|||
// Preserve U+001F for self::parseMultiValue(), or error out if that won't be called
|
||||
if ( isset( $value ) && substr( $rawValue, 0, 1 ) === "\x1f" ) {
|
||||
if ( $multi ) {
|
||||
// This loses the potential $wgContLang->checkTitleEncoding() transformation
|
||||
// done by WebRequest for $_GET. Let's call that a feature.
|
||||
// This loses the potential checkTitleEncoding() transformation done by
|
||||
// WebRequest for $_GET. Let's call that a feature.
|
||||
$value = implode( "\x1f", $request->normalizeUnicode( explode( "\x1f", $rawValue ) ) );
|
||||
} else {
|
||||
$this->dieWithError( 'apierror-badvalue-notmultivalue', 'badvalue_notmultivalue' );
|
||||
|
|
|
|||
|
|
@ -91,8 +91,6 @@ class ApiHelp extends ApiBase {
|
|||
* @param array $options Formatting options (described above)
|
||||
*/
|
||||
public static function getHelp( IContextSource $context, $modules, array $options ) {
|
||||
global $wgContLang;
|
||||
|
||||
if ( !is_array( $modules ) ) {
|
||||
$modules = [ $modules ];
|
||||
}
|
||||
|
|
@ -108,10 +106,12 @@ class ApiHelp extends ApiBase {
|
|||
}
|
||||
$out->setPageTitle( $context->msg( 'api-help-title' ) );
|
||||
|
||||
$cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
|
||||
$services = MediaWikiServices::getInstance();
|
||||
$cache = $services->getMainWANObjectCache();
|
||||
$cacheKey = null;
|
||||
if ( count( $modules ) == 1 && $modules[0] instanceof ApiMain &&
|
||||
$options['recursivesubmodules'] && $context->getLanguage() === $wgContLang
|
||||
$options['recursivesubmodules'] &&
|
||||
$context->getLanguage()->equals( $services->getContentLanguage() )
|
||||
) {
|
||||
$cacheHelpTimeout = $context->getConfig()->get( 'APICacheHelpTimeout' );
|
||||
if ( $cacheHelpTimeout > 0 ) {
|
||||
|
|
|
|||
|
|
@ -244,8 +244,7 @@ class ApiMain extends ApiBase {
|
|||
// for uselang=user (see T85635).
|
||||
} else {
|
||||
if ( $uselang === 'content' ) {
|
||||
global $wgContLang;
|
||||
$uselang = $wgContLang->getCode();
|
||||
$uselang = MediaWikiServices::getInstance()->getContentLanguage()->getCode();
|
||||
}
|
||||
$code = RequestContext::sanitizeLangCode( $uselang );
|
||||
$this->getContext()->setLanguage( $code );
|
||||
|
|
@ -265,8 +264,7 @@ class ApiMain extends ApiBase {
|
|||
if ( $errorLangCode === 'uselang' ) {
|
||||
$errorLang = $this->getLanguage();
|
||||
} elseif ( $errorLangCode === 'content' ) {
|
||||
global $wgContLang;
|
||||
$errorLang = $wgContLang;
|
||||
$errorLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
} else {
|
||||
$errorLangCode = RequestContext::sanitizeLangCode( $errorLangCode );
|
||||
$errorLang = Language::factory( $errorLangCode );
|
||||
|
|
|
|||
|
|
@ -512,11 +512,10 @@ class ApiPageSet extends ApiBase {
|
|||
* @since 1.21
|
||||
*/
|
||||
public function getNormalizedTitlesAsResult( $result = null ) {
|
||||
global $wgContLang;
|
||||
|
||||
$values = [];
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
foreach ( $this->getNormalizedTitles() as $rawTitleStr => $titleStr ) {
|
||||
$encode = ( $wgContLang->normalize( $rawTitleStr ) !== $rawTitleStr );
|
||||
$encode = $contLang->normalize( $rawTitleStr ) !== $rawTitleStr;
|
||||
$values[] = [
|
||||
'fromencoded' => $encode,
|
||||
'from' => $encode ? rawurlencode( $rawTitleStr ) : $rawTitleStr,
|
||||
|
|
@ -1198,15 +1197,14 @@ class ApiPageSet extends ApiBase {
|
|||
$this->mInterwikiTitles[$unconvertedTitle] = $titleObj->getInterwiki();
|
||||
} else {
|
||||
// Variants checking
|
||||
global $wgContLang;
|
||||
if ( $this->mConvertTitles &&
|
||||
$wgContLang->hasVariants() &&
|
||||
!$titleObj->exists()
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
if (
|
||||
$this->mConvertTitles && $contLang->hasVariants() && !$titleObj->exists()
|
||||
) {
|
||||
// Language::findVariantLink will modify titleText and titleObj into
|
||||
// the canonical variant if possible
|
||||
$titleText = is_string( $title ) ? $title : $titleObj->getPrefixedText();
|
||||
$wgContLang->findVariantLink( $titleText, $titleObj );
|
||||
$contLang->findVariantLink( $titleText, $titleObj );
|
||||
$titleWasConverted = $unconvertedTitle !== $titleObj->getPrefixedText();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* A query action to return messages from site message cache
|
||||
*
|
||||
|
|
@ -110,15 +112,13 @@ class ApiQueryAllMessages extends ApiQueryBase {
|
|||
// Whether we have any sort of message customisation filtering
|
||||
$customiseFilterEnabled = $params['customised'] !== 'all';
|
||||
if ( $customiseFilterEnabled ) {
|
||||
global $wgContLang;
|
||||
|
||||
$customisedMessages = AllMessagesTablePager::getCustomisedStatuses(
|
||||
array_map(
|
||||
[ $langObj, 'ucfirst' ],
|
||||
$messages_target
|
||||
),
|
||||
$langObj->getCode(),
|
||||
!$langObj->equals( $wgContLang )
|
||||
!$langObj->equals( MediaWikiServices::getInstance()->getContentLanguage() )
|
||||
);
|
||||
|
||||
$customised = $params['customised'] === 'modified';
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* A query action to get image information and upload history.
|
||||
*
|
||||
|
|
@ -369,14 +371,12 @@ class ApiQueryImageInfo extends ApiQueryBase {
|
|||
* @return array Result array
|
||||
*/
|
||||
public static function getInfo( $file, $prop, $result, $thumbParams = null, $opts = false ) {
|
||||
global $wgContLang;
|
||||
|
||||
$anyHidden = false;
|
||||
|
||||
if ( !$opts || is_string( $opts ) ) {
|
||||
$opts = [
|
||||
'version' => $opts ?: 'latest',
|
||||
'language' => $wgContLang,
|
||||
'language' => MediaWikiServices::getInstance()->getContentLanguage(),
|
||||
'multilang' => false,
|
||||
'extmetadatafilter' => [],
|
||||
'revdelUser' => null,
|
||||
|
|
@ -650,8 +650,6 @@ class ApiQueryImageInfo extends ApiQueryBase {
|
|||
}
|
||||
|
||||
public function getAllowedParams() {
|
||||
global $wgContLang;
|
||||
|
||||
return [
|
||||
'prop' => [
|
||||
ApiBase::PARAM_ISMULTI => true,
|
||||
|
|
@ -690,7 +688,8 @@ class ApiQueryImageInfo extends ApiQueryBase {
|
|||
],
|
||||
'extmetadatalanguage' => [
|
||||
ApiBase::PARAM_TYPE => 'string',
|
||||
ApiBase::PARAM_DFLT => $wgContLang->getCode(),
|
||||
ApiBase::PARAM_DFLT =>
|
||||
MediaWikiServices::getInstance()->getContentLanguage()->getCode(),
|
||||
],
|
||||
'extmetadatamultilang' => [
|
||||
ApiBase::PARAM_TYPE => 'boolean',
|
||||
|
|
|
|||
|
|
@ -764,12 +764,12 @@ class ApiQueryInfo extends ApiQueryBase {
|
|||
}
|
||||
|
||||
private function getAllVariants( $text, $ns = NS_MAIN ) {
|
||||
global $wgContLang;
|
||||
$result = [];
|
||||
foreach ( $wgContLang->getVariants() as $variant ) {
|
||||
$convertTitle = $wgContLang->autoConvert( $text, $variant );
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
foreach ( $contLang->getVariants() as $variant ) {
|
||||
$convertTitle = $contLang->autoConvert( $text, $variant );
|
||||
if ( $ns !== NS_MAIN ) {
|
||||
$convertNs = $wgContLang->convertNamespace( $ns, $variant );
|
||||
$convertNs = $contLang->convertNamespace( $ns, $variant );
|
||||
$convertTitle = $convertNs . ':' . $convertTitle;
|
||||
}
|
||||
$result[$variant] = $convertTitle;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* A query module to list all langlinks (links to corresponding foreign language pages).
|
||||
*
|
||||
|
|
@ -140,7 +142,6 @@ class ApiQueryLangLinks extends ApiQueryBase {
|
|||
}
|
||||
|
||||
public function getAllowedParams() {
|
||||
global $wgContLang;
|
||||
return [
|
||||
'prop' => [
|
||||
ApiBase::PARAM_ISMULTI => true,
|
||||
|
|
@ -160,7 +161,7 @@ class ApiQueryLangLinks extends ApiQueryBase {
|
|||
'descending'
|
||||
]
|
||||
],
|
||||
'inlanguagecode' => $wgContLang->getCode(),
|
||||
'inlanguagecode' => MediaWikiServices::getInstance()->getContentLanguage()->getCode(),
|
||||
'limit' => [
|
||||
ApiBase::PARAM_DFLT => 10,
|
||||
ApiBase::PARAM_TYPE => 'limit',
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* Query module to perform full text search within wiki titles and content
|
||||
*
|
||||
|
|
@ -48,7 +50,6 @@ class ApiQuerySearch extends ApiQueryGeneratorBase {
|
|||
* @return void
|
||||
*/
|
||||
private function run( $resultPageSet = null ) {
|
||||
global $wgContLang;
|
||||
$params = $this->extractRequestParams();
|
||||
|
||||
// Extract parameters
|
||||
|
|
@ -152,7 +153,8 @@ class ApiQuerySearch extends ApiQueryGeneratorBase {
|
|||
}
|
||||
|
||||
// Add the search results to the result
|
||||
$terms = $wgContLang->convertForSearchResult( $matches->termMatches() );
|
||||
$terms = MediaWikiServices::getInstance()->getContentLanguage()->
|
||||
convertForSearchResult( $matches->termMatches() );
|
||||
$titles = [];
|
||||
$count = 0;
|
||||
$limit = $params['limit'];
|
||||
|
|
|
|||
|
|
@ -125,8 +125,6 @@ class ApiQuerySiteinfo extends ApiQueryBase {
|
|||
}
|
||||
|
||||
protected function appendGeneralInfo( $property ) {
|
||||
global $wgContLang;
|
||||
|
||||
$config = $this->getConfig();
|
||||
|
||||
$data = [];
|
||||
|
|
@ -164,8 +162,9 @@ class ApiQuerySiteinfo extends ApiQueryBase {
|
|||
$data['langconversion'] = !$config->get( 'DisableLangConversion' );
|
||||
$data['titleconversion'] = !$config->get( 'DisableTitleConversion' );
|
||||
|
||||
if ( $wgContLang->linkPrefixExtension() ) {
|
||||
$linkPrefixCharset = $wgContLang->linkPrefixCharset();
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
if ( $contLang->linkPrefixExtension() ) {
|
||||
$linkPrefixCharset = $contLang->linkPrefixCharset();
|
||||
$data['linkprefixcharset'] = $linkPrefixCharset;
|
||||
// For backwards compatibility
|
||||
$data['linkprefix'] = "/^((?>.*[^$linkPrefixCharset]|))(.+)$/sDu";
|
||||
|
|
@ -174,7 +173,7 @@ class ApiQuerySiteinfo extends ApiQueryBase {
|
|||
$data['linkprefix'] = '';
|
||||
}
|
||||
|
||||
$linktrail = $wgContLang->linkTrail();
|
||||
$linktrail = $contLang->linkTrail();
|
||||
$data['linktrail'] = $linktrail ?: '';
|
||||
|
||||
$data['legaltitlechars'] = Title::legalChars();
|
||||
|
|
@ -197,26 +196,26 @@ class ApiQuerySiteinfo extends ApiQueryBase {
|
|||
$data['lang'] = $config->get( 'LanguageCode' );
|
||||
|
||||
$fallbacks = [];
|
||||
foreach ( $wgContLang->getFallbackLanguages() as $code ) {
|
||||
foreach ( $contLang->getFallbackLanguages() as $code ) {
|
||||
$fallbacks[] = [ 'code' => $code ];
|
||||
}
|
||||
$data['fallback'] = $fallbacks;
|
||||
ApiResult::setIndexedTagName( $data['fallback'], 'lang' );
|
||||
|
||||
if ( $wgContLang->hasVariants() ) {
|
||||
if ( $contLang->hasVariants() ) {
|
||||
$variants = [];
|
||||
foreach ( $wgContLang->getVariants() as $code ) {
|
||||
foreach ( $contLang->getVariants() as $code ) {
|
||||
$variants[] = [
|
||||
'code' => $code,
|
||||
'name' => $wgContLang->getVariantname( $code ),
|
||||
'name' => $contLang->getVariantname( $code ),
|
||||
];
|
||||
}
|
||||
$data['variants'] = $variants;
|
||||
ApiResult::setIndexedTagName( $data['variants'], 'lang' );
|
||||
}
|
||||
|
||||
$data['rtl'] = $wgContLang->isRTL();
|
||||
$data['fallback8bitEncoding'] = $wgContLang->fallback8bitEncoding();
|
||||
$data['rtl'] = $contLang->isRTL();
|
||||
$data['fallback8bitEncoding'] = $contLang->fallback8bitEncoding();
|
||||
|
||||
$data['readonly'] = wfReadOnly();
|
||||
if ( $data['readonly'] ) {
|
||||
|
|
@ -280,11 +279,13 @@ class ApiQuerySiteinfo extends ApiQueryBase {
|
|||
}
|
||||
|
||||
protected function appendNamespaces( $property ) {
|
||||
global $wgContLang;
|
||||
$data = [
|
||||
ApiResult::META_TYPE => 'assoc',
|
||||
];
|
||||
foreach ( $wgContLang->getFormattedNamespaces() as $ns => $title ) {
|
||||
foreach (
|
||||
MediaWikiServices::getInstance()->getContentLanguage()->getFormattedNamespaces()
|
||||
as $ns => $title
|
||||
) {
|
||||
$data[$ns] = [
|
||||
'id' => intval( $ns ),
|
||||
'case' => MWNamespace::isCapitalized( $ns ) ? 'first-letter' : 'case-sensitive',
|
||||
|
|
@ -314,10 +315,10 @@ class ApiQuerySiteinfo extends ApiQueryBase {
|
|||
}
|
||||
|
||||
protected function appendNamespaceAliases( $property ) {
|
||||
global $wgContLang;
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
$aliases = array_merge( $this->getConfig()->get( 'NamespaceAliases' ),
|
||||
$wgContLang->getNamespaceAliases() );
|
||||
$namespaces = $wgContLang->getNamespaces();
|
||||
$contLang->getNamespaceAliases() );
|
||||
$namespaces = $contLang->getNamespaces();
|
||||
$data = [];
|
||||
foreach ( $aliases as $title => $ns ) {
|
||||
if ( $namespaces[$ns] == $title ) {
|
||||
|
|
@ -339,9 +340,8 @@ class ApiQuerySiteinfo extends ApiQueryBase {
|
|||
}
|
||||
|
||||
protected function appendSpecialPageAliases( $property ) {
|
||||
global $wgContLang;
|
||||
$data = [];
|
||||
$aliases = $wgContLang->getSpecialPageAliases();
|
||||
$aliases = MediaWikiServices::getInstance()->getContentLanguage()->getSpecialPageAliases();
|
||||
foreach ( SpecialPageFactory::getNames() as $specialpage ) {
|
||||
if ( isset( $aliases[$specialpage] ) ) {
|
||||
$arr = [ 'realname' => $specialpage, 'aliases' => $aliases[$specialpage] ];
|
||||
|
|
@ -355,9 +355,11 @@ class ApiQuerySiteinfo extends ApiQueryBase {
|
|||
}
|
||||
|
||||
protected function appendMagicWords( $property ) {
|
||||
global $wgContLang;
|
||||
$data = [];
|
||||
foreach ( $wgContLang->getMagicWords() as $magicword => $aliases ) {
|
||||
foreach (
|
||||
MediaWikiServices::getInstance()->getContentLanguage()->getMagicWords()
|
||||
as $magicword => $aliases
|
||||
) {
|
||||
$caseSensitive = array_shift( $aliases );
|
||||
$arr = [ 'name' => $magicword, 'aliases' => $aliases ];
|
||||
$arr['case-sensitive'] = (bool)$caseSensitive;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* This class represents the result of the API operations.
|
||||
* It simply wraps a nested array structure, adding some functions to simplify
|
||||
|
|
@ -330,8 +332,6 @@ class ApiResult implements ApiSerializable {
|
|||
* @return array|mixed|string
|
||||
*/
|
||||
private static function validateValue( $value ) {
|
||||
global $wgContLang;
|
||||
|
||||
if ( is_object( $value ) ) {
|
||||
// Note we use is_callable() here instead of instanceof because
|
||||
// ApiSerializable is an informal protocol (see docs there for details).
|
||||
|
|
@ -374,7 +374,7 @@ class ApiResult implements ApiSerializable {
|
|||
} elseif ( is_float( $value ) && !is_finite( $value ) ) {
|
||||
throw new InvalidArgumentException( 'Cannot add non-finite floats to ApiResult' );
|
||||
} elseif ( is_string( $value ) ) {
|
||||
$value = $wgContLang->normalize( $value );
|
||||
$value = MediaWikiServices::getInstance()->getContentLanguage()->normalize( $value );
|
||||
} elseif ( $value !== null && !is_scalar( $value ) ) {
|
||||
$type = gettype( $value );
|
||||
if ( is_resource( $value ) ) {
|
||||
|
|
|
|||
|
|
@ -2408,15 +2408,15 @@ class AuthManager implements LoggerAwareInterface {
|
|||
* @param bool $useContextLang Use 'uselang' to set the user's language
|
||||
*/
|
||||
private function setDefaultUserOptions( User $user, $useContextLang ) {
|
||||
global $wgContLang;
|
||||
|
||||
$user->setToken();
|
||||
|
||||
$lang = $useContextLang ? \RequestContext::getMain()->getLanguage() : $wgContLang;
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
|
||||
$lang = $useContextLang ? \RequestContext::getMain()->getLanguage() : $contLang;
|
||||
$user->setOption( 'language', $lang->getPreferredVariant() );
|
||||
|
||||
if ( $wgContLang->hasVariants() ) {
|
||||
$user->setOption( 'variant', $wgContLang->getPreferredVariant() );
|
||||
if ( $contLang->hasVariants() ) {
|
||||
$user->setOption( 'variant', $contLang->getPreferredVariant() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
8
includes/cache/HTMLFileCache.php
vendored
8
includes/cache/HTMLFileCache.php
vendored
|
|
@ -91,7 +91,6 @@ class HTMLFileCache extends FileCacheBase {
|
|||
* @return bool
|
||||
*/
|
||||
public static function useFileCache( IContextSource $context, $mode = self::MODE_NORMAL ) {
|
||||
global $wgContLang;
|
||||
$config = MediaWikiServices::getInstance()->getMainConfig();
|
||||
|
||||
if ( !$config->get( 'UseFileCache' ) && $mode !== self::MODE_REBUILD ) {
|
||||
|
|
@ -124,7 +123,8 @@ class HTMLFileCache extends FileCacheBase {
|
|||
$ulang = $context->getLanguage();
|
||||
|
||||
// Check that there are no other sources of variation
|
||||
if ( $user->getId() || !$ulang->equals( $wgContLang ) ) {
|
||||
if ( $user->getId() ||
|
||||
!$ulang->equals( MediaWikiServices::getInstance()->getContentLanguage() ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -145,7 +145,6 @@ class HTMLFileCache extends FileCacheBase {
|
|||
* @return void
|
||||
*/
|
||||
public function loadFromFileCache( IContextSource $context, $mode = self::MODE_NORMAL ) {
|
||||
global $wgContLang;
|
||||
$config = MediaWikiServices::getInstance()->getMainConfig();
|
||||
|
||||
wfDebug( __METHOD__ . "()\n" );
|
||||
|
|
@ -158,7 +157,8 @@ class HTMLFileCache extends FileCacheBase {
|
|||
|
||||
$context->getOutput()->sendCacheControl();
|
||||
header( "Content-Type: {$config->get( 'MimeType' )}; charset=UTF-8" );
|
||||
header( "Content-Language: {$wgContLang->getHtmlCode()}" );
|
||||
header( 'Content-Language: ' .
|
||||
MediaWikiServices::getInstance()->getContentLanguage()->getHtmlCode() );
|
||||
if ( $this->useGzip() ) {
|
||||
if ( wfClientAcceptsGzip() ) {
|
||||
header( 'Content-Encoding: gzip' );
|
||||
|
|
|
|||
3
includes/cache/LinkBatch.php
vendored
3
includes/cache/LinkBatch.php
vendored
|
|
@ -222,8 +222,7 @@ class LinkBatch {
|
|||
return false;
|
||||
}
|
||||
|
||||
global $wgContLang;
|
||||
if ( !$wgContLang->needsGenderDistinction() ) {
|
||||
if ( !MediaWikiServices::getInstance()->getContentLanguage()->needsGenderDistinction() ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
36
includes/cache/MessageCache.php
vendored
36
includes/cache/MessageCache.php
vendored
|
|
@ -88,6 +88,8 @@ class MessageCache {
|
|||
protected $clusterCache;
|
||||
/** @var BagOStuff */
|
||||
protected $srvCache;
|
||||
/** @var Language */
|
||||
protected $contLang;
|
||||
|
||||
/**
|
||||
* Singleton instance
|
||||
|
|
@ -112,7 +114,8 @@ class MessageCache {
|
|||
? MediaWikiServices::getInstance()->getLocalServerObjectCache()
|
||||
: new EmptyBagOStuff(),
|
||||
$wgUseDatabaseMessages,
|
||||
$wgMsgCacheExpiry
|
||||
$wgMsgCacheExpiry,
|
||||
MediaWikiServices::getInstance()->getContentLanguage()
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -135,13 +138,11 @@ class MessageCache {
|
|||
* @return string Normalized message key
|
||||
*/
|
||||
public static function normalizeKey( $key ) {
|
||||
global $wgContLang;
|
||||
|
||||
$lckey = strtr( $key, ' ', '_' );
|
||||
if ( ord( $lckey ) < 128 ) {
|
||||
$lckey[0] = strtolower( $lckey[0] );
|
||||
} else {
|
||||
$lckey = $wgContLang->lcfirst( $lckey );
|
||||
$lckey = MediaWikiServices::getInstance()->getContentLanguage()->lcfirst( $lckey );
|
||||
}
|
||||
|
||||
return $lckey;
|
||||
|
|
@ -153,13 +154,15 @@ class MessageCache {
|
|||
* @param BagOStuff $serverCache
|
||||
* @param bool $useDB Whether to look for message overrides (e.g. MediaWiki: pages)
|
||||
* @param int $expiry Lifetime for cache. @see $mExpiry.
|
||||
* @param Language|null $contLang Content language of site
|
||||
*/
|
||||
public function __construct(
|
||||
WANObjectCache $wanCache,
|
||||
BagOStuff $clusterCache,
|
||||
BagOStuff $serverCache,
|
||||
$useDB,
|
||||
$expiry
|
||||
$expiry,
|
||||
Language $contLang = null
|
||||
) {
|
||||
$this->wanCache = $wanCache;
|
||||
$this->clusterCache = $clusterCache;
|
||||
|
|
@ -169,6 +172,7 @@ class MessageCache {
|
|||
|
||||
$this->mDisable = !$useDB;
|
||||
$this->mExpiry = $expiry;
|
||||
$this->contLang = $contLang ?? MediaWikiServices::getInstance()->getContentLanguage();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -581,7 +585,7 @@ class MessageCache {
|
|||
// (b) Update the shared caches in a deferred update with a fresh DB snapshot
|
||||
DeferredUpdates::addCallableUpdate(
|
||||
function () use ( $title, $msg, $code ) {
|
||||
global $wgContLang, $wgMaxMsgCacheEntrySize;
|
||||
global $wgMaxMsgCacheEntrySize;
|
||||
// Allow one caller at a time to avoid race conditions
|
||||
$scopedLock = $this->getReentrantScopedLock(
|
||||
$this->clusterCache->makeKey( 'messages', $code )
|
||||
|
|
@ -627,7 +631,7 @@ class MessageCache {
|
|||
// Purge the message in the message blob store
|
||||
$resourceloader = RequestContext::getMain()->getOutput()->getResourceLoader();
|
||||
$blobStore = $resourceloader->getMessageBlobStore();
|
||||
$blobStore->updateMessage( $wgContLang->lcfirst( $msg ) );
|
||||
$blobStore->updateMessage( $this->contLang->lcfirst( $msg ) );
|
||||
|
||||
Hooks::run( 'MessageCacheReplace', [ $title, $text ] );
|
||||
},
|
||||
|
|
@ -860,8 +864,6 @@ class MessageCache {
|
|||
* @return string|bool The message, or false if not found
|
||||
*/
|
||||
protected function getMessageFromFallbackChain( $lang, $lckey, $useDB ) {
|
||||
global $wgContLang;
|
||||
|
||||
$alreadyTried = [];
|
||||
|
||||
// First try the requested language.
|
||||
|
|
@ -871,7 +873,7 @@ class MessageCache {
|
|||
}
|
||||
|
||||
// Now try checking the site language.
|
||||
$message = $this->getMessageForLang( $wgContLang, $lckey, $useDB, $alreadyTried );
|
||||
$message = $this->getMessageForLang( $this->contLang, $lckey, $useDB, $alreadyTried );
|
||||
return $message;
|
||||
}
|
||||
|
||||
|
|
@ -886,13 +888,11 @@ class MessageCache {
|
|||
* @return string|bool The message, or false if not found
|
||||
*/
|
||||
private function getMessageForLang( $lang, $lckey, $useDB, &$alreadyTried ) {
|
||||
global $wgContLang;
|
||||
|
||||
$langcode = $lang->getCode();
|
||||
|
||||
// Try checking the database for the requested language
|
||||
if ( $useDB ) {
|
||||
$uckey = $wgContLang->ucfirst( $lckey );
|
||||
$uckey = $this->contLang->ucfirst( $lckey );
|
||||
|
||||
if ( !isset( $alreadyTried[$langcode] ) ) {
|
||||
$message = $this->getMsgFromNamespace(
|
||||
|
|
@ -1241,8 +1241,6 @@ class MessageCache {
|
|||
* @return array Array of message keys (strings)
|
||||
*/
|
||||
public function getAllMessageKeys( $code ) {
|
||||
global $wgContLang;
|
||||
|
||||
$this->load( $code );
|
||||
if ( !$this->cache->has( $code ) ) {
|
||||
// Apparently load() failed
|
||||
|
|
@ -1257,7 +1255,7 @@ class MessageCache {
|
|||
$cache = array_diff( $cache, [ '!NONEXISTENT' ] );
|
||||
|
||||
// Keys may appear with a capital first letter. lcfirst them.
|
||||
return array_map( [ $wgContLang, 'lcfirst' ], array_keys( $cache ) );
|
||||
return array_map( [ $this->contLang, 'lcfirst' ], array_keys( $cache ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1268,8 +1266,6 @@ class MessageCache {
|
|||
* @since 1.29
|
||||
*/
|
||||
public function updateMessageOverride( Title $title, Content $content = null ) {
|
||||
global $wgContLang;
|
||||
|
||||
$msgText = $this->getMessageTextFromContent( $content );
|
||||
if ( $msgText === null ) {
|
||||
$msgText = false; // treat as not existing
|
||||
|
|
@ -1277,8 +1273,8 @@ class MessageCache {
|
|||
|
||||
$this->replace( $title->getDBkey(), $msgText );
|
||||
|
||||
if ( $wgContLang->hasVariants() ) {
|
||||
$wgContLang->updateConversionTable( $title );
|
||||
if ( $this->contLang->hasVariants() ) {
|
||||
$this->contLang->updateConversionTable( $title );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* @since 1.16.3
|
||||
* @author Tim Starling
|
||||
|
|
@ -46,13 +48,12 @@ abstract class Collation {
|
|||
* @return Collation
|
||||
*/
|
||||
public static function factory( $collationName ) {
|
||||
global $wgContLang;
|
||||
|
||||
switch ( $collationName ) {
|
||||
case 'uppercase':
|
||||
return new UppercaseCollation;
|
||||
case 'numeric':
|
||||
return new NumericUppercaseCollation( $wgContLang );
|
||||
return new NumericUppercaseCollation(
|
||||
MediaWikiServices::getInstance()->getContentLanguage() );
|
||||
case 'identity':
|
||||
return new IdentityCollation;
|
||||
case 'uca-default':
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* Collation class that's essentially a no-op.
|
||||
*
|
||||
|
|
@ -33,12 +35,11 @@ class IdentityCollation extends Collation {
|
|||
}
|
||||
|
||||
public function getFirstLetter( $string ) {
|
||||
global $wgContLang;
|
||||
// Copied from UppercaseCollation.
|
||||
// I'm kind of unclear on when this could happen...
|
||||
if ( $string[0] == "\0" ) {
|
||||
$string = substr( $string, 1 );
|
||||
}
|
||||
return $wgContLang->firstChar( $string );
|
||||
return MediaWikiServices::getInstance()->getContentLanguage()->firstChar( $string );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
class NumericUppercaseCollation extends UppercaseCollation {
|
||||
|
||||
/**
|
||||
* @var $digitTransformLang Language How to convert digits (usually $wgContLang)
|
||||
* @var $digitTransformLang Language How to convert digits (usually the content language)
|
||||
*/
|
||||
private $digitTransformLang;
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ class NumericUppercaseCollation extends UppercaseCollation {
|
|||
* @param Language $lang How to convert digits.
|
||||
* For example, if given language "my" than ၇ is treated like 7.
|
||||
*
|
||||
* It is expected that usually this is given $wgContLang.
|
||||
* It is expected that usually this is given the content language.
|
||||
*/
|
||||
public function __construct( Language $lang ) {
|
||||
$this->digitTransformLang = $lang;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Search\ParserOutputSearchDataExtractor;
|
||||
|
||||
/**
|
||||
|
|
@ -642,7 +643,7 @@ abstract class ContentHandler {
|
|||
/**
|
||||
* Get the language in which the content of the given page is written.
|
||||
*
|
||||
* This default implementation just returns $wgContLang (except for pages
|
||||
* This default implementation just returns the content language (except for pages
|
||||
* in the MediaWiki namespace)
|
||||
*
|
||||
* Note that the pages language is not cacheable, since it may in some
|
||||
|
|
@ -659,8 +660,8 @@ abstract class ContentHandler {
|
|||
* @return Language The page's language
|
||||
*/
|
||||
public function getPageLanguage( Title $title, Content $content = null ) {
|
||||
global $wgContLang, $wgLang;
|
||||
$pageLang = $wgContLang;
|
||||
global $wgLang;
|
||||
$pageLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
|
||||
if ( $title->getNamespace() == NS_MEDIAWIKI ) {
|
||||
// Parse mediawiki messages with correct target language
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@
|
|||
* @author Daniel Kinzler
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* Content object implementation for representing flat text.
|
||||
*
|
||||
|
|
@ -71,13 +73,10 @@ class TextContent extends AbstractContent {
|
|||
}
|
||||
|
||||
public function getTextForSummary( $maxlength = 250 ) {
|
||||
global $wgContLang;
|
||||
|
||||
$text = $this->getNativeData();
|
||||
|
||||
$truncatedtext = $wgContLang->truncateForDatabase(
|
||||
preg_replace( "/[\n\r]/", ' ', $text ),
|
||||
max( 0, $maxlength ) );
|
||||
$truncatedtext = MediaWikiServices::getInstance()->getContentLanguage()->
|
||||
truncateForDatabase( preg_replace( "/[\n\r]/", ' ', $text ), max( 0, $maxlength ) );
|
||||
|
||||
return $truncatedtext;
|
||||
}
|
||||
|
|
@ -195,20 +194,18 @@ class TextContent extends AbstractContent {
|
|||
*
|
||||
* @param Content $that The other content object to compare this content object to.
|
||||
* @param Language|null $lang The language object to use for text segmentation.
|
||||
* If not given, $wgContentLang is used.
|
||||
* If not given, the content language is used.
|
||||
*
|
||||
* @return Diff A diff representing the changes that would have to be
|
||||
* made to this content object to make it equal to $that.
|
||||
*/
|
||||
public function diff( Content $that, Language $lang = null ) {
|
||||
global $wgContLang;
|
||||
|
||||
$this->checkModelID( $that->getModel() );
|
||||
|
||||
// @todo could implement this in DifferenceEngine and just delegate here?
|
||||
|
||||
if ( !$lang ) {
|
||||
$lang = $wgContLang;
|
||||
$lang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
}
|
||||
|
||||
$otext = $this->getNativeData();
|
||||
|
|
|
|||
|
|
@ -325,8 +325,6 @@ class RequestContext implements IContextSource, MutableContext {
|
|||
} elseif ( $this->lang === null ) {
|
||||
$this->recursion = true;
|
||||
|
||||
global $wgContLang;
|
||||
|
||||
try {
|
||||
$request = $this->getRequest();
|
||||
$user = $this->getUser();
|
||||
|
|
@ -340,7 +338,7 @@ class RequestContext implements IContextSource, MutableContext {
|
|||
Hooks::run( 'UserGetLanguageObject', [ $user, &$code, $this ] );
|
||||
|
||||
if ( $code === $this->getConfig()->get( 'LanguageCode' ) ) {
|
||||
$this->lang = $wgContLang;
|
||||
$this->lang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
} else {
|
||||
$obj = Language::factory( $code );
|
||||
$this->lang = $obj;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
* @ingroup Database
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use Wikimedia\Rdbms\Database;
|
||||
use Wikimedia\Rdbms\Blob;
|
||||
use Wikimedia\Rdbms\ResultWrapper;
|
||||
|
|
@ -446,8 +447,6 @@ class DatabaseOracle extends Database {
|
|||
* @throws DBUnexpectedError
|
||||
*/
|
||||
private function insertOneRow( $table, $row, $fname ) {
|
||||
global $wgContLang;
|
||||
|
||||
$table = $this->tableName( $table );
|
||||
// "INSERT INTO tables (a, b, c)"
|
||||
$sql = "INSERT INTO " . $table . " (" . implode( ',', array_keys( $row ) ) . ')';
|
||||
|
|
@ -493,7 +492,8 @@ class DatabaseOracle extends Database {
|
|||
$val = $this->getInfinity();
|
||||
}
|
||||
|
||||
$val = ( $wgContLang != null ) ? $wgContLang->checkTitleEncoding( $val ) : $val;
|
||||
$val = MediaWikiServices::getInstance()->getContentLanguage()->
|
||||
checkTitleEncoding( $val );
|
||||
if ( oci_bind_by_name( $stmt, ":$col", $val, -1, SQLT_CHR ) === false ) {
|
||||
$e = oci_error( $stmt );
|
||||
$this->reportQueryError( $e['message'], $e['code'], $sql, __METHOD__ );
|
||||
|
|
@ -1067,9 +1067,9 @@ class DatabaseOracle extends Database {
|
|||
}
|
||||
|
||||
function addQuotes( $s ) {
|
||||
global $wgContLang;
|
||||
if ( isset( $wgContLang->mLoaded ) && $wgContLang->mLoaded ) {
|
||||
$s = $wgContLang->checkTitleEncoding( $s );
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
if ( isset( $contLang->mLoaded ) && $contLang->mLoaded ) {
|
||||
$s = $contLang->checkTitleEncoding( $s );
|
||||
}
|
||||
|
||||
return "'" . $this->strencode( $s ) . "'";
|
||||
|
|
@ -1092,15 +1092,15 @@ class DatabaseOracle extends Database {
|
|||
}
|
||||
|
||||
private function wrapFieldForWhere( $table, &$col, &$val ) {
|
||||
global $wgContLang;
|
||||
|
||||
$col_info = $this->fieldInfoMulti( $table, $col );
|
||||
$col_type = $col_info != false ? $col_info->type() : 'CONSTANT';
|
||||
if ( $col_type == 'CLOB' ) {
|
||||
$col = 'TO_CHAR(' . $col . ')';
|
||||
$val = $wgContLang->checkTitleEncoding( $val );
|
||||
$val =
|
||||
MediaWikiServices::getInstance()->getContentLanguage()->checkTitleEncoding( $val );
|
||||
} elseif ( $col_type == 'VARCHAR2' ) {
|
||||
$val = $wgContLang->checkTitleEncoding( $val );
|
||||
$val =
|
||||
MediaWikiServices::getInstance()->getContentLanguage()->checkTitleEncoding( $val );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1225,8 +1225,6 @@ class DatabaseOracle extends Database {
|
|||
* @throws DBUnexpectedError
|
||||
*/
|
||||
function update( $table, $values, $conds, $fname = __METHOD__, $options = [] ) {
|
||||
global $wgContLang;
|
||||
|
||||
$table = $this->tableName( $table );
|
||||
$opts = $this->makeUpdateOptions( $options );
|
||||
$sql = "UPDATE $opts $table SET ";
|
||||
|
|
@ -1270,7 +1268,8 @@ class DatabaseOracle extends Database {
|
|||
$val = '31-12-2030 12:00:00.000000';
|
||||
}
|
||||
|
||||
$val = ( $wgContLang != null ) ? $wgContLang->checkTitleEncoding( $val ) : $val;
|
||||
$val = MediaWikiServices::getInstance()->getContentLanguage()->
|
||||
checkTitleEncoding( $val );
|
||||
if ( oci_bind_by_name( $stmt, ":$col", $val ) === false ) {
|
||||
$e = oci_error( $stmt );
|
||||
$this->reportQueryError( $e['message'], $e['code'], $sql, __METHOD__ );
|
||||
|
|
|
|||
|
|
@ -581,12 +581,13 @@ class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate {
|
|||
* @return array
|
||||
*/
|
||||
private function getCategoryInsertions( $existing = [] ) {
|
||||
global $wgContLang, $wgCategoryCollation;
|
||||
global $wgCategoryCollation;
|
||||
$diffs = array_diff_assoc( $this->mCategories, $existing );
|
||||
$arr = [];
|
||||
foreach ( $diffs as $name => $prefix ) {
|
||||
$nt = Title::makeTitleSafe( NS_CATEGORY, $name );
|
||||
$wgContLang->findVariantLink( $name, $nt, true );
|
||||
MediaWikiServices::getInstance()->getContentLanguage()->
|
||||
findVariantLink( $name, $nt, true );
|
||||
|
||||
$type = MWNamespace::getCategoryLinkType( $this->mTitle->getNamespace() );
|
||||
|
||||
|
|
|
|||
|
|
@ -117,15 +117,14 @@ class SearchUpdate implements DeferrableUpdate {
|
|||
* @return string
|
||||
*/
|
||||
public function updateText( $text, SearchEngine $se = null ) {
|
||||
global $wgContLang;
|
||||
|
||||
# Language-specific strip/conversion
|
||||
$text = $wgContLang->normalizeForSearch( $text );
|
||||
$text = MediaWikiServices::getInstance()->getContentLanguage()->normalizeForSearch( $text );
|
||||
$se = $se ?: MediaWikiServices::getInstance()->newSearchEngine();
|
||||
$lc = $se->legalSearchChars() . '&#;';
|
||||
|
||||
# Strip HTML markup
|
||||
$text = preg_replace( "/<\\/?\\s*[A-Za-z][^>]*?>/",
|
||||
' ', $wgContLang->lc( " " . $text . " " ) ); # Strip HTML markup
|
||||
' ', MediaWikiServices::getInstance()->getContentLanguage()->lc( " " . $text . " " ) );
|
||||
$text = preg_replace( "/(^|\\n)==\\s*([^\\n]+)\\s*==(\\s)/sD",
|
||||
"\\1\\2 \\2 \\2\\3", $text ); # Emphasize headings
|
||||
|
||||
|
|
@ -200,15 +199,13 @@ class SearchUpdate implements DeferrableUpdate {
|
|||
* @return string A stripped-down title string ready for the search index
|
||||
*/
|
||||
private function getNormalizedTitle( SearchEngine $search ) {
|
||||
global $wgContLang;
|
||||
|
||||
$ns = $this->title->getNamespace();
|
||||
$title = $this->title->getText();
|
||||
|
||||
$lc = $search->legalSearchChars() . '&#;';
|
||||
$t = $wgContLang->normalizeForSearch( $title );
|
||||
$t = MediaWikiServices::getInstance()->getContentLanguage()->normalizeForSearch( $title );
|
||||
$t = preg_replace( "/[^{$lc}]+/", ' ', $t );
|
||||
$t = $wgContLang->lc( $t );
|
||||
$t = MediaWikiServices::getInstance()->getContentLanguage()->lc( $t );
|
||||
|
||||
# Handle 's, s'
|
||||
$t = preg_replace( "/([{$lc}]+)'s( |$)/", "\\1 \\1's ", $t );
|
||||
|
|
|
|||
|
|
@ -992,8 +992,6 @@ class DifferenceEngine extends ContextSource {
|
|||
* @return bool|string
|
||||
*/
|
||||
protected function textDiff( $otext, $ntext ) {
|
||||
global $wgContLang;
|
||||
|
||||
$otext = str_replace( "\r\n", "\n", $otext );
|
||||
$ntext = str_replace( "\r\n", "\n", $ntext );
|
||||
|
||||
|
|
@ -1067,11 +1065,12 @@ class DifferenceEngine extends ContextSource {
|
|||
}
|
||||
|
||||
# Native PHP diff
|
||||
$ota = explode( "\n", $wgContLang->segmentForDiff( $otext ) );
|
||||
$nta = explode( "\n", $wgContLang->segmentForDiff( $ntext ) );
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
$ota = explode( "\n", $contLang->segmentForDiff( $otext ) );
|
||||
$nta = explode( "\n", $contLang->segmentForDiff( $ntext ) );
|
||||
$diffs = new Diff( $ota, $nta );
|
||||
$formatter = new TableDiffFormatter();
|
||||
$difftext = $wgContLang->unsegmentForDiff( $formatter->format( $diffs ) );
|
||||
$difftext = $contLang->unsegmentForDiff( $formatter->format( $diffs ) );
|
||||
$difftext .= $this->debug( 'native PHP' );
|
||||
|
||||
return $difftext;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* @ingroup Dump
|
||||
*/
|
||||
|
|
@ -38,7 +40,6 @@ class XmlDumpWriter {
|
|||
* @return string
|
||||
*/
|
||||
function openStream() {
|
||||
global $wgContLang;
|
||||
$ver = WikiExporter::schemaVersion();
|
||||
return Xml::element( 'mediawiki', [
|
||||
'xmlns' => "http://www.mediawiki.org/xml/export-$ver/",
|
||||
|
|
@ -55,8 +56,8 @@ class XmlDumpWriter {
|
|||
*/
|
||||
'xsi:schemaLocation' => "http://www.mediawiki.org/xml/export-$ver/ " .
|
||||
"http://www.mediawiki.org/xml/export-$ver.xsd",
|
||||
'version' => $ver,
|
||||
'xml:lang' => $wgContLang->getHtmlCode() ],
|
||||
'version' => $ver,
|
||||
'xml:lang' => MediaWikiServices::getInstance()->getContentLanguage()->getHtmlCode() ],
|
||||
null ) .
|
||||
"\n" .
|
||||
$this->siteInfo();
|
||||
|
|
@ -123,9 +124,11 @@ class XmlDumpWriter {
|
|||
* @return string
|
||||
*/
|
||||
function namespaces() {
|
||||
global $wgContLang;
|
||||
$spaces = "<namespaces>\n";
|
||||
foreach ( $wgContLang->getFormattedNamespaces() as $ns => $title ) {
|
||||
foreach (
|
||||
MediaWikiServices::getInstance()->getContentLanguage()->getFormattedNamespaces()
|
||||
as $ns => $title
|
||||
) {
|
||||
$spaces .= ' ' .
|
||||
Xml::element( 'namespace',
|
||||
[
|
||||
|
|
@ -434,8 +437,8 @@ class XmlDumpWriter {
|
|||
return $title->getPrefixedText();
|
||||
}
|
||||
|
||||
global $wgContLang;
|
||||
$prefix = $wgContLang->getFormattedNsText( $title->getNamespace() );
|
||||
$prefix = MediaWikiServices::getInstance()->getContentLanguage()->
|
||||
getFormattedNsText( $title->getNamespace() );
|
||||
|
||||
// @todo Emit some kind of warning to the user if $title->getNamespace() !==
|
||||
// NS_MAIN and $prefix === '' (viz. pages in an unregistered namespace)
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@
|
|||
* @details
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* Base code for file repositories.
|
||||
*
|
||||
|
|
@ -638,11 +640,10 @@ class FileRepo {
|
|||
* @return string
|
||||
*/
|
||||
public function getNameFromTitle( Title $title ) {
|
||||
global $wgContLang;
|
||||
if ( $this->initialCapital != MWNamespace::isCapitalized( NS_FILE ) ) {
|
||||
$name = $title->getUserCaseDBKey();
|
||||
if ( $this->initialCapital ) {
|
||||
$name = $wgContLang->ucfirst( $name );
|
||||
$name = MediaWikiServices::getInstance()->getContentLanguage()->ucfirst( $name );
|
||||
}
|
||||
} else {
|
||||
$name = $title->getDBkey();
|
||||
|
|
|
|||
|
|
@ -278,7 +278,6 @@ class LocalRepo extends FileRepo {
|
|||
$applyMatchingFiles = function ( ResultWrapper $res, &$searchSet, &$finalFiles )
|
||||
use ( $fileMatchesSearch, $flags )
|
||||
{
|
||||
global $wgContLang;
|
||||
$info = $this->getInfo();
|
||||
foreach ( $res as $row ) {
|
||||
$file = $this->newFileFromRow( $row );
|
||||
|
|
@ -287,7 +286,8 @@ class LocalRepo extends FileRepo {
|
|||
$dbKeysLook = [ strtr( $file->getName(), ' ', '_' ) ];
|
||||
if ( !empty( $info['initialCapital'] ) ) {
|
||||
// Search keys for "hi.png" and "Hi.png" should use the "Hi.png file"
|
||||
$dbKeysLook[] = $wgContLang->lcfirst( $file->getName() );
|
||||
$dbKeysLook[] = MediaWikiServices::getInstance()->getContentLanguage()->
|
||||
lcfirst( $file->getName() );
|
||||
}
|
||||
foreach ( $dbKeysLook as $dbKey ) {
|
||||
if ( isset( $searchSet[$dbKey] )
|
||||
|
|
|
|||
|
|
@ -355,9 +355,8 @@ class ForeignAPIFile extends File {
|
|||
}
|
||||
|
||||
function purgeDescriptionPage() {
|
||||
global $wgContLang;
|
||||
|
||||
$url = $this->repo->getDescriptionRenderUrl( $this->getName(), $wgContLang->getCode() );
|
||||
$url = $this->repo->getDescriptionRenderUrl(
|
||||
$this->getName(), MediaWikiServices::getInstance()->getContentLanguage()->getCode() );
|
||||
$key = $this->repo->getLocalCacheKey( 'RemoteFileDescription', 'url', md5( $url ) );
|
||||
|
||||
MediaWikiServices::getInstance()->getMainWANObjectCache()->delete( $key );
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* Image gallery
|
||||
*
|
||||
|
|
@ -99,7 +101,6 @@ abstract class ImageGalleryBase extends ContextSource {
|
|||
* @throws MWException
|
||||
*/
|
||||
static function factory( $mode = false, IContextSource $context = null ) {
|
||||
global $wgContLang;
|
||||
self::loadModes();
|
||||
if ( !$context ) {
|
||||
$context = RequestContext::getMainAndWarn( __METHOD__ );
|
||||
|
|
@ -109,7 +110,7 @@ abstract class ImageGalleryBase extends ContextSource {
|
|||
$mode = $galleryOptions['mode'];
|
||||
}
|
||||
|
||||
$mode = $wgContLang->lc( $mode );
|
||||
$mode = MediaWikiServices::getInstance()->getContentLanguage()->lc( $mode );
|
||||
|
||||
if ( isset( self::$modeMapping[$mode] ) ) {
|
||||
$class = self::$modeMapping[$mode];
|
||||
|
|
|
|||
|
|
@ -170,8 +170,8 @@ class TraditionalImageGallery extends ImageGalleryBase {
|
|||
}
|
||||
|
||||
// @todo Code is incomplete.
|
||||
// $linkTarget = Title::newFromText( $wgContLang->getNsText( MWNamespace::getUser() ) .
|
||||
// ":{$ut}" );
|
||||
// $linkTarget = Title::newFromText( MediaWikiServices::getInstance()->
|
||||
// getContentLanguage()->getNsText( MWNamespace::getUser() ) . ":{$ut}" );
|
||||
// $ul = Linker::link( $linkTarget, $ut );
|
||||
|
||||
$meta = [];
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Widget\TitleInputWidget;
|
||||
|
||||
/**
|
||||
|
|
@ -56,8 +57,8 @@ class HTMLTitleTextField extends HTMLTextField {
|
|||
$title = Title::newFromTextThrow( $value );
|
||||
} else {
|
||||
// Can't use Title::makeTitleSafe(), because it doesn't throw useful exceptions
|
||||
global $wgContLang;
|
||||
$namespaceName = $wgContLang->getNsText( $this->mParams['namespace'] );
|
||||
$namespaceName = MediaWikiServices::getInstance()->getContentLanguage()->
|
||||
getNsText( $this->mParams['namespace'] );
|
||||
$title = Title::newFromTextThrow( $namespaceName . ':' . $value );
|
||||
}
|
||||
} catch ( MalformedTitleException $e ) {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
* @ingroup SpecialPage
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* XML file reader for the page data importer.
|
||||
*
|
||||
|
|
@ -286,11 +288,10 @@ class WikiImporter {
|
|||
$status->fatal( 'import-rootpage-invalid' );
|
||||
} else {
|
||||
if ( !MWNamespace::hasSubpages( $title->getNamespace() ) ) {
|
||||
global $wgContLang;
|
||||
|
||||
$displayNSText = $title->getNamespace() == NS_MAIN
|
||||
? wfMessage( 'blanknamespace' )->text()
|
||||
: $wgContLang->getNsText( $title->getNamespace() );
|
||||
: MediaWikiServices::getInstance()->getContentLanguage()->
|
||||
getNsText( $title->getNamespace() );
|
||||
$status->fatal( 'import-rootpage-nosubpage', $displayNSText );
|
||||
} else {
|
||||
// set namespace to 'all', so the namespace check in processTitle() can pass
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
* @ingroup Deployment
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* Class for the core installer command line interface.
|
||||
*
|
||||
|
|
@ -69,9 +71,9 @@ class CliInstaller extends Installer {
|
|||
if ( isset( $option['lang'] ) ) {
|
||||
global $wgLang, $wgLanguageCode;
|
||||
$this->setVar( '_UserLang', $option['lang'] );
|
||||
$wgContLang = Language::factory( $option['lang'] );
|
||||
$wgLang = Language::factory( $option['lang'] );
|
||||
$wgLanguageCode = $option['lang'];
|
||||
$wgContLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
$wgLang = Language::factory( $option['lang'] );
|
||||
RequestContext::getMain()->setLanguage( $wgLang );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -756,8 +756,9 @@ class MysqlUpdater extends DatabaseUpdater {
|
|||
'Converting links and brokenlinks tables to pagelinks'
|
||||
);
|
||||
|
||||
global $wgContLang;
|
||||
foreach ( $wgContLang->getNamespaces() as $ns => $name ) {
|
||||
foreach (
|
||||
MediaWikiServices::getInstance()->getContentLanguage()->getNamespaces() as $ns => $name
|
||||
) {
|
||||
if ( $ns == 0 ) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
* @ingroup Deployment
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* Class for the core installer web interface.
|
||||
*
|
||||
|
|
@ -500,14 +502,14 @@ class WebInstaller extends Installer {
|
|||
|
||||
if ( $this->getSession( 'test' ) === null && !$this->request->wasPosted() ) {
|
||||
$wgLanguageCode = $this->getAcceptLanguage();
|
||||
$wgLang = $wgContLang = Language::factory( $wgLanguageCode );
|
||||
$wgLang = Language::factory( $wgLanguageCode );
|
||||
RequestContext::getMain()->setLanguage( $wgLang );
|
||||
$this->setVar( 'wgLanguageCode', $wgLanguageCode );
|
||||
$this->setVar( '_UserLang', $wgLanguageCode );
|
||||
} else {
|
||||
$wgLanguageCode = $this->getVar( 'wgLanguageCode' );
|
||||
$wgContLang = Language::factory( $wgLanguageCode );
|
||||
}
|
||||
$wgContLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
* @ingroup Deployment
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
class WebInstallerName extends WebInstallerPage {
|
||||
|
||||
/**
|
||||
|
|
@ -186,8 +188,7 @@ class WebInstallerName extends WebInstallerPage {
|
|||
}
|
||||
|
||||
// Make sure it won't conflict with any existing namespaces
|
||||
global $wgContLang;
|
||||
$nsIndex = $wgContLang->getNsIndex( $name );
|
||||
$nsIndex = MediaWikiServices::getInstance()->getContentLanguage()->getNsIndex( $name );
|
||||
if ( $nsIndex !== false && $nsIndex !== NS_PROJECT ) {
|
||||
$this->parent->showError( 'config-ns-conflict', $name );
|
||||
$retVal = false;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class ClassicInterwikiLookup implements InterwikiLookup {
|
|||
/**
|
||||
* @var Language
|
||||
*/
|
||||
private $contentLanguage;
|
||||
private $contLang;
|
||||
|
||||
/**
|
||||
* @var WANObjectCache
|
||||
|
|
@ -91,7 +91,7 @@ class ClassicInterwikiLookup implements InterwikiLookup {
|
|||
private $thisSite = null;
|
||||
|
||||
/**
|
||||
* @param Language $contentLanguage Language object used to convert prefixes to lower case
|
||||
* @param Language $contLang Language object used to convert prefixes to lower case
|
||||
* @param WANObjectCache $objectCache Cache for interwiki info retrieved from the database
|
||||
* @param int $objectCacheExpiry Expiry time for $objectCache, in seconds
|
||||
* @param bool|array|string $cdbData The path of a CDB file, or
|
||||
|
|
@ -104,7 +104,7 @@ class ClassicInterwikiLookup implements InterwikiLookup {
|
|||
* @param string $fallbackSite The code to assume for the local site,
|
||||
*/
|
||||
function __construct(
|
||||
Language $contentLanguage,
|
||||
Language $contLang,
|
||||
WANObjectCache $objectCache,
|
||||
$objectCacheExpiry,
|
||||
$cdbData,
|
||||
|
|
@ -113,7 +113,7 @@ class ClassicInterwikiLookup implements InterwikiLookup {
|
|||
) {
|
||||
$this->localCache = new MapCacheLRU( 100 );
|
||||
|
||||
$this->contentLanguage = $contentLanguage;
|
||||
$this->contLang = $contLang;
|
||||
$this->objectCache = $objectCache;
|
||||
$this->objectCacheExpiry = $objectCacheExpiry;
|
||||
$this->cdbData = $cdbData;
|
||||
|
|
@ -144,7 +144,7 @@ class ClassicInterwikiLookup implements InterwikiLookup {
|
|||
return null;
|
||||
}
|
||||
|
||||
$prefix = $this->contentLanguage->lc( $prefix );
|
||||
$prefix = $this->contLang->lc( $prefix );
|
||||
if ( $this->localCache->has( $prefix ) ) {
|
||||
return $this->localCache->get( $prefix );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -227,8 +227,6 @@ class LogFormatter {
|
|||
* @return string Text
|
||||
*/
|
||||
public function getIRCActionText() {
|
||||
global $wgContLang;
|
||||
|
||||
$this->plaintext = true;
|
||||
$this->irctext = true;
|
||||
|
||||
|
|
@ -238,6 +236,7 @@ class LogFormatter {
|
|||
// Text of title the action is aimed at.
|
||||
$target = $entry->getTarget()->getPrefixedText();
|
||||
$text = null;
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
switch ( $entry->getType() ) {
|
||||
case 'move':
|
||||
switch ( $entry->getSubtype() ) {
|
||||
|
|
@ -383,12 +382,12 @@ class LogFormatter {
|
|||
$rawDuration = $parameters['5::duration'];
|
||||
$rawFlags = $parameters['6::flags'];
|
||||
}
|
||||
$duration = $wgContLang->translateBlockExpiry(
|
||||
$duration = $contLang->translateBlockExpiry(
|
||||
$rawDuration,
|
||||
null,
|
||||
wfTimestamp( TS_UNIX, $entry->getTimestamp() )
|
||||
);
|
||||
$flags = BlockLogFormatter::formatBlockFlags( $rawFlags, $wgContLang );
|
||||
$flags = BlockLogFormatter::formatBlockFlags( $rawFlags, $contLang );
|
||||
$text = wfMessage( 'blocklogentry' )
|
||||
->rawParams( $target, $duration, $flags )->inContentLanguage()->escaped();
|
||||
break;
|
||||
|
|
@ -397,12 +396,13 @@ class LogFormatter {
|
|||
->rawParams( $target )->inContentLanguage()->escaped();
|
||||
break;
|
||||
case 'reblock':
|
||||
$duration = $wgContLang->translateBlockExpiry(
|
||||
$duration = $contLang->translateBlockExpiry(
|
||||
$parameters['5::duration'],
|
||||
null,
|
||||
wfTimestamp( TS_UNIX, $entry->getTimestamp() )
|
||||
);
|
||||
$flags = BlockLogFormatter::formatBlockFlags( $parameters['6::flags'], $wgContLang );
|
||||
$flags = BlockLogFormatter::formatBlockFlags( $parameters['6::flags'],
|
||||
$contLang );
|
||||
$text = wfMessage( 'reblock-logentry' )
|
||||
->rawParams( $target, $duration, $flags )->inContentLanguage()->escaped();
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -223,10 +223,10 @@ class LogPage {
|
|||
public static function actionText( $type, $action, $title = null, $skin = null,
|
||||
$params = [], $filterWikilinks = false
|
||||
) {
|
||||
global $wgLang, $wgContLang, $wgLogActions;
|
||||
global $wgLang, $wgLogActions;
|
||||
|
||||
if ( is_null( $skin ) ) {
|
||||
$langObj = $wgContLang;
|
||||
$langObj = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
$langObjOrNull = null;
|
||||
} else {
|
||||
$langObj = $wgLang;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
* @since 1.26
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* This class formats protect log entries.
|
||||
*
|
||||
|
|
@ -146,13 +148,12 @@ class ProtectLogFormatter extends LogFormatter {
|
|||
}
|
||||
|
||||
public function formatParametersForApi() {
|
||||
global $wgContLang;
|
||||
|
||||
$ret = parent::formatParametersForApi();
|
||||
if ( isset( $ret['details'] ) && is_array( $ret['details'] ) ) {
|
||||
foreach ( $ret['details'] as &$detail ) {
|
||||
if ( isset( $detail['expiry'] ) ) {
|
||||
$detail['expiry'] = $wgContLang->formatExpiry( $detail['expiry'], TS_ISO_8601, 'infinite' );
|
||||
$detail['expiry'] = MediaWikiServices::getInstance()->getContentLanguage()->
|
||||
formatExpiry( $detail['expiry'], TS_ISO_8601, 'infinite' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@
|
|||
* @since 1.22
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* This class formats rights log entries.
|
||||
*
|
||||
|
|
@ -30,10 +32,11 @@
|
|||
*/
|
||||
class RightsLogFormatter extends LogFormatter {
|
||||
protected function makePageLink( Title $title = null, $parameters = [], $html = null ) {
|
||||
global $wgContLang, $wgUserrightsInterwikiDelimiter;
|
||||
global $wgUserrightsInterwikiDelimiter;
|
||||
|
||||
if ( !$this->plaintext ) {
|
||||
$text = $wgContLang->ucfirst( $title->getDBkey() );
|
||||
$text = MediaWikiServices::getInstance()->getContentLanguage()->
|
||||
ucfirst( $title->getDBkey() );
|
||||
$parts = explode( $wgUserrightsInterwikiDelimiter, $text, 2 );
|
||||
|
||||
if ( count( $parts ) === 2 ) {
|
||||
|
|
|
|||
|
|
@ -452,7 +452,7 @@ class EmailNotification {
|
|||
* @private
|
||||
*/
|
||||
function sendPersonalised( $watchingUser, $source ) {
|
||||
global $wgContLang, $wgEnotifUseRealName;
|
||||
global $wgEnotifUseRealName;
|
||||
// From the PHP manual:
|
||||
// Note: The to parameter cannot be an address in the form of
|
||||
// "Something <someone@example.com>". The mail command will not parse
|
||||
|
|
@ -462,14 +462,15 @@ class EmailNotification {
|
|||
# $PAGEEDITDATE is the time and date of the page change
|
||||
# expressed in terms of individual local time of the notification
|
||||
# recipient, i.e. watching user
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
$body = str_replace(
|
||||
[ '$WATCHINGUSERNAME',
|
||||
'$PAGEEDITDATE',
|
||||
'$PAGEEDITTIME' ],
|
||||
[ $wgEnotifUseRealName && $watchingUser->getRealName() !== ''
|
||||
? $watchingUser->getRealName() : $watchingUser->getName(),
|
||||
$wgContLang->userDate( $this->timestamp, $watchingUser ),
|
||||
$wgContLang->userTime( $this->timestamp, $watchingUser ) ],
|
||||
$contLang->userDate( $this->timestamp, $watchingUser ),
|
||||
$contLang->userTime( $this->timestamp, $watchingUser ) ],
|
||||
$this->body );
|
||||
|
||||
$headers = [];
|
||||
|
|
@ -490,19 +491,18 @@ class EmailNotification {
|
|||
* @return Status|null
|
||||
*/
|
||||
function sendImpersonal( $addresses ) {
|
||||
global $wgContLang;
|
||||
|
||||
if ( empty( $addresses ) ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
$body = str_replace(
|
||||
[ '$WATCHINGUSERNAME',
|
||||
'$PAGEEDITDATE',
|
||||
'$PAGEEDITTIME' ],
|
||||
[ wfMessage( 'enotif_impersonal_salutation' )->inContentLanguage()->text(),
|
||||
$wgContLang->date( $this->timestamp, false, false ),
|
||||
$wgContLang->time( $this->timestamp, false, false ) ],
|
||||
$contLang->date( $this->timestamp, false, false ),
|
||||
$contLang->time( $this->timestamp, false, false ) ],
|
||||
$this->body );
|
||||
|
||||
return UserMailer::send( $addresses, $this->from, $this->subject, $body, [
|
||||
|
|
|
|||
|
|
@ -1003,13 +1003,12 @@ class FormatMetadata extends ContextSource {
|
|||
public static function flattenArrayContentLang( $vals, $type = 'ul',
|
||||
$noHtml = false, $context = false
|
||||
) {
|
||||
global $wgContLang;
|
||||
$obj = new FormatMetadata;
|
||||
if ( $context ) {
|
||||
$obj->setContext( $context );
|
||||
}
|
||||
$context = new DerivativeContext( $obj->getContext() );
|
||||
$context->setLanguage( $wgContLang );
|
||||
$context->setLanguage( MediaWikiServices::getInstance()->getContentLanguage() );
|
||||
$obj->setContext( $context );
|
||||
|
||||
return $obj->flattenArrayReal( $vals, $type, $noHtml );
|
||||
|
|
@ -1056,7 +1055,7 @@ class FormatMetadata extends ContextSource {
|
|||
*/
|
||||
switch ( $type ) {
|
||||
case 'lang':
|
||||
// Display default, followed by ContLang,
|
||||
// Display default, followed by ContentLanguage,
|
||||
// followed by the rest in no particular
|
||||
// order.
|
||||
|
||||
|
|
@ -1218,13 +1217,15 @@ class FormatMetadata extends ContextSource {
|
|||
* @return string The text content of "exif-$tag-$val" message in lower case
|
||||
*/
|
||||
private function exifMsg( $tag, $val, $arg = null, $arg2 = null ) {
|
||||
global $wgContLang;
|
||||
|
||||
if ( $val === '' ) {
|
||||
$val = 'value';
|
||||
}
|
||||
|
||||
return $this->msg( $wgContLang->lc( "exif-$tag-$val" ), $arg, $arg2 )->text();
|
||||
return $this->msg(
|
||||
MediaWikiServices::getInstance()->getContentLanguage()->lc( "exif-$tag-$val" ),
|
||||
$arg,
|
||||
$arg2
|
||||
)->text();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* Builds the image revision log shown on image pages
|
||||
*
|
||||
|
|
@ -111,8 +113,6 @@ class ImageHistoryList extends ContextSource {
|
|||
* @return string
|
||||
*/
|
||||
public function imageHistoryLine( $iscur, $file ) {
|
||||
global $wgContLang;
|
||||
|
||||
$user = $this->getUser();
|
||||
$lang = $this->getLanguage();
|
||||
$timestamp = wfTimestamp( TS_MW, $file->getTimestamp() );
|
||||
|
|
@ -264,8 +264,9 @@ class ImageHistoryList extends ContextSource {
|
|||
$row .= '<td><span class="history-deleted">' .
|
||||
$this->msg( 'rev-deleted-comment' )->escaped() . '</span></td>';
|
||||
} else {
|
||||
$row .= '<td dir="' . $wgContLang->getDir() . '">' .
|
||||
Linker::formatComment( $description, $this->title ) . '</td>';
|
||||
$row .=
|
||||
'<td dir="' . MediaWikiServices::getInstance()->getContentLanguage()->getDir() .
|
||||
'">' . Linker::formatComment( $description, $this->title ) . '</td>';
|
||||
}
|
||||
|
||||
$rowClass = null;
|
||||
|
|
|
|||
|
|
@ -1625,7 +1625,7 @@ class WikiPage implements Page, IDBAccessObject {
|
|||
* @return DerivedPageDataUpdater
|
||||
*/
|
||||
private function newDerivedDataUpdater() {
|
||||
global $wgContLang, $wgRCWatchCategoryMembership, $wgArticleCountMethod;
|
||||
global $wgRCWatchCategoryMembership, $wgArticleCountMethod;
|
||||
|
||||
$derivedDataUpdater = new DerivedPageDataUpdater(
|
||||
$this, // NOTE: eventually, PageUpdater should not know about WikiPage
|
||||
|
|
@ -1633,7 +1633,7 @@ class WikiPage implements Page, IDBAccessObject {
|
|||
$this->getParserCache(),
|
||||
JobQueueGroup::singleton(),
|
||||
MessageCache::singleton(),
|
||||
$wgContLang,
|
||||
MediaWikiServices::getInstance()->getContentLanguage(),
|
||||
LoggerFactory::getInstance( 'SaveParse' )
|
||||
);
|
||||
|
||||
|
|
@ -2301,14 +2301,13 @@ class WikiPage implements Page, IDBAccessObject {
|
|||
* @return string
|
||||
*/
|
||||
protected function formatExpiry( $expiry ) {
|
||||
global $wgContLang;
|
||||
|
||||
if ( $expiry != 'infinity' ) {
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
return wfMessage(
|
||||
'protect-expiring',
|
||||
$wgContLang->timeanddate( $expiry, false, false ),
|
||||
$wgContLang->date( $expiry, false, false ),
|
||||
$wgContLang->time( $expiry, false, false )
|
||||
$contLang->timeanddate( $expiry, false, false ),
|
||||
$contLang->date( $expiry, false, false ),
|
||||
$contLang->time( $expiry, false, false )
|
||||
)->inContentLanguage()->text();
|
||||
} else {
|
||||
return wfMessage( 'protect-expiry-indefinite' )
|
||||
|
|
@ -2366,13 +2365,12 @@ class WikiPage implements Page, IDBAccessObject {
|
|||
* @return string
|
||||
*/
|
||||
public function protectDescriptionLog( array $limit, array $expiry ) {
|
||||
global $wgContLang;
|
||||
|
||||
$protectDescriptionLog = '';
|
||||
|
||||
foreach ( array_filter( $limit ) as $action => $restrictions ) {
|
||||
$expiryText = $this->formatExpiry( $expiry[$action] );
|
||||
$protectDescriptionLog .= $wgContLang->getDirMark() .
|
||||
$protectDescriptionLog .=
|
||||
MediaWikiServices::getInstance()->getContentLanguage()->getDirMark() .
|
||||
"[$action=$restrictions] ($expiryText)";
|
||||
}
|
||||
|
||||
|
|
@ -2841,7 +2839,7 @@ class WikiPage implements Page, IDBAccessObject {
|
|||
public function commitRollback( $fromP, $summary, $bot,
|
||||
&$resultDetails, User $guser, $tags = null
|
||||
) {
|
||||
global $wgUseRCPatrol, $wgContLang;
|
||||
global $wgUseRCPatrol;
|
||||
|
||||
$dbw = wfGetDB( DB_MASTER );
|
||||
|
||||
|
|
@ -2922,13 +2920,14 @@ class WikiPage implements Page, IDBAccessObject {
|
|||
$targetEditorForPublic = $target->getUser( RevisionRecord::FOR_PUBLIC );
|
||||
|
||||
// Allow the custom summary to use the same args as the default message
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
$args = [
|
||||
$targetEditorForPublic ? $targetEditorForPublic->getName() : null,
|
||||
$currentEditorForPublic ? $currentEditorForPublic->getName() : null,
|
||||
$s->rev_id,
|
||||
$wgContLang->timeanddate( wfTimestamp( TS_MW, $s->rev_timestamp ) ),
|
||||
$contLang->timeanddate( wfTimestamp( TS_MW, $s->rev_timestamp ) ),
|
||||
$current->getId(),
|
||||
$wgContLang->timeanddate( $current->getTimestamp() )
|
||||
$contLang->timeanddate( $current->getTimestamp() )
|
||||
];
|
||||
if ( $summary instanceof Message ) {
|
||||
$summary = $summary->params( $args )->inContentLanguage()->text();
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
* @ingroup Parser
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* Date formatter, recognises dates in plain text and formats them according to user preferences.
|
||||
* @todo preferences, OutputPage
|
||||
|
|
@ -131,9 +133,9 @@ class DateFormatter {
|
|||
* @return DateFormatter
|
||||
*/
|
||||
public static function getInstance( Language $lang = null ) {
|
||||
global $wgContLang, $wgMainCacheType;
|
||||
global $wgMainCacheType;
|
||||
|
||||
$lang = $lang ?: $wgContLang;
|
||||
$lang = $lang ?: MediaWikiServices::getInstance()->getContentLanguage();
|
||||
$cache = ObjectCache::getLocalServerInstance( $wgMainCacheType );
|
||||
|
||||
static $dateFormatter = false;
|
||||
|
|
|
|||
|
|
@ -5750,7 +5750,6 @@ class Parser {
|
|||
# to other users, and potentially even used inside links and such,
|
||||
# it needs to be consistent for all visitors.
|
||||
$this->mRevisionTimestamp = $this->contLang->userAdjust( $timestamp, '' );
|
||||
|
||||
}
|
||||
return $this->mRevisionTimestamp;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -968,8 +968,8 @@ class ParserOptions {
|
|||
* @return ParserOptions
|
||||
*/
|
||||
public static function newFromAnon() {
|
||||
global $wgContLang;
|
||||
return new ParserOptions( new User, $wgContLang );
|
||||
return new ParserOptions( new User,
|
||||
MediaWikiServices::getInstance()->getContentLanguage() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1021,7 +1021,7 @@ class ParserOptions {
|
|||
* @param IContextSource|string|User|null $context
|
||||
* - If an IContextSource, the options are initialized based on the source's User and Language.
|
||||
* - If the string 'canonical', the options are initialized with an anonymous user and
|
||||
* $wgContLang.
|
||||
* the content language.
|
||||
* - If a User or null, the options are initialized for that User (or $wgUser if null).
|
||||
* 'userlang' is taken from the $userLang parameter, defaulting to $wgLang if that is null.
|
||||
* @param Language|StubObject|null $userLang (see above)
|
||||
|
|
@ -1061,7 +1061,7 @@ class ParserOptions {
|
|||
$wgMaxArticleSize, $wgMaxPPNodeCount, $wgMaxTemplateDepth, $wgMaxPPExpandDepth,
|
||||
$wgCleanSignatures, $wgExternalLinkTarget, $wgExpensiveParserFunctionLimit,
|
||||
$wgMaxGeneratedPPNodeCount, $wgDisableLangConversion, $wgDisableTitleConversion,
|
||||
$wgEnableMagicLinks, $wgContLang;
|
||||
$wgEnableMagicLinks;
|
||||
|
||||
if ( self::$defaults === null ) {
|
||||
// *UPDATE* ParserOptions::matches() if any of this changes as needed
|
||||
|
|
@ -1115,7 +1115,7 @@ class ParserOptions {
|
|||
'numberheadings' => User::getDefaultOption( 'numberheadings' ),
|
||||
'thumbsize' => User::getDefaultOption( 'thumbsize' ),
|
||||
'stubthreshold' => 0,
|
||||
'userlang' => $wgContLang,
|
||||
'userlang' => MediaWikiServices::getInstance()->getContentLanguage(),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -1329,8 +1329,8 @@ class ParserOptions {
|
|||
if ( !is_null( $title ) ) {
|
||||
$confstr .= $title->getPageLanguage()->getExtraHashOptions();
|
||||
} else {
|
||||
global $wgContLang;
|
||||
$confstr .= $wgContLang->getExtraHashOptions();
|
||||
$confstr .=
|
||||
MediaWikiServices::getInstance()->getContentLanguage()->getExtraHashOptions();
|
||||
}
|
||||
|
||||
$confstr .= $wgRenderHashAppend;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
* @ingroup Parser
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* HTML sanitizer for MediaWiki
|
||||
* @ingroup Parser
|
||||
|
|
@ -1657,7 +1659,6 @@ class Sanitizer {
|
|||
* @return string Still normalized, without entities
|
||||
*/
|
||||
public static function decodeCharReferencesAndNormalize( $text ) {
|
||||
global $wgContLang;
|
||||
$text = preg_replace_callback(
|
||||
self::CHAR_REFS_REGEX,
|
||||
[ self::class, 'decodeCharReferencesCallback' ],
|
||||
|
|
@ -1667,7 +1668,7 @@ class Sanitizer {
|
|||
);
|
||||
|
||||
if ( $count ) {
|
||||
return $wgContLang->normalize( $text );
|
||||
return MediaWikiServices::getInstance()->getContentLanguage()->normalize( $text );
|
||||
} else {
|
||||
return $text;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
*/
|
||||
|
||||
use Cdb\Reader as CdbReader;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* Functions to check passwords against a policy requirement
|
||||
|
|
@ -81,10 +82,12 @@ class PasswordPolicyChecks {
|
|||
* @return Status error if username and password match, and policy is true
|
||||
*/
|
||||
public static function checkPasswordCannotMatchUsername( $policyVal, User $user, $password ) {
|
||||
global $wgContLang;
|
||||
$status = Status::newGood();
|
||||
$username = $user->getName();
|
||||
if ( $policyVal && $wgContLang->lc( $password ) === $wgContLang->lc( $username ) ) {
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
if (
|
||||
$policyVal && $contLang->lc( $password ) === $contLang->lc( $username )
|
||||
) {
|
||||
$status->error( 'password-name-match' );
|
||||
}
|
||||
return $status;
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
|
|||
/** @var Config */
|
||||
protected $config;
|
||||
|
||||
/** @var Language The wiki's content language, equivalent to $wgContLang. */
|
||||
/** @var Language The wiki's content language. */
|
||||
protected $contLang;
|
||||
|
||||
/** @var AuthManager */
|
||||
|
|
|
|||
|
|
@ -129,9 +129,8 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
|
|||
* @return bool
|
||||
*/
|
||||
public function getFlip( $context ) {
|
||||
global $wgContLang;
|
||||
|
||||
return $wgContLang->getDir() !== $context->getDirection();
|
||||
return MediaWikiServices::getInstance()->getContentLanguage()->getDir() !==
|
||||
$context->getDirection();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
* @author Roan Kattouw
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* Module for ResourceLoader initialization.
|
||||
*
|
||||
|
|
@ -53,7 +55,6 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
|
|||
return $this->configVars[$hash];
|
||||
}
|
||||
|
||||
global $wgContLang;
|
||||
$conf = $this->getConfig();
|
||||
|
||||
// We can't use Title::newMainPage() if 'mainpage' is in
|
||||
|
|
@ -71,10 +72,11 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
|
|||
* - wgNamespaceIds: Key-value pairs of all localized, canonical and aliases for namespaces.
|
||||
* - wgCaseSensitiveNamespaces: Array of namespaces that are case-sensitive.
|
||||
*/
|
||||
$namespaceIds = $wgContLang->getNamespaceIds();
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
$namespaceIds = $contLang->getNamespaceIds();
|
||||
$caseSensitiveNamespaces = [];
|
||||
foreach ( MWNamespace::getCanonicalNamespaces() as $index => $name ) {
|
||||
$namespaceIds[$wgContLang->lc( $name )] = $index;
|
||||
$namespaceIds[$contLang->lc( $name )] = $index;
|
||||
if ( !MWNamespace::isCapitalized( $index ) ) {
|
||||
$caseSensitiveNamespaces[] = $index;
|
||||
}
|
||||
|
|
@ -101,13 +103,13 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
|
|||
'wgServer' => $conf->get( 'Server' ),
|
||||
'wgServerName' => $conf->get( 'ServerName' ),
|
||||
'wgUserLanguage' => $context->getLanguage(),
|
||||
'wgContentLanguage' => $wgContLang->getCode(),
|
||||
'wgContentLanguage' => $contLang->getCode(),
|
||||
'wgTranslateNumerals' => $conf->get( 'TranslateNumerals' ),
|
||||
'wgVersion' => $conf->get( 'Version' ),
|
||||
'wgEnableAPI' => true, // Deprecated since MW 1.32
|
||||
'wgEnableWriteAPI' => true, // Deprecated since MW 1.32
|
||||
'wgMainPageTitle' => $mainPage->getPrefixedText(),
|
||||
'wgFormattedNamespaces' => $wgContLang->getFormattedNamespaces(),
|
||||
'wgFormattedNamespaces' => $contLang->getFormattedNamespaces(),
|
||||
'wgNamespaceIds' => $namespaceIds,
|
||||
'wgContentNamespaces' => MWNamespace::getContentNamespaces(),
|
||||
'wgSiteName' => $conf->get( 'Sitename' ),
|
||||
|
|
|
|||
|
|
@ -232,10 +232,8 @@ abstract class SearchEngine {
|
|||
* @return string
|
||||
*/
|
||||
public function normalizeText( $string ) {
|
||||
global $wgContLang;
|
||||
|
||||
// Some languages such as Chinese require word segmentation
|
||||
return $wgContLang->segmentByWord( $string );
|
||||
return MediaWikiServices::getInstance()->getContentLanguage()->segmentByWord( $string );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -257,8 +255,8 @@ abstract class SearchEngine {
|
|||
* @return SearchNearMatcher
|
||||
*/
|
||||
public function getNearMatcher( Config $config ) {
|
||||
global $wgContLang;
|
||||
return new SearchNearMatcher( $config, $wgContLang );
|
||||
return new SearchNearMatcher( $config,
|
||||
MediaWikiServices::getInstance()->getContentLanguage() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -415,8 +413,6 @@ abstract class SearchEngine {
|
|||
$withAllKeyword = true,
|
||||
$withPrefixSearchExtractNamespaceHook = false
|
||||
) {
|
||||
global $wgContLang;
|
||||
|
||||
$parsed = $query;
|
||||
if ( strpos( $query, ':' ) === false ) { // nothing to do
|
||||
return false;
|
||||
|
|
@ -445,7 +441,7 @@ abstract class SearchEngine {
|
|||
|
||||
if ( !$allQuery && strpos( $query, ':' ) !== false ) {
|
||||
$prefix = str_replace( ' ', '_', substr( $query, 0, strpos( $query, ':' ) ) );
|
||||
$index = $wgContLang->getNsIndex( $prefix );
|
||||
$index = MediaWikiServices::getInstance()->getContentLanguage()->getNsIndex( $prefix );
|
||||
if ( $index !== false ) {
|
||||
$extractedNamespace = [ $index ];
|
||||
$parsed = substr( $query, strlen( $prefix ) + 1 );
|
||||
|
|
@ -625,9 +621,8 @@ abstract class SearchEngine {
|
|||
$results = $this->completionSearchBackendOverfetch( $search );
|
||||
$fallbackLimit = 1 + $this->limit - $results->getSize();
|
||||
if ( $fallbackLimit > 0 ) {
|
||||
global $wgContLang;
|
||||
|
||||
$fallbackSearches = $wgContLang->autoConvertToAllVariants( $search );
|
||||
$fallbackSearches = MediaWikiServices::getInstance()->getContentLanguage()->
|
||||
autoConvertToAllVariants( $search );
|
||||
$fallbackSearches = array_diff( array_unique( $fallbackSearches ), [ $search ] );
|
||||
|
||||
foreach ( $fallbackSearches as $fbs ) {
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
* @ingroup Search
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* Highlight bits of wikitext
|
||||
*
|
||||
|
|
@ -49,7 +51,7 @@ class SearchHighlighter {
|
|||
* @return string
|
||||
*/
|
||||
public function highlightText( $text, $terms, $contextlines, $contextchars ) {
|
||||
global $wgContLang, $wgSearchHighlightBoundaries;
|
||||
global $wgSearchHighlightBoundaries;
|
||||
|
||||
if ( $text == '' ) {
|
||||
return '';
|
||||
|
|
@ -84,7 +86,10 @@ class SearchHighlighter {
|
|||
if ( $key == 2 ) {
|
||||
// see if this is an image link
|
||||
$ns = substr( $val[0], 2, -1 );
|
||||
if ( $wgContLang->getNsIndex( $ns ) != NS_FILE ) {
|
||||
if (
|
||||
MediaWikiServices::getInstance()->getContentLanguage()->
|
||||
getNsIndex( $ns ) != NS_FILE
|
||||
) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -313,9 +318,10 @@ class SearchHighlighter {
|
|||
* @return string
|
||||
*/
|
||||
function caseCallback( $matches ) {
|
||||
global $wgContLang;
|
||||
if ( strlen( $matches[0] ) > 1 ) {
|
||||
return '[' . $wgContLang->lc( $matches[0] ) . $wgContLang->uc( $matches[0] ) . ']';
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
return '[' . $contLang->lc( $matches[0] ) .
|
||||
$contLang->uc( $matches[0] ) . ']';
|
||||
} else {
|
||||
return $matches[0];
|
||||
}
|
||||
|
|
@ -480,9 +486,8 @@ class SearchHighlighter {
|
|||
if ( $colon === false ) {
|
||||
return $matches[2]; // replace with caption
|
||||
}
|
||||
global $wgContLang;
|
||||
$ns = substr( $matches[1], 0, $colon );
|
||||
$index = $wgContLang->getNsIndex( $ns );
|
||||
$index = MediaWikiServices::getInstance()->getContentLanguage()->getNsIndex( $ns );
|
||||
if ( $index !== false && ( $index == NS_FILE || $index == NS_CATEGORY ) ) {
|
||||
return $matches[0]; // return the whole thing
|
||||
} else {
|
||||
|
|
@ -503,8 +508,6 @@ class SearchHighlighter {
|
|||
* @return string
|
||||
*/
|
||||
public function highlightSimple( $text, $terms, $contextlines, $contextchars ) {
|
||||
global $wgContLang;
|
||||
|
||||
$lines = explode( "\n", $text );
|
||||
|
||||
$terms = implode( '|', $terms );
|
||||
|
|
@ -514,6 +517,7 @@ class SearchHighlighter {
|
|||
$lineno = 0;
|
||||
|
||||
$extract = "";
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
foreach ( $lines as $line ) {
|
||||
if ( 0 == $contextlines ) {
|
||||
break;
|
||||
|
|
@ -525,12 +529,12 @@ class SearchHighlighter {
|
|||
}
|
||||
--$contextlines;
|
||||
// truncate function changes ... to relevant i18n message.
|
||||
$pre = $wgContLang->truncateForVisual( $m[1], - $contextchars, '...', false );
|
||||
$pre = $contLang->truncateForVisual( $m[1], - $contextchars, '...', false );
|
||||
|
||||
if ( count( $m ) < 3 ) {
|
||||
$post = '';
|
||||
} else {
|
||||
$post = $wgContLang->truncateForVisual( $m[3], $contextchars, '...', false );
|
||||
$post = $contLang->truncateForVisual( $m[3], $contextchars, '...', false );
|
||||
}
|
||||
|
||||
$found = $m[2];
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
* @ingroup Search
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use Wikimedia\Rdbms\IResultWrapper;
|
||||
|
||||
/**
|
||||
|
|
@ -133,7 +134,6 @@ class SearchMssql extends SearchDatabase {
|
|||
* @return string
|
||||
*/
|
||||
private function parseQuery( $filteredText, $fulltext ) {
|
||||
global $wgContLang;
|
||||
$lc = $this->legalSearchChars( self::CHARS_NO_SYNTAX );
|
||||
$this->searchTerms = [];
|
||||
|
||||
|
|
@ -144,7 +144,8 @@ class SearchMssql extends SearchDatabase {
|
|||
if ( preg_match_all( '/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/',
|
||||
$filteredText, $m, PREG_SET_ORDER ) ) {
|
||||
foreach ( $m as $terms ) {
|
||||
$q[] = $terms[1] . $wgContLang->normalizeForSearch( $terms[2] );
|
||||
$q[] = $terms[1] . MediaWikiServices::getInstance()->getContentLanguage()->
|
||||
normalizeForSearch( $terms[2] );
|
||||
|
||||
if ( !empty( $terms[3] ) ) {
|
||||
$regexp = preg_quote( $terms[3], '/' );
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
* @ingroup Search
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* Search engine hook for MySQL 4+
|
||||
* @ingroup Search
|
||||
|
|
@ -43,8 +45,6 @@ class SearchMySQL extends SearchDatabase {
|
|||
* @return array
|
||||
*/
|
||||
private function parseQuery( $filteredText, $fulltext ) {
|
||||
global $wgContLang;
|
||||
|
||||
$lc = $this->legalSearchChars( self::CHARS_NO_SYNTAX ); // Minus syntax chars (" and *)
|
||||
$searchon = '';
|
||||
$this->searchTerms = [];
|
||||
|
|
@ -76,7 +76,8 @@ class SearchMySQL extends SearchDatabase {
|
|||
|
||||
// Some languages such as Serbian store the input form in the search index,
|
||||
// so we may need to search for matches in multiple writing system variants.
|
||||
$convertedVariants = $wgContLang->autoConvertToAllVariants( $term );
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
$convertedVariants = $contLang->autoConvertToAllVariants( $term );
|
||||
if ( is_array( $convertedVariants ) ) {
|
||||
$variants = array_unique( array_values( $convertedVariants ) );
|
||||
} else {
|
||||
|
|
@ -87,9 +88,7 @@ class SearchMySQL extends SearchDatabase {
|
|||
// around problems with minimum lengths and encoding in MySQL's
|
||||
// fulltext engine.
|
||||
// For Chinese this also inserts spaces between adjacent Han characters.
|
||||
$strippedVariants = array_map(
|
||||
[ $wgContLang, 'normalizeForSearch' ],
|
||||
$variants );
|
||||
$strippedVariants = array_map( [ $contLang, 'normalizeForSearch' ], $variants );
|
||||
|
||||
// Some languages such as Chinese force all variants to a canonical
|
||||
// form when stripping to the low-level search index, so to be sure
|
||||
|
|
@ -134,10 +133,8 @@ class SearchMySQL extends SearchDatabase {
|
|||
}
|
||||
|
||||
private function regexTerm( $string, $wildcard ) {
|
||||
global $wgContLang;
|
||||
|
||||
$regex = preg_quote( $string, '/' );
|
||||
if ( $wgContLang->hasWordBreaks() ) {
|
||||
if ( MediaWikiServices::getInstance()->getContentLanguage()->hasWordBreaks() ) {
|
||||
if ( $wildcard ) {
|
||||
// Don't cut off the final bit!
|
||||
$regex = "\b$regex";
|
||||
|
|
@ -389,8 +386,6 @@ class SearchMySQL extends SearchDatabase {
|
|||
* @return mixed|string
|
||||
*/
|
||||
function normalizeText( $string ) {
|
||||
global $wgContLang;
|
||||
|
||||
$out = parent::normalizeText( $string );
|
||||
|
||||
// MySQL fulltext index doesn't grok utf-8, so we
|
||||
|
|
@ -398,7 +393,7 @@ class SearchMySQL extends SearchDatabase {
|
|||
$out = preg_replace_callback(
|
||||
"/([\\xc0-\\xff][\\x80-\\xbf]*)/",
|
||||
[ $this, 'stripForSearchCallback' ],
|
||||
$wgContLang->lc( $out ) );
|
||||
MediaWikiServices::getInstance()->getContentLanguage()->lc( $out ) );
|
||||
|
||||
// And to add insult to injury, the default indexing
|
||||
// ignores short words... Pad them so we can pass them
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
* @ingroup Search
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* Search engine hook base class for Oracle (ConText).
|
||||
* @ingroup Search
|
||||
|
|
@ -173,7 +175,6 @@ class SearchOracle extends SearchDatabase {
|
|||
* @return string
|
||||
*/
|
||||
private function parseQuery( $filteredText, $fulltext ) {
|
||||
global $wgContLang;
|
||||
$lc = $this->legalSearchChars( self::CHARS_NO_SYNTAX );
|
||||
$this->searchTerms = [];
|
||||
|
||||
|
|
@ -185,7 +186,8 @@ class SearchOracle extends SearchDatabase {
|
|||
foreach ( $m as $terms ) {
|
||||
// Search terms in all variant forms, only
|
||||
// apply on wiki with LanguageConverter
|
||||
$temp_terms = $wgContLang->autoConvertToAllVariants( $terms[2] );
|
||||
$temp_terms = MediaWikiServices::getInstance()->getContentLanguage()->
|
||||
autoConvertToAllVariants( $terms[2] );
|
||||
if ( is_array( $temp_terms ) ) {
|
||||
$temp_terms = array_unique( array_values( $temp_terms ) );
|
||||
foreach ( $temp_terms as $t ) {
|
||||
|
|
@ -212,8 +214,7 @@ class SearchOracle extends SearchDatabase {
|
|||
}
|
||||
|
||||
private function escapeTerm( $t ) {
|
||||
global $wgContLang;
|
||||
$t = $wgContLang->normalizeForSearch( $t );
|
||||
$t = MediaWikiServices::getInstance()->getContentLanguage()->normalizeForSearch( $t );
|
||||
$t = isset( $this->reservedWords[strtoupper( $t )] ) ? '{' . $t . '}' : $t;
|
||||
$t = preg_replace( '/^"(.*)"$/', '($1)', $t );
|
||||
$t = preg_replace( '/([-&|])/', '\\\\$1', $t );
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
* @ingroup Search
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* Search engine hook for SQLite
|
||||
* @ingroup Search
|
||||
|
|
@ -43,7 +45,6 @@ class SearchSqlite extends SearchDatabase {
|
|||
* @return string
|
||||
*/
|
||||
private function parseQuery( $filteredText, $fulltext ) {
|
||||
global $wgContLang;
|
||||
$lc = $this->legalSearchChars( self::CHARS_NO_SYNTAX ); // Minus syntax chars (" and *)
|
||||
$searchon = '';
|
||||
$this->searchTerms = [];
|
||||
|
|
@ -70,7 +71,8 @@ class SearchSqlite extends SearchDatabase {
|
|||
|
||||
// Some languages such as Serbian store the input form in the search index,
|
||||
// so we may need to search for matches in multiple writing system variants.
|
||||
$convertedVariants = $wgContLang->autoConvertToAllVariants( $term );
|
||||
$convertedVariants = MediaWikiServices::getInstance()->getContentLanguage()->
|
||||
autoConvertToAllVariants( $term );
|
||||
if ( is_array( $convertedVariants ) ) {
|
||||
$variants = array_unique( array_values( $convertedVariants ) );
|
||||
} else {
|
||||
|
|
@ -82,7 +84,8 @@ class SearchSqlite extends SearchDatabase {
|
|||
// fulltext engine.
|
||||
// For Chinese this also inserts spaces between adjacent Han characters.
|
||||
$strippedVariants = array_map(
|
||||
[ $wgContLang, 'normalizeForSearch' ],
|
||||
[ MediaWikiServices::getInstance()->getContentLanguage(),
|
||||
'normalizeForSearch' ],
|
||||
$variants );
|
||||
|
||||
// Some languages such as Chinese force all variants to a canonical
|
||||
|
|
@ -123,10 +126,8 @@ class SearchSqlite extends SearchDatabase {
|
|||
}
|
||||
|
||||
private function regexTerm( $string, $wildcard ) {
|
||||
global $wgContLang;
|
||||
|
||||
$regex = preg_quote( $string, '/' );
|
||||
if ( $wgContLang->hasWordBreaks() ) {
|
||||
if ( MediaWikiServices::getInstance()->getContentLanguage()->hasWordBreaks() ) {
|
||||
if ( $wildcard ) {
|
||||
// Don't cut off the final bit!
|
||||
$regex = "\b$regex";
|
||||
|
|
@ -171,13 +172,12 @@ class SearchSqlite extends SearchDatabase {
|
|||
}
|
||||
|
||||
protected function searchInternal( $term, $fulltext ) {
|
||||
global $wgContLang;
|
||||
|
||||
if ( !$this->fulltextSearchSupported() ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$filteredTerm = $this->filter( $wgContLang->lc( $term ) );
|
||||
$filteredTerm =
|
||||
$this->filter( MediaWikiServices::getInstance()->getContentLanguage()->lc( $term ) );
|
||||
$resultSet = $this->db->query( $this->getQuery( $filteredTerm, $fulltext ) );
|
||||
|
||||
$total = null;
|
||||
|
|
|
|||
|
|
@ -1526,7 +1526,7 @@ abstract class Skin extends ContextSource {
|
|||
* should fall back to the next notice in its sequence
|
||||
*/
|
||||
private function getCachedNotice( $name ) {
|
||||
global $wgRenderHashAppend, $wgContLang;
|
||||
global $wgRenderHashAppend;
|
||||
|
||||
$needParse = false;
|
||||
|
||||
|
|
@ -1559,12 +1559,13 @@ abstract class Skin extends ContextSource {
|
|||
}
|
||||
);
|
||||
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
return Html::rawElement(
|
||||
'div',
|
||||
[
|
||||
'id' => 'localNotice',
|
||||
'lang' => $wgContLang->getHtmlCode(),
|
||||
'dir' => $wgContLang->getDir()
|
||||
'lang' => $contLang->getHtmlCode(),
|
||||
'dir' => $contLang->getDir()
|
||||
],
|
||||
$parsed
|
||||
);
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ class SkinTemplate extends Skin {
|
|||
* @return QuickTemplate The template to be executed by outputPage
|
||||
*/
|
||||
protected function prepareQuickTemplate() {
|
||||
global $wgContLang, $wgScript, $wgStylePath, $wgMimeType, $wgJsMimeType,
|
||||
global $wgScript, $wgStylePath, $wgMimeType, $wgJsMimeType,
|
||||
$wgSitename, $wgLogo, $wgMaxCredits,
|
||||
$wgShowCreditsIfMax, $wgArticlePath,
|
||||
$wgScriptPath, $wgServer;
|
||||
|
|
@ -363,7 +363,11 @@ class SkinTemplate extends Skin {
|
|||
// heading for the page title. Defaults to empty string.
|
||||
$tpl->set( 'prebodyhtml', '' );
|
||||
|
||||
if ( $userLangCode !== $wgContLang->getHtmlCode() || $userLangDir !== $wgContLang->getDir() ) {
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
if (
|
||||
$userLangCode !== $contLang->getHtmlCode() ||
|
||||
$userLangDir !== $contLang->getDir()
|
||||
) {
|
||||
$escUserlang = htmlspecialchars( $userLangCode );
|
||||
$escUserdir = htmlspecialchars( $userLangDir );
|
||||
// Attributes must be in double quotes because htmlspecialchars() doesn't
|
||||
|
|
@ -783,9 +787,8 @@ class SkinTemplate extends Skin {
|
|||
if ( $msg->exists() ) {
|
||||
$text = $msg->text();
|
||||
} else {
|
||||
global $wgContLang;
|
||||
$text = $wgContLang->getConverter()->convertNamespace(
|
||||
MWNamespace::getSubject( $title->getNamespace() ) );
|
||||
$text = MediaWikiServices::getInstance()->getContentLanguage()->getConverter()->
|
||||
convertNamespace( MWNamespace::getSubject( $title->getNamespace() ) );
|
||||
}
|
||||
|
||||
// Avoid PHP 7.1 warning of passing $this by reference
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
* @ingroup SpecialPage
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use Wikimedia\Rdbms\IResultWrapper;
|
||||
use Wikimedia\Rdbms\IDatabase;
|
||||
|
||||
|
|
@ -50,12 +51,11 @@ abstract class PageQueryPage extends QueryPage {
|
|||
* @return string
|
||||
*/
|
||||
public function formatResult( $skin, $row ) {
|
||||
global $wgContLang;
|
||||
|
||||
$title = Title::makeTitleSafe( $row->namespace, $row->title );
|
||||
|
||||
if ( $title instanceof Title ) {
|
||||
$text = $wgContLang->convert( $title->getPrefixedText() );
|
||||
$text = MediaWikiServices::getInstance()->getContentLanguage()->
|
||||
convert( $title->getPrefixedText() );
|
||||
return $this->getLinkRenderer()->makeLink( $title, $text );
|
||||
} else {
|
||||
return Html::element( 'span', [ 'class' => 'mw-invalidtitle' ],
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
* @ingroup SpecialPage
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use Wikimedia\Rdbms\IResultWrapper;
|
||||
use Wikimedia\Rdbms\IDatabase;
|
||||
use Wikimedia\Rdbms\DBError;
|
||||
|
|
@ -690,8 +691,6 @@ abstract class QueryPage extends SpecialPage {
|
|||
* @param int $offset Paging offset
|
||||
*/
|
||||
protected function outputResults( $out, $skin, $dbr, $res, $num, $offset ) {
|
||||
global $wgContLang;
|
||||
|
||||
if ( $num > 0 ) {
|
||||
$html = [];
|
||||
if ( !$this->listoutput ) {
|
||||
|
|
@ -726,7 +725,7 @@ abstract class QueryPage extends SpecialPage {
|
|||
}
|
||||
|
||||
$html = $this->listoutput
|
||||
? $wgContLang->listToText( $html )
|
||||
? MediaWikiServices::getInstance()->getContentLanguage()->listToText( $html )
|
||||
: implode( '', $html );
|
||||
|
||||
$out->addHTML( $html );
|
||||
|
|
|
|||
|
|
@ -628,10 +628,9 @@ class SpecialPage implements MessageLocalizer {
|
|||
* @param string $summaryMessageKey Message key of the summary
|
||||
*/
|
||||
function outputHeader( $summaryMessageKey = '' ) {
|
||||
global $wgContLang;
|
||||
|
||||
if ( $summaryMessageKey == '' ) {
|
||||
$msg = $wgContLang->lc( $this->getName() ) . '-summary';
|
||||
$msg = MediaWikiServices::getInstance()->getContentLanguage()->lc( $this->getName() ) .
|
||||
'-summary';
|
||||
} else {
|
||||
$msg = $summaryMessageKey;
|
||||
}
|
||||
|
|
@ -832,8 +831,9 @@ class SpecialPage implements MessageLocalizer {
|
|||
return;
|
||||
}
|
||||
|
||||
global $wgContLang;
|
||||
$msg = $this->msg( $wgContLang->lc( $this->getName() ) . '-helppage' );
|
||||
$msg = $this->msg(
|
||||
MediaWikiServices::getInstance()->getContentLanguage()->lc( $this->getName() ) .
|
||||
'-helppage' );
|
||||
|
||||
if ( !$msg->isDisabled() ) {
|
||||
$helpUrl = Skin::makeUrl( $msg->plain() );
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
* @defgroup SpecialPage SpecialPage
|
||||
*/
|
||||
use MediaWiki\Linker\LinkRenderer;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use Wikimedia\ObjectFactory;
|
||||
|
||||
/**
|
||||
|
|
@ -270,9 +271,9 @@ class SpecialPageFactory {
|
|||
* @return array
|
||||
*/
|
||||
private static function getAliasList() {
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
if ( is_null( self::$aliases ) ) {
|
||||
global $wgContLang;
|
||||
$aliases = $wgContLang->getSpecialPageAliases();
|
||||
$aliases = $contLang->getSpecialPageAliases();
|
||||
$pageList = self::getPageList();
|
||||
|
||||
self::$aliases = [];
|
||||
|
|
@ -280,7 +281,7 @@ class SpecialPageFactory {
|
|||
|
||||
// Force every canonical name to be an alias for itself.
|
||||
foreach ( $pageList as $name => $stuff ) {
|
||||
$caseFoldedAlias = $wgContLang->caseFold( $name );
|
||||
$caseFoldedAlias = $contLang->caseFold( $name );
|
||||
self::$aliases[$caseFoldedAlias] = $name;
|
||||
$keepAlias[$caseFoldedAlias] = 'canonical';
|
||||
}
|
||||
|
|
@ -290,7 +291,7 @@ class SpecialPageFactory {
|
|||
foreach ( $aliases as $realName => $aliasList ) {
|
||||
$aliasList = array_values( $aliasList );
|
||||
foreach ( $aliasList as $i => $alias ) {
|
||||
$caseFoldedAlias = $wgContLang->caseFold( $alias );
|
||||
$caseFoldedAlias = $contLang->caseFold( $alias );
|
||||
|
||||
if ( isset( self::$aliases[$caseFoldedAlias] ) &&
|
||||
$realName === self::$aliases[$caseFoldedAlias]
|
||||
|
|
@ -327,10 +328,10 @@ class SpecialPageFactory {
|
|||
* @return array Array( String, String|null ), or array( null, null ) if the page is invalid
|
||||
*/
|
||||
public static function resolveAlias( $alias ) {
|
||||
global $wgContLang;
|
||||
$bits = explode( '/', $alias, 2 );
|
||||
|
||||
$caseFoldedAlias = $wgContLang->caseFold( $bits[0] );
|
||||
$caseFoldedAlias = MediaWikiServices::getInstance()->getContentLanguage()->
|
||||
caseFold( $bits[0] );
|
||||
$caseFoldedAlias = str_replace( ' ', '_', $caseFoldedAlias );
|
||||
$aliases = self::getAliasList();
|
||||
if ( isset( $aliases[$caseFoldedAlias] ) ) {
|
||||
|
|
@ -646,15 +647,15 @@ class SpecialPageFactory {
|
|||
* @return string
|
||||
*/
|
||||
public static function getLocalNameFor( $name, $subpage = false ) {
|
||||
global $wgContLang;
|
||||
$aliases = $wgContLang->getSpecialPageAliases();
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
$aliases = $contLang->getSpecialPageAliases();
|
||||
$aliasList = self::getAliasList();
|
||||
|
||||
// Find the first alias that maps back to $name
|
||||
if ( isset( $aliases[$name] ) ) {
|
||||
$found = false;
|
||||
foreach ( $aliases[$name] as $alias ) {
|
||||
$caseFoldedAlias = $wgContLang->caseFold( $alias );
|
||||
$caseFoldedAlias = $contLang->caseFold( $alias );
|
||||
$caseFoldedAlias = str_replace( ' ', '_', $caseFoldedAlias );
|
||||
if ( isset( $aliasList[$caseFoldedAlias] ) &&
|
||||
$aliasList[$caseFoldedAlias] === $name
|
||||
|
|
@ -690,7 +691,7 @@ class SpecialPageFactory {
|
|||
$name = "$name/$subpage";
|
||||
}
|
||||
|
||||
return $wgContLang->ucfirst( $name );
|
||||
return $contLang->ucfirst( $name );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
* @ingroup SpecialPage
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* Implements Special:Ancientpages
|
||||
*
|
||||
|
|
@ -74,14 +76,13 @@ class AncientPagesPage extends QueryPage {
|
|||
* @return string
|
||||
*/
|
||||
function formatResult( $skin, $result ) {
|
||||
global $wgContLang;
|
||||
|
||||
$d = $this->getLanguage()->userTimeAndDate( $result->value, $this->getUser() );
|
||||
$title = Title::makeTitle( $result->namespace, $result->title );
|
||||
$linkRenderer = $this->getLinkRenderer();
|
||||
$link = $linkRenderer->makeKnownLink(
|
||||
$title,
|
||||
$wgContLang->convert( $title->getPrefixedText() )
|
||||
MediaWikiServices::getInstance()->getContentLanguage()->
|
||||
convert( $title->getPrefixedText() )
|
||||
);
|
||||
|
||||
return $this->getLanguage()->specialList( $link, htmlspecialchars( $d ) );
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
* @ingroup SpecialPage
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* Special page outputs information on sourcing a book with a particular ISBN
|
||||
* The parser creates links to this page when dealing with ISBNs in wikitext
|
||||
|
|
@ -154,8 +156,6 @@ class SpecialBookSources extends SpecialPage {
|
|||
private function showList( $isbn ) {
|
||||
$out = $this->getOutput();
|
||||
|
||||
global $wgContLang;
|
||||
|
||||
$isbn = self::cleanIsbn( $isbn );
|
||||
# Hook to allow extensions to insert additional HTML,
|
||||
# e.g. for API-interacting plugins and so on
|
||||
|
|
@ -183,7 +183,7 @@ class SpecialBookSources extends SpecialPage {
|
|||
# Fall back to the defaults given in the language file
|
||||
$out->addWikiMsg( 'booksources-text' );
|
||||
$out->addHTML( '<ul>' );
|
||||
$items = $wgContLang->getBookstoreList();
|
||||
$items = MediaWikiServices::getInstance()->getContentLanguage()->getBookstoreList();
|
||||
foreach ( $items as $label => $url ) {
|
||||
$out->addHTML( $this->makeListItem( $isbn, $label, $url ) );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -535,8 +535,6 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
|
|||
* @return HTMLForm
|
||||
*/
|
||||
protected function getNormalForm() {
|
||||
global $wgContLang;
|
||||
|
||||
$fields = [];
|
||||
$count = 0;
|
||||
|
||||
|
|
@ -582,7 +580,8 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
|
|||
|
||||
$nsText = ( $ns == NS_MAIN )
|
||||
? $this->msg( 'blanknamespace' )->escaped()
|
||||
: htmlspecialchars( $wgContLang->getFormattedNsText( $ns ) );
|
||||
: htmlspecialchars( MediaWikiServices::getInstance()->getContentLanguage()->
|
||||
getFormattedNsText( $ns ) );
|
||||
$this->toc .= Linker::tocLine( "editwatchlist-{$data['section']}", $nsText,
|
||||
$this->getLanguage()->formatNum( ++$tocLength ), 1 ) . Linker::tocLineEnd();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -421,8 +421,6 @@ class SpecialExport extends SpecialPage {
|
|||
* @return array
|
||||
*/
|
||||
private function getPagesFromCategory( $title ) {
|
||||
global $wgContLang;
|
||||
|
||||
$maxPages = $this->getConfig()->get( 'ExportPagelistLimit' );
|
||||
|
||||
$name = $title->getDBkey();
|
||||
|
|
@ -441,7 +439,8 @@ class SpecialExport extends SpecialPage {
|
|||
foreach ( $res as $row ) {
|
||||
$n = $row->page_title;
|
||||
if ( $row->page_namespace ) {
|
||||
$ns = $wgContLang->getNsText( $row->page_namespace );
|
||||
$ns = MediaWikiServices::getInstance()->getContentLanguage()->getNsText(
|
||||
$row->page_namespace );
|
||||
$n = $ns . ':' . $n;
|
||||
}
|
||||
|
||||
|
|
@ -456,8 +455,6 @@ class SpecialExport extends SpecialPage {
|
|||
* @return array
|
||||
*/
|
||||
private function getPagesFromNamespace( $nsindex ) {
|
||||
global $wgContLang;
|
||||
|
||||
$maxPages = $this->getConfig()->get( 'ExportPagelistLimit' );
|
||||
|
||||
$dbr = wfGetDB( DB_REPLICA );
|
||||
|
|
@ -475,7 +472,8 @@ class SpecialExport extends SpecialPage {
|
|||
$n = $row->page_title;
|
||||
|
||||
if ( $row->page_namespace ) {
|
||||
$ns = $wgContLang->getNsText( $row->page_namespace );
|
||||
$ns = MediaWikiServices::getInstance()->getContentLanguage()->getNsText(
|
||||
$row->page_namespace );
|
||||
$n = $ns . ':' . $n;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
* @ingroup SpecialPage
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* Special page for listing the articles with the fewest revisions.
|
||||
*
|
||||
|
|
@ -68,8 +70,6 @@ class FewestrevisionsPage extends QueryPage {
|
|||
* @return string
|
||||
*/
|
||||
function formatResult( $skin, $result ) {
|
||||
global $wgContLang;
|
||||
|
||||
$nt = Title::makeTitleSafe( $result->namespace, $result->title );
|
||||
if ( !$nt ) {
|
||||
return Html::element(
|
||||
|
|
@ -83,7 +83,8 @@ class FewestrevisionsPage extends QueryPage {
|
|||
);
|
||||
}
|
||||
$linkRenderer = $this->getLinkRenderer();
|
||||
$text = $wgContLang->convert( $nt->getPrefixedText() );
|
||||
$text = MediaWikiServices::getInstance()->getContentLanguage()->
|
||||
convert( $nt->getPrefixedText() );
|
||||
$plink = $linkRenderer->makeLink( $nt, $text );
|
||||
|
||||
$nl = $this->msg( 'nrevisions' )->numParams( $result->value )->text();
|
||||
|
|
|
|||
|
|
@ -207,11 +207,9 @@ class FileDuplicateSearchPage extends QueryPage {
|
|||
* @return string HTML
|
||||
*/
|
||||
function formatResult( $skin, $result ) {
|
||||
global $wgContLang;
|
||||
|
||||
$linkRenderer = $this->getLinkRenderer();
|
||||
$nt = $result->getTitle();
|
||||
$text = $wgContLang->convert( $nt->getText() );
|
||||
$text = MediaWikiServices::getInstance()->getContentLanguage()->convert( $nt->getText() );
|
||||
$plink = $linkRenderer->makeLink(
|
||||
$nt,
|
||||
$text
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
* @ingroup SpecialPage
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* This special page lists all defined user groups and the associated rights.
|
||||
* See also @ref $wgGroupPermissions.
|
||||
|
|
@ -133,7 +135,6 @@ class SpecialListGroupRights extends SpecialPage {
|
|||
}
|
||||
|
||||
private function outputNamespaceProtectionInfo() {
|
||||
global $wgContLang;
|
||||
$out = $this->getOutput();
|
||||
$namespaceProtection = $this->getConfig()->get( 'NamespaceProtection' );
|
||||
|
||||
|
|
@ -169,7 +170,8 @@ class SpecialListGroupRights extends SpecialPage {
|
|||
if ( $namespace == NS_MAIN ) {
|
||||
$namespaceText = $this->msg( 'blanknamespace' )->text();
|
||||
} else {
|
||||
$namespaceText = $wgContLang->convertNamespace( $namespace );
|
||||
$namespaceText = MediaWikiServices::getInstance()->getContentLanguage()->
|
||||
convertNamespace( $namespace );
|
||||
}
|
||||
|
||||
$out->addHTML(
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
* @ingroup SpecialPage
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* A form to make the database readonly (eg for maintenance purposes).
|
||||
*
|
||||
|
|
@ -74,8 +76,6 @@ class SpecialLockdb extends FormSpecialPage {
|
|||
}
|
||||
|
||||
public function onSubmit( array $data ) {
|
||||
global $wgContLang;
|
||||
|
||||
if ( !$data['Confirm'] ) {
|
||||
return Status::newFatal( 'locknoconfirm' );
|
||||
}
|
||||
|
|
@ -92,10 +92,11 @@ class SpecialLockdb extends FormSpecialPage {
|
|||
}
|
||||
fwrite( $fp, $data['Reason'] );
|
||||
$timestamp = wfTimestampNow();
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
fwrite( $fp, "\n<p>" . $this->msg( 'lockedbyandtime',
|
||||
$this->getUser()->getName(),
|
||||
$wgContLang->date( $timestamp, false, false ),
|
||||
$wgContLang->time( $timestamp, false, false )
|
||||
$contLang->date( $timestamp, false, false ),
|
||||
$contLang->time( $timestamp, false, false )
|
||||
)->inContentLanguage()->text() . "</p>\n" );
|
||||
fclose( $fp );
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
* @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* Searches the database for files of the requested MIME type, comparing this with the
|
||||
* 'img_major_mime' and 'img_minor_mime' fields in the image table.
|
||||
|
|
@ -182,11 +184,9 @@ class MIMEsearchPage extends QueryPage {
|
|||
* @return string
|
||||
*/
|
||||
function formatResult( $skin, $result ) {
|
||||
global $wgContLang;
|
||||
|
||||
$linkRenderer = $this->getLinkRenderer();
|
||||
$nt = Title::makeTitle( $result->namespace, $result->title );
|
||||
$text = $wgContLang->convert( $nt->getText() );
|
||||
$text = MediaWikiServices::getInstance()->getContentLanguage()->convert( $nt->getText() );
|
||||
$plink = $linkRenderer->makeLink(
|
||||
Title::newFromText( $nt->getPrefixedText() ),
|
||||
$text
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
* @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use Wikimedia\Rdbms\IResultWrapper;
|
||||
use Wikimedia\Rdbms\IDatabase;
|
||||
|
||||
|
|
@ -71,8 +72,6 @@ class MostlinkedCategoriesPage extends QueryPage {
|
|||
* @return string
|
||||
*/
|
||||
function formatResult( $skin, $result ) {
|
||||
global $wgContLang;
|
||||
|
||||
$nt = Title::makeTitleSafe( NS_CATEGORY, $result->title );
|
||||
if ( !$nt ) {
|
||||
return Html::element(
|
||||
|
|
@ -85,7 +84,7 @@ class MostlinkedCategoriesPage extends QueryPage {
|
|||
);
|
||||
}
|
||||
|
||||
$text = $wgContLang->convert( $nt->getText() );
|
||||
$text = MediaWikiServices::getInstance()->getContentLanguage()->convert( $nt->getText() );
|
||||
$plink = $this->getLinkRenderer()->makeLink( $nt, $text );
|
||||
$nlinks = $this->msg( 'nmembers' )->numParams( $result->value )->escaped();
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
* @ingroup SpecialPage
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
class SpecialNewFiles extends IncludableSpecialPage {
|
||||
/** @var FormOptions */
|
||||
protected $opts;
|
||||
|
|
@ -213,13 +215,15 @@ class SpecialNewFiles extends IncludableSpecialPage {
|
|||
* Send the text to be displayed above the options
|
||||
*/
|
||||
function setTopText() {
|
||||
global $wgContLang;
|
||||
|
||||
$message = $this->msg( 'newimagestext' )->inContentLanguage();
|
||||
if ( !$message->isDisabled() ) {
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
$this->getOutput()->addWikiText(
|
||||
Html::rawElement( 'p',
|
||||
[ 'lang' => $wgContLang->getHtmlCode(), 'dir' => $wgContLang->getDir() ],
|
||||
[
|
||||
'lang' => $contLang->getHtmlCode(),
|
||||
'dir' => $contLang->getDir()
|
||||
],
|
||||
"\n" . $message->plain() . "\n"
|
||||
),
|
||||
/* $lineStart */ false,
|
||||
|
|
|
|||
|
|
@ -48,8 +48,6 @@ class SpecialPrefixindex extends SpecialAllPages {
|
|||
* @param string $par Becomes "FOO" when called like Special:Prefixindex/FOO (default null)
|
||||
*/
|
||||
function execute( $par ) {
|
||||
global $wgContLang;
|
||||
|
||||
$this->setHeaders();
|
||||
$this->outputHeader();
|
||||
|
||||
|
|
@ -65,7 +63,7 @@ class SpecialPrefixindex extends SpecialAllPages {
|
|||
$this->hideRedirects = $request->getBool( 'hideredirects', $this->hideRedirects );
|
||||
$this->stripPrefix = $request->getBool( 'stripprefix', $this->stripPrefix );
|
||||
|
||||
$namespaces = $wgContLang->getNamespaces();
|
||||
$namespaces = MediaWikiServices::getInstance()->getContentLanguage()->getNamespaces();
|
||||
$out->setPageTitle(
|
||||
( $namespace > 0 && array_key_exists( $namespace, $namespaces ) )
|
||||
? $this->msg( 'prefixindex-namespace', str_replace( '_', ' ', $namespaces[$namespace] ) )
|
||||
|
|
@ -143,15 +141,13 @@ class SpecialPrefixindex extends SpecialAllPages {
|
|||
* @param string|null $from List all pages from this name (default false)
|
||||
*/
|
||||
protected function showPrefixChunk( $namespace, $prefix, $from = null ) {
|
||||
global $wgContLang;
|
||||
|
||||
if ( $from === null ) {
|
||||
$from = $prefix;
|
||||
}
|
||||
|
||||
$fromList = $this->getNamespaceKeyAndText( $namespace, $from );
|
||||
$prefixList = $this->getNamespaceKeyAndText( $namespace, $prefix );
|
||||
$namespaces = $wgContLang->getNamespaces();
|
||||
$namespaces = MediaWikiServices::getInstance()->getContentLanguage()->getNamespaces();
|
||||
$res = null;
|
||||
$n = 0;
|
||||
$nextRow = null;
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue