Add fileExistsBatch method to FileRepo and derived classes (per comments on r49001)
authorVictor Vasiliev <vasilievvv@users.mediawiki.org>
Mon, 8 Jun 2009 15:10:08 +0000 (15:10 +0000)
committerVictor Vasiliev <vasilievvv@users.mediawiki.org>
Mon, 8 Jun 2009 15:10:08 +0000 (15:10 +0000)
includes/filerepo/FileRepo.php
includes/filerepo/ForeignAPIRepo.php
includes/filerepo/NullRepo.php

index 4176d3a..f359c83 100644 (file)
@@ -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.
         *
index 613f4c0..cf7428a 100644 (file)
@@ -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;
        }
index fb89ceb..0b5b644 100644 (file)
@@ -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;
        }