Merge pull request #121 from rkojedzinszky/master
Rewrote the logState() sql query to allow mysql to use indexes
This commit is contained in:
commit
f0006404cc
|
@ -2167,7 +2167,7 @@ function logState()
|
||||||
Logger::WARNING => array( ZM_LOG_ALERT_WAR_COUNT, ZM_LOG_ALARM_WAR_COUNT ),
|
Logger::WARNING => array( ZM_LOG_ALERT_WAR_COUNT, ZM_LOG_ALARM_WAR_COUNT ),
|
||||||
);
|
);
|
||||||
|
|
||||||
$sql = "select Level, count(Level) as LevelCount from Logs where Level < ".Logger::INFO." and from_unixtime(TimeKey) + interval ".ZM_LOG_CHECK_PERIOD." second > now() group by Level order by Level asc";
|
$sql = "select Level, count(Level) as LevelCount from Logs where Level < ".Logger::INFO." and TimeKey > unix_timestamp(now() - interval ".ZM_LOG_CHECK_PERIOD." second) group by Level order by Level asc";
|
||||||
$counts = dbFetchAll( $sql );
|
$counts = dbFetchAll( $sql );
|
||||||
|
|
||||||
foreach ( $counts as $count )
|
foreach ( $counts as $count )
|
||||||
|
|
Loading…
Reference in New Issue