diff options
author | Aaron Schulz <aaron@users.mediawiki.org> | 2012-01-10 02:18:27 +0000 |
---|---|---|
committer | Aaron Schulz <aaron@users.mediawiki.org> | 2012-01-10 02:18:27 +0000 |
commit | aad6cb07d69f259615043e581da73eef06cf6326 (patch) | |
tree | e9cf941ef67c1e093464e9a1fa96b145e81a7fb1 /includes/filerepo | |
parent | 4fc7769069562de2ba7611f7ee47aa4c77714cb5 (diff) | |
download | mediawikicore-aad6cb07d69f259615043e581da73eef06cf6326.tar.gz mediawikicore-aad6cb07d69f259615043e581da73eef06cf6326.zip |
r108353: Distinguish null/false in FileBackend::fileExists(). This is intended for things that might really care.
Notes
Notes:
http://mediawiki.org/wiki/Special:Code/MediaWiki/108488
Diffstat (limited to 'includes/filerepo')
-rw-r--r-- | includes/filerepo/backend/FileBackend.php | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/includes/filerepo/backend/FileBackend.php b/includes/filerepo/backend/FileBackend.php index fefb2c9d8484..d9710989cf3f 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; } /** |