Skip to content

Commit

Permalink
return any errors during update_cron execution
Browse files Browse the repository at this point in the history
  • Loading branch information
Commifreak committed Sep 27, 2023
1 parent 4e6d310 commit 87a78af
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/include/ABSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,9 @@ public function checkCron() {
unlink(ABSettings::$pluginDir . '/' . ABSettings::$cronFile);
}
// Let dcron know our changes via update_cron
exec("update_cron");
$out = $code = 0;
exec("update_cron", $out, $code);
return [$code, $out];
}

}
Expand Down
6 changes: 5 additions & 1 deletion src/pages/content/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
$abSettings = new ABSettings();

if ($_POST) {
$abSettings->checkCron();
list($code, $out) = $abSettings->checkCron();
}


Expand Down Expand Up @@ -209,6 +209,10 @@
HTML;

}

if ($code != 0) {
echo "<h1>Cron error!</h1><p>" . implode('; ', $out) . "</p>";
}
?>

<form id="abSettingsForm" method="post">
Expand Down
10 changes: 8 additions & 2 deletions src/scripts/checkCron.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@
echo "Checking cron." . PHP_EOL;

$abSettings = new ABSettings();
$abSettings->checkCron();
list($code, $out) = $abSettings->checkCron();

if ($code == 0) {
echo "Checking cron succeeded!" . PHP_EOL;
} else {
echo "Error occurred: " . implode('; ', $out);
}


echo "Checking cron succeeded!" . PHP_EOL;

exit(0);

0 comments on commit 87a78af

Please sign in to comment.