Index: trunk/phase3/includes/filerepo/backend/FSFileBackend.php |
— | — | @@ -550,7 +550,17 @@ |
551 | 551 | $this->suffixStart = strlen( $dir ) + 1; // size of "path/to/dir/" |
552 | 552 | try { |
553 | 553 | # Get an iterator that will return leaf nodes (non-directories) |
554 | | - $this->iter = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $dir ) ); |
| 554 | + if ( MWInit::classExists( 'FilesystemIterator' ) ) { // PHP >= 5.3 |
| 555 | + # RecursiveDirectoryIterator extends FilesystemIterator. |
| 556 | + # FilesystemIterator::SKIP_DOTS default is inconsistent in PHP 5.3.x. |
| 557 | + $flags = FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::SKIP_DOTS; |
| 558 | + $this->iter = new RecursiveIteratorIterator( |
| 559 | + new RecursiveDirectoryIterator( $dir, $flags ) ); |
| 560 | + } else { // PHP < 5.3 |
| 561 | + # RecursiveDirectoryIterator extends DirectoryIterator |
| 562 | + $this->iter = new RecursiveIteratorIterator( |
| 563 | + new RecursiveDirectoryIterator( $dir ) ); |
| 564 | + } |
555 | 565 | } catch ( UnexpectedValueException $e ) { |
556 | 566 | $this->iter = null; // bad permissions? deleted? |
557 | 567 | } |