PluginProbe ʕ •ᴥ•ʔ
JetBackup – Backup, Restore & Migrate / 3.1.18.8
JetBackup – Backup, Restore & Migrate v3.1.18.8
3.1.22.3 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.8.1 1.4.9 1.5.0 1.5.1 1.5.1.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6.0 1.6.10 1.6.11 1.6.12 1.6.13 1.6.15 1.6.5.1 1.6.8.8 1.6.9 1.6.9.1 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7.5 2.0.8.7 2.0.9.11 2.0.9.14 2.0.9.15 2.0.9.6 2.0.9.7 2.0.9.9 3.1.10.7 3.1.11.1 3.1.12.3 3.1.13.4 3.1.14.17 3.1.15.4 3.1.16.1 3.1.17.5 3.1.18.10 3.1.18.8 3.1.18.9 3.1.19.8 3.1.20.3 3.1.21.3 3.1.7.9 3.1.9.2 trunk 1.1.90 1.1.91 1.2.0 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2
backup / src / JetBackup / Cron / Task / Reindex.php
backup / src / JetBackup / Cron / Task Last commit date
.htaccess 5 months ago Backup.php 5 months ago Download.php 5 months ago DownloadBackupLog.php 5 months ago Export.php 5 months ago Extract.php 5 months ago PreRestore.php 5 months ago Reindex.php 5 months ago Restore.php 5 months ago RetentionCleanup.php 5 months ago System.php 5 months ago Task.php 5 months ago index.html 5 months ago web.config 5 months ago
Reindex.php
570 lines
1 <?php
2
3 namespace JetBackup\Cron\Task;
4
5 use Exception;
6 use JetBackup\Alert\Alert;
7 use JetBackup\BackupJob\BackupJob;
8 use JetBackup\Data\Engine;
9 use JetBackup\Destination\Destination;
10 use JetBackup\Destination\DestinationFile;
11 use JetBackup\Destination\Integration\DestinationDirIterator;
12 use JetBackup\Destination\Integration\DestinationFile as DestinationFileAlias;
13 use JetBackup\Entities\Util;
14 use JetBackup\Exception\DBException;
15 use JetBackup\Exception\DestinationException;
16 use JetBackup\Exception\IOException;
17 use JetBackup\Exception\JetBackupLinuxException;
18 use JetBackup\Exception\ReindexException;
19 use JetBackup\Exception\SnapshotMetaException;
20 use JetBackup\Exception\TaskException;
21 use JetBackup\Exception\ValidationException;
22 use JetBackup\Factory;
23 use JetBackup\JetBackup;
24 use JetBackup\JetBackupLinux\JetBackupLinux;
25 use JetBackup\License\License;
26 use JetBackup\Queue\Queue;
27 use JetBackup\Queue\QueueItem;
28 use JetBackup\Queue\QueueItemReindex;
29 use JetBackup\Snapshot\Snapshot;
30 use JetBackup\Snapshot\SnapshotItem;
31 use SleekDB\Exceptions\InvalidArgumentException;
32
33 if (!defined( '__JETBACKUP__')) die('Direct access is not allowed');
34
35 class Reindex extends Task {
36
37 const LOG_FILENAME = 'reindex';
38
39 private QueueItemReindex $_queue_item_reindex;
40 private ?Destination $_destination=null;
41
42 public function __construct() {
43 parent::__construct(self::LOG_FILENAME);
44 }
45
46 /**
47 * @return void
48 * @throws InvalidArgumentException
49 * @throws DBException
50 * @throws TaskException
51 * @throws \SleekDB\Exceptions\IOException
52 */
53 public function execute():void {
54 parent::execute();
55
56 $this->_queue_item_reindex = $this->getQueueItem()->getItemData();
57 $this->_destination = $this->_queue_item_reindex->getDestinationId() ? new Destination($this->_queue_item_reindex->getDestinationId()) : null;
58
59 if($this->_destination && !License::isValid() && !in_array($this->_destination->getType(), Destination::LICENSE_EXCLUDED)) {
60 $this->getLogController()->logError("You can't reindex from {$this->_destination->getType()} destination without a license");
61 $this->getQueueItem()->updateStatus(Queue::STATUS_ABORTED);
62 $this->getQueueItem()->updateProgress('Reindex Aborted!', QueueItem::PROGRESS_LAST_STEP);
63 return;
64 }
65
66 if($this->getQueueItem()->getStatus() == Queue::STATUS_PENDING) {
67 if($this->_destination) $this->getLogController()->logMessage("Starting reindex for destination \"{$this->_destination->getName()}\"");
68 else $this->getLogController()->logMessage("Starting reindex for JetBackup Linux");
69
70 $this->getQueueItem()->getProgress()->setTotalItems(count(Queue::STATUS_REINDEX_NAMES)+3);
71 $this->getQueueItem()->save();
72
73 $this->getQueueItem()->updateProgress('Starting reindex');
74 } else if($this->getQueueItem()->getStatus() > Queue::STATUS_PENDING) {
75 $this->getLogController()->logMessage('Resumed Reindex');
76 }
77
78 try {
79
80 $this->func([$this, '_checkRequirements']);
81 $this->func([$this, '_markSnapshots']);
82 $this->func([$this, '_reindexSnapshots']);
83 $this->func([$this, '_deleteSnapshots']);
84
85 if($this->getQueueItem()->getStatus() < Queue::STATUS_DONE && !$this->getQueueItem()->getErrors()) $this->getQueueItem()->updateStatus(Queue::STATUS_DONE);
86 else $this->getQueueItem()->updateStatus(Queue::STATUS_PARTIALLY);
87 $this->getLogController()->logMessage('Completed!');
88 } catch(ReindexException $e) {
89 $this->getQueueItem()->updateStatus(Queue::STATUS_FAILED);
90 $this->getLogController()->logError($e->getMessage());
91 $this->getLogController()->logMessage('Failed!');
92 }
93
94 $this->getQueueItem()->updateProgress(
95 $this->getQueueItem()->getStatus() == Queue::STATUS_DONE
96 ? 'Reindex Completed!'
97 : ($this->getQueueItem()->getStatus() == Queue::STATUS_PARTIALLY
98 ? 'Completed with errors (see logs)'
99 : 'Reindex Failed!'),
100 QueueItem::PROGRESS_LAST_STEP
101 );
102
103 $this->getLogController()->logMessage('Total time: ' . $this->getExecutionTimeLimit());
104 }
105
106 public function _checkRequirements() {
107 if($this->_destination) return;
108
109 if(!Factory::getSettingsGeneral()->isJBIntegrationEnabled()) throw new ReindexException("JetBackup Linux integration isn't enabled");
110 if(!JetBackupLinux::isInstalled()) throw new ReindexException("JetBackup Linux isn't installed on this server");
111
112 try {
113 JetBackupLinux::checkRequirements();
114 } catch (JetBackupLinuxException $e) {
115 throw new ReindexException($e->getMessage());
116 }
117 }
118
119 /**
120 * @return void
121 * @throws ReindexException
122 */
123 public function _deleteSnapshots() {
124
125 $this->getLogController()->logMessage('Execution time: ' . $this->getExecutionTimeElapsed());
126 $this->getLogController()->logMessage('TTL time: ' . $this->getExecutionTimeLimit());
127
128 $this->getQueueItem()->updateStatus(Queue::STATUS_REINDEX_DELETE_SNAPSHOTS);
129 $this->getLogController()->logMessage("Removing all unneeded snapshots");
130
131 try {
132
133 // remove all snapshots with reindex flag
134 if($this->_destination) {
135 $list = Snapshot::query()
136 ->where([Snapshot::DESTINATION_ID, '=', $this->_destination->getId()])
137 ->where([Engine::ENGINE, '=', Engine::ENGINE_WP])
138 ->where([Snapshot::REINDEX, '=', true])
139 ->getQuery()
140 ->fetch();
141 } else {
142 $list = Snapshot::query()
143 ->where([Engine::ENGINE, '=', Engine::ENGINE_JB])
144 ->where([Snapshot::REINDEX, '=', true])
145 ->getQuery()
146 ->fetch();
147 }
148
149 if (empty($list)) return;
150
151 foreach ($list as $item) {
152 $snapshot = new Snapshot($item[JetBackup::ID_FIELD]);
153 if(!$snapshot->getId()) continue;
154 $snapshot->delete();
155 }
156
157 } catch( Exception $e) {
158 throw new ReindexException($e->getMessage());
159 }
160 }
161
162 /**
163 * @throws DBException
164 * @throws \SleekDB\Exceptions\IOException
165 * @throws InvalidArgumentException
166 */
167 private function _handleSGBSnapshot($filename) {
168
169 $this->getLogController()->logDebug("[_handleSnapshot] Filename: $filename");
170
171 try {
172 $stat = $this->_destination->getInstance()->getFileStat($filename);
173 $this->getLogController()->logDebug("[_handleSnapshot] getFileStat: " . print_r($stat, true));
174
175 } catch( Exception $e) {
176 $this->getLogController()->logError("[_handleSnapshot] Failed getting snapshot stats. Error: " . $e->getMessage());
177 return;
178 }
179
180 $name = substr($stat->getName(), 0, -5);
181 $created = $stat->getModifyTime() ?? 0;
182 $size = $stat->getSize() ?? 0;
183
184 $this->getLogController()->logDebug("[_handleSnapshot] Name: $name");
185 $this->getLogController()->logDebug("[_handleSnapshot] Created: $created");
186 $this->getLogController()->logDebug("[_handleSnapshot] Size: $size");
187
188 $this->getLogController()->logMessage("");
189 $this->getLogController()->logMessage("\tLegacy Snapshot found \"$name\"");
190
191
192 try {
193 $details = Snapshot::query()
194 ->where([Snapshot::NAME, '=', $name])
195 ->where([ Engine::ENGINE, '=', Engine::ENGINE_SGB])
196 ->where([Snapshot::DESTINATION_ID, '=', $this->_destination->getId()])
197 ->getQuery()
198 ->first();
199 } catch( Exception $e) {
200 $this->getLogController()->logError("[_handleSnapshot] Failed importing snapshot. Error: " . $e->getMessage());
201 return;
202 }
203
204 if($details) {
205 $snapshot = new Snapshot($details[JetBackup::ID_FIELD]);
206 $this->getLogController()->logMessage("\t[_handleSnapshot] Snapshot found on local database {$snapshot->getName()}");
207 $snapshot->setCreated($created);
208 $snapshot->setBackupType(BackupJob::TYPE_ACCOUNT);
209 $snapshot->setContains(BackupJob::BACKUP_ACCOUNT_CONTAINS_FULL);
210 $snapshot->setStructure(BackupJob::STRUCTURE_COMPRESSED);
211 $snapshot->setReindex(false);
212 $snapshot->save();
213 return;
214 }
215
216 $this->getLogController()->logMessage("\t[_handleSnapshot] Snapshot not exist on local database");
217 $snapshot = new Snapshot();
218 $snapshot->setBackupType(BackupJob::TYPE_ACCOUNT);
219 $snapshot->setContains(BackupJob::BACKUP_ACCOUNT_CONTAINS_FULL);
220 $snapshot->setStructure(BackupJob::STRUCTURE_COMPRESSED);
221 $snapshot->setDestinationId($this->_destination->getId());
222 $snapshot->setName($name);
223 $snapshot->setCreated($created);
224 $snapshot->setSize($size);
225 $snapshot->setEngine(Engine::ENGINE_SGB);
226 $snapshot->save();
227
228 $item = new SnapshotItem();
229 $item->setParentId($snapshot->getId());
230 $item->setBackupType(BackupJob::TYPE_ACCOUNT);
231 $item->setBackupContains(BackupJob::BACKUP_ACCOUNT_CONTAINS_FULL);
232 $item->setName($name);
233 $item->setCreated($created);
234 $item->setSize($size);
235 $item->setPath($filename);
236 $item->setEngine(Engine::ENGINE_SGB);
237 $item->save();
238 }
239
240 /**
241 * @param $identifier
242 * @param $name
243 *
244 * @return void
245 * @throws DBException
246 * @throws IOException
247 * @throws InvalidArgumentException
248 * @throws \SleekDB\Exceptions\IOException
249 */
250 private function _handleSnapshot($identifier, $name) {
251 $this->getLogController()->logMessage("");
252 $this->getLogController()->logMessage("\tSnapshot found \"$name\"");
253
254 $meta_filepath = sprintf(Snapshot::META_FILEPATH, JetBackup::SEP . $identifier . JetBackup::SEP . $name);
255 $this->getLogController()->logDebug("[_handleSnapshot] Identifier: $identifier");
256 $this->getLogController()->logDebug("[_handleSnapshot] Meta path: $meta_filepath");
257 try {
258 if(!$this->_destination->fileExists($meta_filepath)) throw new DestinationException("can't find meta file $meta_filepath");
259 } catch(DestinationException $e) {
260 $this->getLogController()->logError("[_handleSnapshot] Failed importing snapshot. Error: " . $e->getMessage());
261 $this->getQueueItem()->addError();
262 return;
263 }
264
265 $meta_file = Factory::getLocations()->getTempDir() . JetBackup::SEP . 'dest_reindex_' . Util::generateUniqueId() . '.tmp';
266
267 try {
268 $this->_destination->copyFileToLocal($meta_filepath, $meta_file, $this->getQueueItem(), $this);
269 } catch(IOException|DestinationException $e) {
270 $this->getLogController()->logError("[_handleSnapshot] Failed importing snapshot. Error: failed downloading meta file ({$e->getMessage()})");
271 $this->getQueueItem()->addError();
272 return;
273 }
274
275 try {
276
277 $details = Snapshot::query()
278 ->where([Snapshot::NAME, '=', $name])
279 ->where([Engine::ENGINE, '=', Engine::ENGINE_WP])
280 ->where([Snapshot::DESTINATION_ID, '=', $this->_destination->getId()])
281 ->where([Snapshot::JOB_IDENTIFIER, '=', $identifier])
282 ->getQuery()
283 ->first();
284 } catch( Exception $e) {
285 $this->getLogController()->logError("[_handleSnapshot] Failed importing snapshot. Error: " . $e->getMessage());
286 $this->getQueueItem()->addError();
287 return;
288 }
289
290 if($details) {
291 $snapshot = new Snapshot($details[JetBackup::ID_FIELD]);
292 $this->getLogController()->logMessage("\t[_handleSnapshot] Snapshot found on local database {$snapshot->getName()}");
293 $snapshot->setReindex(false);
294 try {
295 $snapshot->removeItems();
296 } catch( Exception $e) {
297 $this->getLogController()->logError("[_handleSnapshot] Failed removing snapshot items. Error: " . $e->getMessage());
298 $this->getQueueItem()->addError();
299 return;
300 }
301 } else {
302 $this->getLogController()->logMessage("\t[_handleSnapshot] Snapshot not exist on local database");
303 $snapshot = new Snapshot();
304 $snapshot->setDestinationId($this->_destination->getId());
305 $snapshot->setJobIdentifier($identifier);
306 }
307
308 try {
309 $snapshot->importMeta($meta_file, $this->_queue_item_reindex->isCrossDomain());
310 } catch(SnapshotMetaException $e) {
311 // Can't import snapshot, there is a missing data in meta file
312 $this->getLogController()->logError("Failed importing snapshot. Error: " . $e->getMessage());
313 $this->getQueueItem()->addError();
314 unlink($meta_file);
315 return;
316 }
317
318 unlink($meta_file);
319
320 $snapshot->save();
321
322 $this->getLogController()->logMessage("\tSnapshot imported successfully");
323 $this->getLogController()->logDebug("Snapshot data: " . print_r($snapshot->getDisplay(), true));
324 }
325
326 /**
327 * @param $identifier
328 *
329 * @return array
330 * @throws ReindexException
331 */
332 public function _fetchSnapshots($identifier): array {
333
334 $this->getLogController()->logDebug("[_fetchSnapshots] Identifier: /$identifier/");
335
336 try {
337 $list = $this->_destination->listDir("/$identifier/");
338 } catch(DestinationException $e) {
339 throw new ReindexException($e->getMessage());
340 }
341
342 $snapshots = [];
343
344 while($list->hasNext()) {
345 $name = $list->getNext()->getName();
346 $this->getLogController()->logDebug("[_fetchSnapshots] Name: $name");
347 if(!preg_match(Snapshot::SNAPSHOT_NAME_REGEX, $name)) continue;
348 $snapshots[] = $name;
349 }
350
351 return $snapshots;
352 }
353
354 /**
355 * @param $key
356 * @param $backup
357 *
358 * @return void
359 * @throws DBException
360 * @throws InvalidArgumentException
361 * @throws \SleekDB\Exceptions\IOException
362 * @throws Exception
363 */
364 public function _handleJBSnapshot($key, $backup) {
365 if(!$backup['items']) return;
366
367 if ($backup['backup_structure'] != JetBackupLinux::BACKUP_STRUCTURE_INCREMENTAL) {
368 $this->getLogController()->logError("[_handleJBSnapshot] Backup ID" . $backup['_id'] . " is not incremental, this type is not supported, skipping");
369 return;
370 }
371
372 try {
373 $details = Snapshot::query()
374 ->where([Engine::ENGINE, '=', Engine::ENGINE_JB])
375 ->where([Snapshot::UNIQUE_ID, '=', $backup['_id']])
376 ->getQuery()
377 ->first();
378 } catch( Exception $e) {
379 $this->getLogController()->logError("[_handleJBSnapshot] Failed importing snapshot. Error: " . $e->getMessage());
380 return;
381 }
382
383 if($details) {
384 $this->getLogController()->logMessage("\t[_handleJBSnapshot] Snapshot found on local database, skipping import");
385 $snapshot = new Snapshot($details[JetBackup::ID_FIELD]);
386 $snapshot->setReindex(false);
387 $snapshot->removeItems();
388 } else {
389 $this->getLogController()->logMessage("\t[_handleJBSnapshot] New snapshot found! Importing to local database...");
390 $snapshot = new Snapshot();
391 $snapshot->setNotes($backup['notes']);
392 }
393
394 $snapshot->setEngine(Engine::ENGINE_JB);
395 $snapshot->setBackupType(BackupJob::TYPE_ACCOUNT);
396 $snapshot->setUniqueId($backup['_id']);
397 $snapshot->setCreated(strtotime($backup['created']));
398 $snapshot->setStructure(BackupJob::STRUCTURE_INCREMENTAL);
399 $snapshot->setName(sprintf(Snapshot::SNAPSHOT_NAME_PATTERN, Util::date('Y-m-d_His', strtotime($backup['created'])), $backup['_id']));
400
401 $items = [];
402 $size = 0;
403 $contains = 0;
404
405 foreach($backup['items'] as $item_details) {
406
407 if($item_details['disabled']) {
408 $this->getLogController()->logMessage("\t[_handleJBSnapshot] Skipping item " . $item_details['_id'] . " Remote destination disabled");
409 continue;
410 }
411
412 switch($item_details['backup_contains']) {
413 case JetBackupLinux::BACKUP_TYPE_ACCOUNT_HOMEDIR:
414 $item = new SnapshotItem();
415 $item->setEngine(Engine::ENGINE_JB);
416 $item->setName($item_details['name']);
417 $item->setPath($item_details['path']);
418 $item->setUniqueId($item_details['_id']);
419 $item->setCreated(strtotime($item_details['created']));
420 $item->setBackupType(BackupJob::TYPE_ACCOUNT);
421 $item->setBackupContains(BackupJob::BACKUP_ACCOUNT_CONTAINS_HOMEDIR);
422 $size += intval($item_details['size']);
423 $items[] = $item;
424 $contains |= BackupJob::BACKUP_ACCOUNT_CONTAINS_HOMEDIR;
425 break;
426
427 case JetBackupLinux::BACKUP_TYPE_ACCOUNT_DATABASES:
428
429 if($item_details['name'] != DB_NAME) continue 2;
430
431 $item = new SnapshotItem();
432 $item->setEngine(Engine::ENGINE_JB);
433 $item->setName($item_details['name']);
434 $item->setPath($item_details['path']);
435 $item->setUniqueId($item_details['_id']);
436 $item->setCreated(strtotime($item_details['created']));
437 $item->setBackupType(BackupJob::TYPE_ACCOUNT);
438 $item->setBackupContains(BackupJob::BACKUP_ACCOUNT_CONTAINS_DATABASE);
439 $size += intval($item_details['size']);
440
441 $items[] = $item;
442 $contains |= BackupJob::BACKUP_ACCOUNT_CONTAINS_DATABASE;
443 break;
444 }
445 }
446
447 if(!$items) {
448 $snapshot->delete();
449 return;
450 }
451
452 if($contains != BackupJob::BACKUP_ACCOUNT_CONTAINS_FULL) {
453 $item = new SnapshotItem();
454 $item->setEngine(Engine::ENGINE_JB);
455 $item->setBackupType(BackupJob::TYPE_ACCOUNT);
456 $item->setBackupContains(BackupJob::BACKUP_ACCOUNT_CONTAINS_FULL);
457 $item->setCreated(strtotime($backup['created']));
458 $item->setName('');
459 $item->setPath('');
460 }
461
462 $items[] = $item;
463
464 $snapshot->setContains($contains);
465 $snapshot->setSize($size);
466 $snapshot->save();
467
468 foreach ($items as $item) {
469 $item->setParentId($snapshot->getId());
470 $item->save();
471 }
472 }
473
474
475 /**
476 * @return void
477 * @throws ReindexException
478 */
479 public function _reindexSnapshots() : void {
480
481 $this->getLogController()->logMessage('Execution time: ' . $this->getExecutionTimeElapsed());
482 $this->getLogController()->logMessage('TTL time: ' . $this->getExecutionTimeLimit());
483
484 $this->getQueueItem()->updateStatus(Queue::STATUS_REINDEX_INDEXING_SNAPSHOTS);
485 $this->getQueueItem()->updateProgress('Indexing Snapshots');
486
487 if($this->_destination) {
488
489 $this->foreachCallable([ $this, '_fetchRootDirectory' ], [], function($i, $filename) {
490 $this->getLogController()->logDebug("Inspecting $filename");
491 if(preg_match(BackupJob::IDENTIFIER_REGEX, $filename)) {
492 $this->getLogController()->logMessage("Reindexing identifier \"$filename\"");
493
494 $this->foreachCallable([ $this, '_fetchSnapshots'], [$filename], function($s, $name) use ($filename) {
495 $this->_handleSnapshot($filename, $name);
496 }, 'snapshots_' . $filename);
497 } elseif(str_ends_with($filename, BackupJob::SNAPSHOT_SGBP_SUFFIX)) {
498 $this->_handleSGBSnapshot($filename); // Anything *.sgbp
499 }
500
501
502 });
503 } else {
504
505 try {
506 $this->foreachCallable(['\JetBackup\JetBackupLinux\JetBackupLinux', 'listBackups'], [], [$this, '_handleJBSnapshot']);
507 } catch(JetBackupLinuxException $e) {
508 throw new ReindexException($e->getMessage());
509 }
510 }
511 }
512
513 /**
514 * @throws ReindexException
515 */
516 public function _markSnapshots():void {
517
518 $this->getLogController()->logMessage('Execution time: ' . $this->getExecutionTimeElapsed());
519 $this->getLogController()->logMessage('TTL time: ' . $this->getExecutionTimeLimit());
520
521 $this->getQueueItem()->updateStatus(Queue::STATUS_REINDEX_MARKING_SNAPSHOTS);
522 $this->getQueueItem()->updateProgress('Hiding all destination snapshots');
523 $this->getLogController()->logMessage("Hiding all destination snapshots");
524
525 try {
526 // mark all destination snapshots with reindex flag
527 if($this->_destination) {
528 Snapshot::query()
529 ->where([Snapshot::DESTINATION_ID, '=', $this->_destination->getId()])
530 ->where([Engine::ENGINE, '=', Engine::ENGINE_WP])
531 ->getQuery()
532 ->update([Snapshot::REINDEX => true]);
533 } else {
534 Snapshot::query()
535 ->where([Engine::ENGINE, '=', Engine::ENGINE_JB])
536 ->getQuery()
537 ->update([Snapshot::REINDEX => true]);
538 }
539 } catch( Exception $e) {
540 throw new ReindexException($e->getMessage());
541 }
542 }
543
544 /**
545 * @return array
546 * @throws ReindexException
547 */
548 public function _fetchRootDirectory():array {
549
550 $this->getLogController()->logMessage("Fetching destination root directory");
551
552 try {
553 $this->_destination->setLogController($this->getLogController());
554 $this->_destination->validate();
555 $list = $this->_destination->listDir('/');
556 } catch(ValidationException|DestinationException $e) {
557 throw new ReindexException($e->getMessage());
558 }
559
560 $output = [];
561
562 while($list->hasNext()) {
563 $output[] = $list->getNext()->getName();
564 }
565
566 if(!sizeof($output)) $this->getLogController()->logMessage("No files and directories were found on the destination root directory");
567
568 return $output;
569 }
570 }