Copy FilesystemIterator constants so we can still pretend to support 5.2
authorChad Horohoe <demon@users.mediawiki.org>
Fri, 27 Jan 2012 14:29:29 +0000 (14:29 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Fri, 27 Jan 2012 14:29:29 +0000 (14:29 +0000)
includes/filerepo/backend/FSFileBackend.php

index 6a9b305..d0ff92c 100644 (file)
@@ -22,6 +22,14 @@ g<?php
  * @since 1.19
  */
 class FSFileBackend extends FileBackend {
+
+       /**
+        * These constants are the same as the ones in FilesystemIterator, but
+        * that's only 5.3+ so copy them here. When we drop 5.2 we can remove this
+        */
+       const CURRENT_AS_FILEINFO = 0;
+       const SKIP_DOTS = 4096;
+       
        protected $basePath; // string; directory holding the container directories
        /** @var Array Map of container names to root paths */
        protected $containerPaths = array(); // for custom container paths
@@ -548,7 +556,7 @@ class FSFileBackendFileList implements Iterator {
                $dir = realpath( $dir ); // normalize
                $this->suffixStart = strlen( $dir ) + 1; // size of "path/to/dir/"
                try {
-                       $flags = FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::SKIP_DOTS;
+                       $flags = self::CURRENT_AS_FILEINFO | self::SKIP_DOTS;
                        $this->iter = new RecursiveIteratorIterator(
                                new RecursiveDirectoryIterator( $dir, $flags ) );
                } catch ( UnexpectedValueException $e ) {