Don't check for existence twice for non-existent files when no time is specified.
authorTim Starling <tstarling@users.mediawiki.org>
Wed, 7 May 2008 03:39:35 +0000 (03:39 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Wed, 7 May 2008 03:39:35 +0000 (03:39 +0000)
includes/filerepo/FileRepo.php

index d19b1fa..2fd1749 100644 (file)
@@ -94,12 +94,14 @@ abstract class FileRepo {
                        return $img;
                }
                # Now try an old version of the file
-               $img = $this->newFile( $title, $time );
-               if ( $img->exists() ) {
-                       if ( !$img->isDeleted(File::DELETED_FILE) ) {
-                               return $img;
-                       } else if ( ($flags & FileRepo::FIND_PRIVATE) && $img->userCan(File::DELETED_FILE) ) {
-                               return $img;
+               if ( $time !== false ) {
+                       $img = $this->newFile( $title, $time );
+                       if ( $img->exists() ) {
+                               if ( !$img->isDeleted(File::DELETED_FILE) ) {
+                                       return $img;
+                               } else if ( ($flags & FileRepo::FIND_PRIVATE) && $img->userCan(File::DELETED_FILE) ) {
+                                       return $img;
+                               }
                        }
                }
                # Now try redirects