From aad6cb07d69f259615043e581da73eef06cf6326 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 10 Jan 2012 02:18:27 +0000 Subject: [PATCH] r108353: Distinguish null/false in FileBackend::fileExists(). This is intended for things that might really care. --- includes/filerepo/backend/FileBackend.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/includes/filerepo/backend/FileBackend.php b/includes/filerepo/backend/FileBackend.php index fefb2c9d84..d9710989cf 100644 --- a/includes/filerepo/backend/FileBackend.php +++ b/includes/filerepo/backend/FileBackend.php @@ -405,16 +405,17 @@ abstract class FileBackendBase { /** * Get quick information about a file at a storage path in the backend. - * The result is an associative array that includes: - * mtime : the last-modified timestamp (TS_MW) or false - * size : the file size (bytes) or false + * If the file does not exist, then this returns false. + * Otherwise, the result is an associative array that includes: + * mtime : the last-modified timestamp (TS_MW) + * size : the file size (bytes) * * $params include: * src : source storage path * latest : use the latest available data * * @param $params Array - * @return Array|false Returns false on failure + * @return Array|false|null Returns null on failure */ abstract public function getFileStat( array $params ); @@ -867,7 +868,11 @@ abstract class FileBackend extends FileBackendBase { * @see FileBackendBase::fileExists() */ final public function fileExists( array $params ) { - return (bool)$this->getFileStat( $params ); + $stat = $this->getFileStat( $params ); + if ( $stat === null ) { + return null; // failure + } + return (bool)$stat; } /** -- 2.20.1