aboutsummaryrefslogtreecommitdiffstats
path: root/thumb.php
diff options
context:
space:
mode:
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>2022-12-14 21:54:17 +0000
committerGerrit Code Review <gerrit@wikimedia.org>2022-12-14 21:54:17 +0000
commit137238ab0ad26327fa326dd6d1fc7e0b166f543f (patch)
treed045a28192bccaa711d799b76c437ac075b6f2c9 /thumb.php
parenta3470d3cff6b535d1a09d68505df642406a4be0c (diff)
parent8350ab4d9d3b8fb59e2cf460bb74a1dd65893a62 (diff)
downloadmediawikicore-137238ab0ad26327fa326dd6d1fc7e0b166f543f.tar.gz
mediawikicore-137238ab0ad26327fa326dd6d1fc7e0b166f543f.zip
Merge "Replace deprecated PermissionManager::getGroupPermissions"
Diffstat (limited to 'thumb.php')
-rw-r--r--thumb.php11
1 files changed, 6 insertions, 5 deletions
diff --git a/thumb.php b/thumb.php
index d0d7408f2311..6c684c9425e1 100644
--- a/thumb.php
+++ b/thumb.php
@@ -104,7 +104,6 @@ function wfThumbHandle404() {
*/
function wfStreamThumb( array $params ) {
global $wgVaryOnXFP;
- $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
$headers = []; // HTTP headers to send
@@ -131,9 +130,11 @@ function wfStreamThumb( array $params ) {
$isTemp = ( isset( $params['temp'] ) && $params['temp'] );
unset( $params['temp'] ); // handlers don't care
+ $services = MediaWikiServices::getInstance();
+
// Some basic input validation
$fileName = strtr( $fileName, '\\/', '__' );
- $localRepo = MediaWikiServices::getInstance()->getRepoGroup()->getLocalRepo();
+ $localRepo = $services->getRepoGroup()->getLocalRepo();
// Actually fetch the image. Method depends on whether it is archived or not.
if ( $isTemp ) {
@@ -169,11 +170,11 @@ function wfStreamThumb( array $params ) {
// Check permissions if there are read restrictions
$varyHeader = [];
- if ( !in_array( 'read', $permissionManager->getGroupPermissions( [ '*' ] ), true ) ) {
+ if ( !$services->getGroupPermissionsLookup()->groupHasPermission( '*', 'read' ) ) {
$user = RequestContext::getMain()->getUser();
$imgTitle = $img->getTitle();
- if ( !$imgTitle || !$permissionManager->userCan( 'read', $user, $imgTitle ) ) {
+ if ( !$imgTitle || !$services->getPermissionManager()->userCan( 'read', $user, $imgTitle ) ) {
wfThumbError( 403, 'Access denied. You do not have permission to access ' .
'the source file.' );
return;
@@ -336,7 +337,7 @@ function wfStreamThumb( array $params ) {
$streamtime = microtime( true ) - $starttime;
if ( $status->isOK() ) {
- MediaWikiServices::getInstance()->getStatsdDataFactory()->timing(
+ $services->getStatsdDataFactory()->timing(
'media.thumbnail.stream', $streamtime
);
} else {