* @ingroup Upload
*/
+use MediaWiki\MediaWikiServices;
+use MediaWiki\User\UserIdentity;
+
/**
* Implements uploading from a HTTP resource.
*
* user is not allowed, return the name of the user right as a string. If
* the user is allowed, have the parent do further permissions checking.
*
- * @param User $user
+ * @param UserIdentity $user
*
* @return bool|string
*/
- public static function isAllowed( $user ) {
- if ( !$user->isAllowed( 'upload_by_url' ) ) {
+ public static function isAllowed( UserIdentity $user ) {
+ if ( !MediaWikiServices::getInstance()
+ ->getPermissionManager()
+ ->userHasRight( $user, 'upload_by_url' )
+ ) {
return 'upload_by_url';
}
$url = $request->getVal( 'wpUploadFileURL' );
return !empty( $url )
- && $wgUser->isAllowed( 'upload_by_url' );
+ && MediaWikiServices::getInstance()
+ ->getPermissionManager()
+ ->userHasRight( $wgUser, 'upload_by_url' );
}
/**
* @return string Path to the file
*/
protected function makeTemporaryFile() {
- $tmpFile = TempFSFile::factory( 'URL', 'urlupload_', wfTempDir() );
+ $tmpFile = MediaWikiServices::getInstance()->getTempFSFileFactory()
+ ->newTempFSFile( 'URL', 'urlupload_' );
$tmpFile->bind( $this );
return $tmpFile->getPath();