From 3e8af533f19e08242907046fea1b489016f2d768 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Wed, 7 May 2008 03:39:35 +0000 Subject: [PATCH] Don't check for existence twice for non-existent files when no time is specified. --- includes/filerepo/FileRepo.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php index d19b1fa530..2fd17497f6 100644 --- a/includes/filerepo/FileRepo.php +++ b/includes/filerepo/FileRepo.php @@ -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 -- 2.20.1