Remove the code that cleans the log on each page request. it was moved to zm_stats.pl. Accessing the log is kinda heavy, so should be done in background tasks, not interactively
This commit is contained in:
parent
eb1d94345f
commit
ece625e376
|
@ -619,20 +619,6 @@ function getLogHTML() {
|
|||
|
||||
if ( canView('System') ) {
|
||||
if ( ZM\logToDatabase() > ZM\Logger::NOLOG ) {
|
||||
if ( ! ZM_RUN_AUDIT ) {
|
||||
# zmaudit can clean the logs, but if we aren't running it, then we should clean them regularly
|
||||
if ( preg_match('/^\d+$/', ZM_LOG_DATABASE_LIMIT) ) {
|
||||
# Number of lines, instead of an interval
|
||||
$rows = dbFetchOne('SELECT Count(*) AS `Rows` FROM `Logs`', 'Rows');
|
||||
if ( $rows > ZM_LOG_DATABASE_LIMIT ) {
|
||||
dbQuery('DELETE low_priority FROM `Logs` ORDER BY `TimeKey` ASC LIMIT ?', array($rows - ZM_LOG_DATABASE_LIMIT));
|
||||
}
|
||||
} else if ( preg_match('/^\d\s*(hour|minute|day|week|month|year)$/', ZM_LOG_DATABASE_LIMIT, $matches) ) {
|
||||
dbQuery('DELETE FROM `Logs` WHERE `TimeKey` < unix_timestamp( NOW() - interval '.ZM_LOG_DATABASE_LIMIT.') LIMIT 100');
|
||||
} else {
|
||||
ZM\Error('Potentially invalid value for ZM_LOG_DATABASE_LIMIT: ' . ZM_LOG_DATABASE_LIMIT);
|
||||
}
|
||||
}
|
||||
$logstate = logState();
|
||||
$class = ($logstate == 'ok') ? 'text-success' : ($logstate == 'alert' ? 'text-warning' : (($logstate == 'alarm' ? 'text-danger' : '')));
|
||||
$result .= '<li id="getLogHTML" class="nav-item dropdown">'.makePopupLink('?view=log', 'zmLog', 'log', '<span class="nav-link '.$class.'">'.translate('Log').'</span>').'</li>'.PHP_EOL;
|
||||
|
|
Loading…
Reference in New Issue