Commit 9f12e7f7 authored by Franco Fichtner's avatar Franco Fichtner

cron: flush all, PHP can be tricky #911

parent ed8c5a4f
...@@ -2366,26 +2366,28 @@ function configure_cron() ...@@ -2366,26 +2366,28 @@ function configure_cron()
* This can be safely removed on our final road to 17.1. * This can be safely removed on our final road to 17.1.
*/ */
if (isset($config['cron']['item'])) { if (isset($config['cron']['item'])) {
foreach ($obsoletes as $obsolete) { $flush = false;
$is_installed = false; $index = 0;
$x = 0;
foreach($config['cron']['item'] as $item) { /* PHP retains the index, can iterate all and unset */
if (strstr($item['command'], $obsolete)) { foreach ($config['cron']['item'] as $item) {
$is_installed = true; foreach ($obsoletes as $obsolete) {
break; if ($item['command'] === $obsolete) {
} unset($config['cron']['item'][$index]);
$x++; $flush = true;
} }
if ($is_installed == true) {
unset($config['cron']['item'][$x]);
} }
$index++;
} }
if (!count($config['cron']['item'])) { if (!count($config['cron']['item'])) {
unset($config['cron']); unset($config['cron']);
$flush = true;
}
if ($flush) {
write_config(gettext('Removed obsolete cron jobs'));
} }
write_config(gettext('Removed obsolete cron job'));
} }
$autocron = array(); $autocron = array();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment