| @@ -20,25 +20,22 @@ | ||
| 20 | 20 | public function work() { |
| 21 | 21 | |
| 22 | 22 | $dirEntries = $this->fileEntryRepository->get($this->skip, $this->count, FileEntry::TYPE_DIR); |
| 23 | 23 | $root = $this->snapshotRepository->load()->root; |
| 24 | - | |
| 25 | 24 | foreach ($dirEntries as $dirEntry) { |
| 26 | 25 | |
| 27 | 26 | $realDir = $this->fileEntryRepository->calcFullPath($dirEntry, $root); |
| 28 | - //$this->log("Scanning " . $realDir . " for files..."); | |
| 27 | + $pattern = $realDir . '/*'; | |
| 28 | + $this->log("Scanning " . $realDir . " for files..."); | |
| 29 | 29 | |
| 30 | - $files = scandir($realDir . '/'); | |
| 30 | + $entries = glob($pattern); | |
| 31 | + $files = array_values(array_filter($entries, 'is_file')); | |
| 31 | 32 | |
| 32 | 33 | foreach ($files as $file) { |
| 33 | - if (!is_file($realDir . '/' . $file)) { | |
| 34 | - continue; | |
| 35 | - } | |
| 36 | - | |
| 37 | 34 | // persist file info |
| 38 | 35 | $fileEntry = new FileEntry(); |
| 39 | 36 | $fileEntry->parent_id = $dirEntry->id; |
| 40 | - $fileEntry->name = $file; | |
| 37 | + $fileEntry->name = basename($file); | |
| 41 | 38 | $fileEntry->type = FileEntry::TYPE_FILE; |
| 42 | 39 | $fileEntry->size = 0; |
| 43 | 40 | $this->fileEntryRepository->createOrUpdate($fileEntry); |
| 44 | 41 | } |