Make lines short to pass phpcs in 2 files under includes/
[lhc/web/wiklou.git] / includes / GlobalFunctions.php
index c524948..6fbc11d 100644 (file)
@@ -4072,11 +4072,10 @@ function wfUnpack( $format, $data, $length = false ) {
  * @return bool
  */
 function wfIsBadImage( $name, $contextTitle = false, $blacklist = null ) {
-       # Handle redirects
-       $redirectTitle = RepoGroup::singleton()->checkRedirect( Title::makeTitle( NS_FILE, $name ) );
-       if ( $redirectTitle ) {
-               $name = $redirectTitle->getDBkey();
-       }
+       # Handle redirects; callers almost always hit wfFindFile() anyway,
+       # so just use that method because it has a fast process cache.
+       $file = wfFindFile( $name ); // get the final name
+       $name = $file ? $file->getTitle()->getDBkey() : $name;
 
        # Run the extension hook
        $bad = false;