Skip to content

Commit 5c948e5

Browse files
committed
Fix logic for RRD and DHCP leases backup, and fix wording in the placeholder text. Fixes #6040
1 parent 97f42a0 commit 5c948e5

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/usr/local/www/system_advanced_misc.php

+12-4
Original file line numberDiff line numberDiff line change
@@ -273,11 +273,19 @@
273273
$config['system']['use_mfs_var_size'] = $_POST['use_mfs_var_size'];
274274

275275
if (isset($_POST['rrdbackup'])) {
276-
$config['system']['rrdbackup'] = $_POST['rrdbackup'];
276+
if (($_POST['rrdbackup'] > 0) && ($_POST['rrdbackup'] <= 24)) {
277+
$config['system']['rrdbackup'] = intval($_POST['rrdbackup']);
278+
} else {
279+
unset($config['system']['rrdbackup']);
280+
}
277281
install_cron_job("/etc/rc.backup_rrd.sh", ($config['system']['rrdbackup'] > 0), $minute="0", "*/{$config['system']['rrdbackup']}");
278282
}
279283
if (isset($_POST['dhcpbackup'])) {
280-
$config['system']['dhcpbackup'] = $_POST['dhcpbackup'];
284+
if (($_POST['dhcpbackup'] > 0) && ($_POST['dhcpbackup'] <= 24)) {
285+
$config['system']['dhcpbackup'] = intval($_POST['dhcpbackup']);
286+
} else {
287+
unset($config['system']['dhcpbackup']);
288+
}
281289
install_cron_job("/etc/rc.backup_dhcpleases.sh", ($config['system']['dhcpbackup'] > 0), $minute="0", "*/{$config['system']['dhcpbackup']}");
282290
}
283291

@@ -543,7 +551,7 @@
543551
'Periodic RRD Backup',
544552
'number',
545553
$config['system']['rrdbackup'],
546-
['min' => 1, 'max' => 24, 'placeholder' => 'frequency between 1 and 24 hours']
554+
['min' => 0, 'max' => 24, 'placeholder' => 'Period between 1 and 24 hours']
547555
))->setHelp('This will periodically backup the RRD data so '.
548556
'it can be restored automatically on the next boot. Keep in mind that the more '.
549557
'frequent the backup, the more writes will happen to the media.');
@@ -553,7 +561,7 @@
553561
'Periodic DHCP Leases Backup',
554562
'number',
555563
$config['system']['dhcpbackup'],
556-
['min' => 1, 'max' => 24, 'placeholder' => 'frequency between 1 and 24 hours']
564+
['min' => 0, 'max' => 24, 'placeholder' => 'Period between 1 and 24 hours']
557565
))->setHelp('This will periodically backup the DHCP leases so '.
558566
'it can be restored automatically on the next boot. Keep in mind that the more '.
559567
'frequent the backup, the more writes will happen to the media.');

0 commit comments

Comments
 (0)