Index: trunk/phase3/includes/filerepo/backend/FSFileBackend.php |
— | — | @@ -540,6 +540,7 @@ |
541 | 541 | /** @var RecursiveIteratorIterator */ |
542 | 542 | protected $iter; |
543 | 543 | protected $suffixStart; // integer |
| 544 | + protected $pos = 0; // integer |
544 | 545 | |
545 | 546 | /** |
546 | 547 | * @param $dir string file system directory |
— | — | @@ -548,9 +549,8 @@ |
549 | 550 | $dir = realpath( $dir ); // normalize |
550 | 551 | $this->suffixStart = strlen( $dir ) + 1; // size of "path/to/dir/" |
551 | 552 | try { |
552 | | - $flags = FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::SKIP_DOTS; |
553 | | - $this->iter = new RecursiveIteratorIterator( |
554 | | - new RecursiveDirectoryIterator( $dir, $flags ) ); |
| 553 | + # Get an iterator that will return leaf nodes (non-directories) |
| 554 | + $this->iter = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $dir ) ); |
555 | 555 | } catch ( UnexpectedValueException $e ) { |
556 | 556 | $this->iter = null; // bad permissions? deleted? |
557 | 557 | } |
— | — | @@ -564,7 +564,7 @@ |
565 | 565 | } |
566 | 566 | |
567 | 567 | public function key() { |
568 | | - return $this->iter->key(); |
| 568 | + return $this->pos; |
569 | 569 | } |
570 | 570 | |
571 | 571 | public function next() { |
— | — | @@ -573,9 +573,11 @@ |
574 | 574 | } catch ( UnexpectedValueException $e ) { |
575 | 575 | $this->iter = null; |
576 | 576 | } |
| 577 | + ++$this->pos; |
577 | 578 | } |
578 | 579 | |
579 | 580 | public function rewind() { |
| 581 | + $this->pos = 0; |
580 | 582 | try { |
581 | 583 | $this->iter->rewind(); |
582 | 584 | } catch ( UnexpectedValueException $e ) { |