statistics MDL-25822 multiple values in get_field_sql

A variety of get_field_sql calls returning multiple values, switched
to using MIN/MAX selects.
This commit is contained in:
Dan Poltawski
2010-12-30 10:30:07 +00:00
parent c63ebd4311
commit 5b903967de
3 changed files with 12 additions and 12 deletions
+2 -2
View File
@@ -854,13 +854,13 @@ function stats_get_start_from($str) {
global $CFG, $DB;
// are there any data in stats table? Should not be...
if ($timeend = $DB->get_field_sql('SELECT timeend FROM {stats_'.$str.'} ORDER BY timeend DESC')) {
if ($timeend = $DB->get_field_sql('SELECT MAX(timeend) FROM {stats_'.$str.'}')) {
return $timeend;
}
// decide what to do based on our config setting (either all or none or a timestamp)
switch ($CFG->statsfirstrun) {
case 'all':
if ($firstlog = $DB->get_field_sql('SELECT time FROM {log} ORDER BY time ASC')) {
if ($firstlog = $DB->get_field_sql('SELECT MIN(time) FROM {log}')) {
return $firstlog;
}
default: