OpenXE/cronjobs/backup.php

22 lines
625 B
PHP
Raw Normal View History

2021-05-21 08:49:41 +02:00
<?php
use Xentral\Components\Backup\Logger\BackupLog;
use Xentral\Modules\Backup\Scheduler\BackupScheduleTask;
use Xentral\Modules\Backup\Scheduler\Adapter\SchedulerAdapter;
$backupTask = $app->Container->get('BackupScheduleTask');
/** @var BackupScheduleTask $adapter */
$adapter = new SchedulerAdapter($backupTask);
try {
//$adapter->debugMode = true;
$adapter->execute();
$adapter->cleanup();
} catch (Throwable $exception) {
/** @var BackupLog $logger */
$logger = $app->Container->get('BackupLog');
$logger->write('ERROR');
$adapter->cleanup();
throw new RuntimeException($exception->getMessage());
}