correctly fork export cron action with new Forkable-trait
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -38,23 +38,22 @@ class ExportCron extends FroxlorCron
|
|||||||
use Forkable;
|
use Forkable;
|
||||||
|
|
||||||
public static function run()
|
public static function run()
|
||||||
{
|
|
||||||
self::runFork([self::class, 'handle']);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function handle()
|
|
||||||
{
|
{
|
||||||
FroxlorLogger::getInstanceOf()->logAction(FroxlorLogger::CRON_ACTION, LOG_INFO, 'BackupCron: started - creating customer backup');
|
FroxlorLogger::getInstanceOf()->logAction(FroxlorLogger::CRON_ACTION, LOG_INFO, 'BackupCron: started - creating customer backup');
|
||||||
|
|
||||||
$result_tasks_stmt = Database::query("
|
$result_tasks_stmt = Database::query("
|
||||||
SELECT * FROM `" . TABLE_PANEL_TASKS . "` WHERE `type` = '20' ORDER BY `id` ASC
|
SELECT * FROM `" . TABLE_PANEL_TASKS . "` WHERE `type` = '20' ORDER BY `id` ASC
|
||||||
");
|
");
|
||||||
|
|
||||||
$del_stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_TASKS . "` WHERE `id` = :id");
|
|
||||||
|
|
||||||
$cronlog = FroxlorLogger::getInstanceOf();
|
|
||||||
$all_jobs = $result_tasks_stmt->fetchAll();
|
$all_jobs = $result_tasks_stmt->fetchAll();
|
||||||
foreach ($all_jobs as $row) {
|
|
||||||
|
self::runFork([self::class, 'handle'], $all_jobs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function handle(array $row)
|
||||||
|
{
|
||||||
|
$del_stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_TASKS . "` WHERE `id` = :id");
|
||||||
|
$cronlog = FroxlorLogger::getInstanceOf();
|
||||||
|
|
||||||
if ($row['data'] != '') {
|
if ($row['data'] != '') {
|
||||||
$row['data'] = json_decode($row['data'], true);
|
$row['data'] = json_decode($row['data'], true);
|
||||||
}
|
}
|
||||||
@@ -79,7 +78,6 @@ class ExportCron extends FroxlorCron
|
|||||||
'id' => $row['id']
|
'id' => $row['id']
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* depending on the give choice, the customers web-data, email-data and databases are being backup'ed
|
* depending on the give choice, the customers web-data, email-data and databases are being backup'ed
|
||||||
|
|||||||
Reference in New Issue
Block a user