correctly fork export cron action with new Forkable-trait

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2023-06-06 17:45:14 +02:00
parent 94051dc9eb
commit 69c58d21be

View File

@@ -38,23 +38,22 @@ class ExportCron extends FroxlorCron
use Forkable;
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');
$result_tasks_stmt = Database::query("
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();
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'] != '') {
$row['data'] = json_decode($row['data'], true);
}
@@ -79,7 +78,6 @@ class ExportCron extends FroxlorCron
'id' => $row['id']
]);
}
}
/**
* depending on the give choice, the customers web-data, email-data and databases are being backup'ed