aboutsummaryrefslogtreecommitdiffstats
path: root/includes/api
diff options
context:
space:
mode:
authorDerick Alangi <alangiderick@gmail.com>2019-05-14 18:00:34 +0100
committerD3r1ck01 <xsavitar.wiki@aol.com>2019-06-11 13:26:37 +0000
commit21e2d71560cb87191dd80ae0750d0190b45063c1 (patch)
treea0088f08e76373bc0cd01e78531829e172210d6e /includes/api
parenta6dce8b8cd0b665ed4a00ad6bdcfabf69f2925c3 (diff)
downloadmediawikicore-21e2d71560cb87191dd80ae0750d0190b45063c1.tar.gz
mediawikicore-21e2d71560cb87191dd80ae0750d0190b45063c1.zip
Replace some uses of deprecated wfFindFile() and wfLocalFile()
These global functions were deprecated in 1.34 and services made available to replace them. See services below; * wfFindFile() - MediaWikiServices::getInstance()->getRepoGroup()->findFile() * wfLocalFind() - MediaWikiServices::getInstance()->getRepoGroup()->getLocalRepo()->newFile() NOTES: * wfFindFile() and wfLocalFind() usages in tests have been ignored in this change per @Timo's comments about state of objects. * includes/upload/UploadBase.php also maintained for now as it causes some failures I don't fully understand, will investigate and handle it in a follow up patch. * Also, includes/MovePage.php Change-Id: I9437494de003f40fbe591321da7b42d16bb732d6
Diffstat (limited to 'includes/api')
-rw-r--r--includes/api/ApiImageRotate.php7
-rw-r--r--includes/api/ApiMove.php4
-rw-r--r--includes/api/ApiQueryImageInfo.php3
3 files changed, 11 insertions, 3 deletions
diff --git a/includes/api/ApiImageRotate.php b/includes/api/ApiImageRotate.php
index 704513822f87..668bd0e4272e 100644
--- a/includes/api/ApiImageRotate.php
+++ b/includes/api/ApiImageRotate.php
@@ -1,4 +1,7 @@
<?php
+
+use MediaWiki\MediaWikiServices;
+
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -56,7 +59,9 @@ class ApiImageRotate extends ApiBase {
}
}
- $file = wfFindFile( $title, [ 'latest' => true ] );
+ $file = MediaWikiServices::getInstance()->getRepoGroup()->findFile(
+ $title, [ 'latest' => true ]
+ );
if ( !$file ) {
$r['result'] = 'Failure';
$r['errors'] = $this->getErrorFormatter()->arrayFromStatus(
diff --git a/includes/api/ApiMove.php b/includes/api/ApiMove.php
index 89ecc43bd946..540860b3a9d9 100644
--- a/includes/api/ApiMove.php
+++ b/includes/api/ApiMove.php
@@ -20,6 +20,8 @@
* @file
*/
+use MediaWiki\MediaWikiServices;
+
/**
* API Module to move pages
* @ingroup API
@@ -59,7 +61,7 @@ class ApiMove extends ApiBase {
if ( $toTitle->getNamespace() == NS_FILE
&& !RepoGroup::singleton()->getLocalRepo()->findFile( $toTitle )
- && wfFindFile( $toTitle )
+ && MediaWikiServices::getInstance()->getRepoGroup()->findFile( $toTitle )
) {
if ( !$params['ignorewarnings'] && $user->isAllowed( 'reupload-shared' ) ) {
$this->dieWithError( 'apierror-fileexists-sharedrepo-perm' );
diff --git a/includes/api/ApiQueryImageInfo.php b/includes/api/ApiQueryImageInfo.php
index 051e12796f08..e123a2ac468c 100644
--- a/includes/api/ApiQueryImageInfo.php
+++ b/includes/api/ApiQueryImageInfo.php
@@ -110,7 +110,8 @@ class ApiQueryImageInfo extends ApiQueryBase {
if ( !isset( $images[$title] ) ) {
if ( isset( $prop['uploadwarning'] ) || isset( $prop['badfile'] ) ) {
// uploadwarning and badfile need info about non-existing files
- $images[$title] = wfLocalFile( $title );
+ $images[$title] = MediaWikiServices::getInstance()->getRepoGroup()
+ ->getLocalRepo()->newFile( $title );
// Doesn't exist, so set an empty image repository
$info['imagerepository'] = '';
} else {