Added dbclean

This commit is contained in:
Jeroen De Meerleer 2018-09-13 12:49:28 +02:00
parent e14a5fbcd7
commit db72533233
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6
2 changed files with 11 additions and 0 deletions

View File

@ -87,4 +87,13 @@ function parse_config_type($type) {
break; break;
} }
return $r_var; return $r_var;
}
function clean_database() {
global $db;
$oldestrun = time() - (60 * 60 * 24 * get_configvalue('dbclean.expireruns'));
$stmt = $db->prepare("DELETE FROM runs WHERE timestamp < ?");
$stmt->execute(array($oldestrun));
} }

View File

@ -105,6 +105,8 @@ foreach ($results as $result) {
$nosave = false; $nosave = false;
} }
clean_database();
unlink('/tmp/webcron.lock'); unlink('/tmp/webcron.lock');
if(file_exists("cache/reboot.trigger")) { if(file_exists("cache/reboot.trigger")) {