<?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
}
}
- $file = wfFindFile( $title, [ 'latest' => true ] );
+ $file = MediaWikiServices::getInstance()->getRepoGroup()->findFile(
+ $title, [ 'latest' => true ]
+ );
if ( !$file ) {
$r['result'] = 'Failure';
$r['errors'] = $this->getErrorFormatter()->arrayFromStatus(
continue;
}
$ext = strtolower( pathinfo( "$srcPath", PATHINFO_EXTENSION ) );
- $tmpFile = TempFSFile::factory( 'rotate_', $ext, wfTempDir() );
+ $tmpFile = MediaWikiServices::getInstance()->getTempFSFileFactory()
+ ->newTempFSFile( 'rotate_', $ext );
$dstPath = $tmpFile->getPath();
+ // @phan-suppress-next-line PhanUndeclaredMethod
$err = $handler->rotate( $file, [
'srcPath' => $srcPath,
'dstPath' => $dstPath,
$comment = wfMessage(
'rotate-comment'
)->numParams( $rotation )->inContentLanguage()->text();
+ // @phan-suppress-next-line PhanUndeclaredMethod
$status = $file->upload(
$dstPath,
$comment,