* @param User|null $user User performing the action, or null to use $wgUser
* @param string|string[]|null $tags Change tags to add to log entry
* ($user should be able to add the specified tags before this is called)
- * @return array|bool array(number of file revisions restored, number of image revisions
- * restored, log message) on success, false on failure.
+ * @return array|bool [ number of file revisions restored, number of image revisions
+ * restored, log message ] on success, false on failure.
*/
public function undelete( $timestamps, $comment = '', $fileVersions = [],
$unsuppress = false, User $user = null, $tags = null
$restoreFiles = $restoreAll || !empty( $fileVersions );
if ( $restoreFiles && $this->title->getNamespace() == NS_FILE ) {
- $img = wfLocalFile( $this->title );
+ /** @var LocalFile $img */
+ $img = MediaWikiServices::getInstance()->getRepoGroup()->getLocalRepo()
+ ->newFile( $this->title );
$img->load( File::READ_LATEST );
$this->fileStatus = $img->restore( $fileVersions, $unsuppress );
if ( !$this->fileStatus->isOK() ) {