Toggle the script in the orchestrator you clicked, not the first one that lists it
docker_update.sh runs bare in daily, --weekly in weekly and --remainder in monthly, so switching it off in monthly disabled the daily run and reported success.
This commit is contained in:
@@ -76,11 +76,24 @@ if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
||||
|
||||
$id = trim($_POST['id'] ?? '');
|
||||
$enabled = ($_POST['enabled'] ?? '0') === '1';
|
||||
// Which orchestrator's list this click came from. Optional for callers that have only one, but
|
||||
// the scheduler always sends it: without it the toggle acts on whichever array declares the
|
||||
// script first, which for a script listed in three is right by luck at best.
|
||||
$array = trim($_POST['array'] ?? '');
|
||||
|
||||
if (!$id || !preg_match('/^[a-zA-Z0-9_.\/\-]+\.sh$/', $id) || str_contains($id, '..')) {
|
||||
echo json_encode(['ok' => false, 'error' => 'Invalid id']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$ok = vv_conf_toggle_script($id, $enabled);
|
||||
// Shaped like the arrays it may name and nothing else. It is compared against array names read
|
||||
// out of master.conf rather than used to build a pattern, but a value that cannot be an array
|
||||
// name has no legitimate target and is refused rather than quietly ignored — silently falling
|
||||
// back to first-match is how this went wrong in the first place.
|
||||
if ($array !== '' && !preg_match('/^[A-Z][A-Z0-9_]*_SCRIPTS$/', $array)) {
|
||||
echo json_encode(['ok' => false, 'error' => 'Invalid array']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$ok = vv_conf_toggle_script($id, $enabled, $array !== '' ? $array : null);
|
||||
echo json_encode(['ok' => $ok, 'error' => $ok ? null : 'Failed to write master.conf']);
|
||||
|
||||
Reference in New Issue
Block a user