Skip to content

Commit

Permalink
Also delete the progress file from the cron check function
Browse files Browse the repository at this point in the history
  • Loading branch information
austinwbest committed Sep 18, 2024
1 parent ba900b4 commit de50e1f
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions root/app/www/public/functions/crons.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

function canCronRun($cron, $settingsTable)
{
global $database;

switch ($cron) {
case 'health':
$log = CRON_HEALTH_LOG;
Expand Down Expand Up @@ -41,11 +43,18 @@ function canCronRun($cron, $settingsTable)
}

if (IS_MIGRATION_RUNNING) {
logger($log, 'Cron cancelled: migrations are running');
logger($log, 'run <-');
echo date('c') . ' Cron: ' . $cron . ' cancelled, migrations are running' . "\n";
echo date('c') . ' Cron: ' . $cron . ' <-' . "\n";
return false;
$highestMigration = $database->getNewestMigration();
$currentMigration = $settingsTable['migration'];

if ($highestMigration == $currentMigration) {
deleteFile(MIGRATION_FILE);
} else {
logger($log, 'Cron cancelled: migrations are running');
logger($log, 'run <-');
echo date('c') . ' Cron: ' . $cron . ' cancelled, migrations are running' . "\n";
echo date('c') . ' Cron: ' . $cron . ' <-' . "\n";
return false;
}
}

if ($settingsTable[$field]) {
Expand Down

0 comments on commit de50e1f

Please sign in to comment.