Added option to disable dbclean

This commit is contained in:
Jeroen De Meerleer 2018-09-14 16:31:56 +02:00
parent 848115b9d9
commit 84c0efdec7
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6
2 changed files with 3 additions and 2 deletions

View File

@ -37,7 +37,8 @@ CREATE TABLE IF NOT EXISTS `config` (
INSERT INTO `config` (`conf`, `category`, `type`, `label`, `description`, `value`) VALUES
('dbclean.delay', 'Database Cleanup', 'number(0)', 'Cleanup Delay', 'How many days until the database cleanup is triggered', '7'),
('dbclean.expireruns', 'Database Cleanup', 'number(0)', 'Retention value', 'How many days does the database keep the runs', '30'),
('dbclean.expireruns', 'Database Cleanup', 'number(0)', 'Retention', 'How many days does the database keep the runs', '30'),
('dbclean.enabled', 'Database Cleanup', 'text', 'Enabled', 'Database cleanup enabled? (true: yes; false: no)', 'true'),
('dbclean.lastrun', 'Database Cleanup', 'hidden', 'Last run', 'Last run of database cleanup', UNIX_TIMESTAMP()),
('jobs.reboottime', 'Jobs', 'number(0,30)', 'Reboot delay', 'The amount of delay in minutes between scheduling a reboot and the actual reboot', '5');

View File

@ -105,7 +105,7 @@ foreach ($results as $result) {
$nosave = false;
}
if (get_configvalue('dbclean.lastrun') + (60 * 60 * 24 * get_configvalue('dbclean.delay')) < time()) clean_database();
if ((get_configvalue('dbclean.enabled') == 'true') && (get_configvalue('dbclean.lastrun') + (60 * 60 * 24 * get_configvalue('dbclean.delay')) < time())) clean_database();
unlink('/tmp/webcron.lock');