Merge "Normalize dir path in AutoLoaderStructureTest"
[lhc/web/wiklou.git] / includes / specials / SpecialRedirect.php
index c4e4635..c1409ff 100644 (file)
@@ -21,6 +21,8 @@
  * @ingroup SpecialPage
  */
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * A special page that redirects to: the user for a numeric user id,
  * the file for a given filename, or the page for a given revision id.
@@ -61,8 +63,8 @@ class SpecialRedirect extends FormSpecialPage {
        function setParameter( $subpage ) {
                // parse $subpage to pull out the parts
                $parts = explode( '/', $subpage, 2 );
-               $this->mType = count( $parts ) > 0 ? $parts[0] : null;
-               $this->mValue = count( $parts ) > 1 ? $parts[1] : null;
+               $this->mType = $parts[0];
+               $this->mValue = $parts[1] ?? null;
        }
 
        /**
@@ -101,7 +103,7 @@ class SpecialRedirect extends FormSpecialPage {
                } catch ( MalformedTitleException $e ) {
                        return Status::newFatal( $e->getMessageObject() );
                }
-               $file = wfFindFile( $title );
+               $file = MediaWikiServices::getInstance()->getRepoGroup()->findFile( $title );
 
                if ( !$file || !$file->exists() ) {
                        // Message: redirect-not-exists