From bb94f4964d1da0ed6a5fc3ae9f0e1b629a8cfd96 Mon Sep 17 00:00:00 2001 From: Fomafix Date: Mon, 26 Aug 2019 16:08:10 +0200 Subject: [PATCH] Use local variabe $services instead of MediaWikiServices::getInstance() Change-Id: Ieb6230231d9b916fd1366e7b473db00c87ac4428 --- includes/Linker.php | 6 +++--- includes/OutputPage.php | 2 +- includes/Title.php | 2 +- includes/actions/InfoAction.php | 2 +- includes/api/ApiPageSet.php | 2 +- includes/api/ApiQueryAllDeletedRevisions.php | 2 +- includes/filebackend/FileBackendGroup.php | 2 +- includes/specials/pagers/ImageListPager.php | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/includes/Linker.php b/includes/Linker.php index 47be8a27ea..a79ec3a8f1 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -1322,7 +1322,7 @@ class Linker { $services->getNamespaceInfo()->getCanonicalName( NS_MEDIA ), '/' ); $medians .= '|'; $medians .= preg_quote( - MediaWikiServices::getInstance()->getContentLanguage()->getNsText( NS_MEDIA ), + $services->getContentLanguage()->getNsText( NS_MEDIA ), '/' ) . '):'; @@ -1359,7 +1359,7 @@ class Linker { } if ( $match[1] !== false && $match[1] !== '' ) { if ( preg_match( - MediaWikiServices::getInstance()->getContentLanguage()->linkTrail(), + $services->getContentLanguage()->linkTrail(), $match[3], $submatch ) ) { @@ -1375,7 +1375,7 @@ class Linker { Title::newFromText( $linkTarget ); try { - $target = MediaWikiServices::getInstance()->getTitleParser()-> + $target = $services->getTitleParser()-> parseTitle( $linkTarget ); if ( $target->getText() == '' && !$target->isExternal() diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 3f2dcf7f4b..b2ca53aa18 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -3227,7 +3227,7 @@ class OutputPage extends ContextSource { $title = $this->getTitle(); $ns = $title->getNamespace(); - $nsInfo = MediaWikiServices::getInstance()->getNamespaceInfo(); + $nsInfo = $services->getNamespaceInfo(); $canonicalNamespace = $nsInfo->exists( $ns ) ? $nsInfo->getCanonicalName( $ns ) : $title->getNsText(); diff --git a/includes/Title.php b/includes/Title.php index 75ddea8dd4..eb1907604e 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -3184,7 +3184,7 @@ class Title implements LinkTarget, IDBAccessObject { public static function capitalize( $text, $ns = NS_MAIN ) { $services = MediaWikiServices::getInstance(); if ( $services->getNamespaceInfo()->isCapitalized( $ns ) ) { - return MediaWikiServices::getInstance()->getContentLanguage()->ucfirst( $text ); + return $services->getContentLanguage()->ucfirst( $text ); } else { return $text; } diff --git a/includes/actions/InfoAction.php b/includes/actions/InfoAction.php index 15cee948ae..7bcfc8821d 100644 --- a/includes/actions/InfoAction.php +++ b/includes/actions/InfoAction.php @@ -280,7 +280,7 @@ class InfoAction extends FormlessAction { // Language in which the page content is (supposed to be) written $pageLang = $title->getPageLanguage()->getCode(); - $permissionManager = MediaWikiServices::getInstance()->getPermissionManager(); + $permissionManager = $services->getPermissionManager(); $pageLangHtml = $pageLang . ' - ' . Language::fetchLanguageName( $pageLang, $lang->getCode() ); diff --git a/includes/api/ApiPageSet.php b/includes/api/ApiPageSet.php index 1b588650f0..c604322ed2 100644 --- a/includes/api/ApiPageSet.php +++ b/includes/api/ApiPageSet.php @@ -1253,7 +1253,7 @@ class ApiPageSet extends ApiBase { // Need gender information if ( - MediaWikiServices::getInstance()->getNamespaceInfo()-> + $services->getNamespaceInfo()-> hasGenderDistinction( $titleObj->getNamespace() ) ) { $usernames[] = $titleObj->getText(); diff --git a/includes/api/ApiQueryAllDeletedRevisions.php b/includes/api/ApiQueryAllDeletedRevisions.php index d713b3aed1..7d6d342113 100644 --- a/includes/api/ApiQueryAllDeletedRevisions.php +++ b/includes/api/ApiQueryAllDeletedRevisions.php @@ -134,7 +134,7 @@ class ApiQueryAllDeletedRevisions extends ApiQueryRevisionsBase { $this->addJoinConds( [ 'change_tag' => [ 'JOIN', [ 'ar_rev_id=ct_rev_id' ] ] ] ); - $changeTagDefStore = MediaWikiServices::getInstance()->getChangeTagDefStore(); + $changeTagDefStore = $services->getChangeTagDefStore(); try { $this->addWhereFld( 'ct_tag_id', $changeTagDefStore->getId( $params['tag'] ) ); } catch ( NameTableAccessException $exception ) { diff --git a/includes/filebackend/FileBackendGroup.php b/includes/filebackend/FileBackendGroup.php index db7141f76b..8b31f05c83 100644 --- a/includes/filebackend/FileBackendGroup.php +++ b/includes/filebackend/FileBackendGroup.php @@ -186,7 +186,7 @@ class FileBackendGroup { 'mimeCallback' => [ $this, 'guessMimeInternal' ], 'obResetFunc' => 'wfResetOutputBuffers', 'streamMimeFunc' => [ StreamFile::class, 'contentTypeFromPath' ], - 'tmpFileFactory' => MediaWikiServices::getInstance()->getTempFSFileFactory(), + 'tmpFileFactory' => $services->getTempFSFileFactory(), 'statusWrapper' => [ Status::class, 'wrap' ], 'wanCache' => $services->getMainWANObjectCache(), 'srvCache' => ObjectCache::getLocalServerInstance( 'hash' ), diff --git a/includes/specials/pagers/ImageListPager.php b/includes/specials/pagers/ImageListPager.php index 2d3b6b291f..d05694a9d0 100644 --- a/includes/specials/pagers/ImageListPager.php +++ b/includes/specials/pagers/ImageListPager.php @@ -478,7 +478,7 @@ class ImageListPager extends TablePager { // Add delete links if allowed // From https://github.com/Wikia/app/pull/3859 - $permissionManager = MediaWikiServices::getInstance()->getPermissionManager(); + $permissionManager = $services->getPermissionManager(); if ( $permissionManager->userCan( 'delete', $this->getUser(), $filePage ) ) { $deleteMsg = $this->msg( 'listfiles-delete' )->text(); -- 2.20.1