aboutsummaryrefslogtreecommitdiffstats
path: root/includes/api/ApiMove.php
diff options
context:
space:
mode:
authorUmherirrender <umherirrender_de.wp@web.de>2019-08-19 22:45:43 +0200
committerUmherirrender <umherirrender_de.wp@web.de>2019-09-01 20:49:19 +0200
commit6b8a2a75ee4a0b5c9b77e47123cf11475107c15e (patch)
treee3ffe07630425e3d529c025982e887d6ee5df22c /includes/api/ApiMove.php
parent75f1fe04a8006df7b8716c4b966b1725d5d4bea1 (diff)
downloadmediawikicore-6b8a2a75ee4a0b5c9b77e47123cf11475107c15e.tar.gz
mediawikicore-6b8a2a75ee4a0b5c9b77e47123cf11475107c15e.zip
Avoid multiply calls to MediaWikiServices::getInstance() in one function
RepoGroup::singleton() results in MediaWikiServices::getInstance()->getRepoGroup() Also avoid getting the service in loops, doing it once before the loop is cheaper Change-Id: I29e0c7487e3e498559ff16a567e2fad0c0f8bb69
Diffstat (limited to 'includes/api/ApiMove.php')
-rw-r--r--includes/api/ApiMove.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/includes/api/ApiMove.php b/includes/api/ApiMove.php
index 4cbed21394c2..74c6f8fccdb7 100644
--- a/includes/api/ApiMove.php
+++ b/includes/api/ApiMove.php
@@ -59,9 +59,10 @@ class ApiMove extends ApiBase {
}
$toTalk = $toTitle->getTalkPageIfDefined();
+ $repoGroup = MediaWikiServices::getInstance()->getRepoGroup();
if ( $toTitle->getNamespace() == NS_FILE
- && !RepoGroup::singleton()->getLocalRepo()->findFile( $toTitle )
- && MediaWikiServices::getInstance()->getRepoGroup()->findFile( $toTitle )
+ && !$repoGroup->getLocalRepo()->findFile( $toTitle )
+ && $repoGroup->findFile( $toTitle )
) {
if ( !$params['ignorewarnings'] &&
$this->getPermissionManager()->userHasRight( $user, 'reupload-shared' ) ) {