Skip to content

Commit db4158a

Browse files
author
Marius Burkard
committed
- Table sys_log clean-up not deleting entries with server_id 0, fixes #5450
1 parent 126290c commit db4158a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

server/lib/classes/cron.d/200-logfiles.inc.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,18 @@ public function onRunJob() {
240240
*/
241241
$sql = "DELETE FROM sys_log WHERE tstamp < ? AND server_id != 0";
242242
$app->dbmaster->query($sql, $tstamp);
243+
244+
/*
245+
* now delete those entries without a linked datalog entry (datalog_id = 0)
246+
*/
247+
$sql = "DELETE FROM sys_log WHERE tstamp < ? AND server_id = 0 AND datalog_id = 0";
248+
$app->dbmaster->query($sql, $tstamp);
249+
250+
/*
251+
* now delete those entries with a linked datalog entry (datalog_id != 0) only if older than 30 days
252+
*/
253+
$sql = "DELETE FROM sys_log WHERE tstamp < ? AND server_id = 0 AND datalog_id != 0";
254+
$app->dbmaster->query($sql, $tstamp - (3600 * 24 * 23));
243255

244256
/*
245257
* Delete all remote-actions "done" and older than 7 days

0 commit comments

Comments
 (0)