diff options
author | Simon Rettberg | 2017-11-15 15:16:51 +0100 |
---|---|---|
committer | Simon Rettberg | 2017-11-15 15:16:51 +0100 |
commit | 9f7e2c4c794495f2a32410fd373cc313e0b0d4cf (patch) | |
tree | c81fa0c81ace880a9ae0801a0a647f867f3607e0 /modules-available/syslog | |
parent | [dozmod] Improve location & exam mode detection (diff) | |
download | slx-admin-9f7e2c4c794495f2a32410fd373cc313e0b0d4cf.tar.gz slx-admin-9f7e2c4c794495f2a32410fd373cc313e0b0d4cf.tar.xz slx-admin-9f7e2c4c794495f2a32410fd373cc313e0b0d4cf.zip |
[statistics&syslog] Fix possible cron delete query overflow
Diffstat (limited to 'modules-available/syslog')
-rw-r--r-- | modules-available/syslog/hooks/cron.inc.php | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/modules-available/syslog/hooks/cron.inc.php b/modules-available/syslog/hooks/cron.inc.php index c796675f..bae882a9 100644 --- a/modules-available/syslog/hooks/cron.inc.php +++ b/modules-available/syslog/hooks/cron.inc.php @@ -1,5 +1,8 @@ <?php if (mt_rand(1, 10) === 1) { - Database::exec("DELETE FROM clientlog WHERE (UNIX_TIMESTAMP() - dateline) > 86400 * 190"); + Database::exec("DELETE FROM clientlog WHERE (UNIX_TIMESTAMP() - 86400 * 190) > dateline"); + if (mt_rand(1, 100) === 1) { + Database::exec("OPTIMIZE TABLE clientlog"); + } }
\ No newline at end of file |