Merge pull request #121 from rkojedzinszky/master

Rewrote the logState() sql query to allow mysql to use indexes
This commit is contained in:
Kyle Johnson 2013-09-14 17:43:43 -07:00
commit f0006404cc
1 changed files with 1 additions and 1 deletions

View File

@ -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 )