From: Tim Starling Date: Wed, 7 May 2008 03:39:35 +0000 (+0000) Subject: Don't check for existence twice for non-existent files when no time is specified. X-Git-Tag: 1.31.0-rc.0~47854 X-Git-Url: https://git.cyclocoop.org/admin/%7B%7Blocalurl:Special:UserLogin%7D%7D?a=commitdiff_plain;h=3e8af533f19e08242907046fea1b489016f2d768;p=lhc%2Fweb%2Fwiklou.git Don't check for existence twice for non-existent files when no time is specified. --- 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