From: Victor Vasiliev Date: Mon, 8 Jun 2009 15:10:08 +0000 (+0000) Subject: Add fileExistsBatch method to FileRepo and derived classes (per comments on r49001) X-Git-Tag: 1.31.0-rc.0~41446 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=5b0032a3b088c92970fd74c590462c45ca7c7f54;p=lhc%2Fweb%2Fwiklou.git Add fileExistsBatch method to FileRepo and derived classes (per comments on r49001) --- diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php index 4176d3a257..f359c83afa 100644 --- a/includes/filerepo/FileRepo.php +++ b/includes/filerepo/FileRepo.php @@ -401,6 +401,21 @@ abstract class FileRepo { */ abstract function publishBatch( $triplets, $flags = 0 ); + function fileExists( $file, $flags = 0 ) { + $result = $this->fileExistsBatch( array( $file ), $flags ); + return $file; + } + + /** + * Checks existence of an array of files. + * + * @param array $files URLs (or paths) of files to check + * @param integer $flags Bitwise combination of the following flags: + * self::FILES_ONLY Mark file as existing only if it is a file (not directory) + * @return Either array of files and existence flags, or false + */ + abstract function fileExistsBatch( $files, $flags = 0 ); + /** * Move a group of files to the deletion archive. * diff --git a/includes/filerepo/ForeignAPIRepo.php b/includes/filerepo/ForeignAPIRepo.php index 613f4c000c..cf7428a89b 100644 --- a/includes/filerepo/ForeignAPIRepo.php +++ b/includes/filerepo/ForeignAPIRepo.php @@ -57,6 +57,9 @@ class ForeignAPIRepo extends FileRepo { function deleteBatch( $sourceDestPairs ) { return false; } + function fileExistsBatch( $files, $flags = 0 ) { + return false; + } function getFileProps( $virtualUrl ) { return false; } diff --git a/includes/filerepo/NullRepo.php b/includes/filerepo/NullRepo.php index fb89cebb5f..0b5b6442cc 100644 --- a/includes/filerepo/NullRepo.php +++ b/includes/filerepo/NullRepo.php @@ -20,6 +20,9 @@ class NullRepo extends FileRepo { function deleteBatch( $sourceDestPairs ) { return false; } + function fileExistsBatch( $files, $flags = 0 ) { + return false; + } function getFileProps( $virtualUrl ) { return false; }