MDL-47201 Reports: Read from multiple log stores in outline report

This commit is contained in:
Andrea Bicciolo 2014-10-29 12:44:16 +08:00 committed by John Okely
parent 32a69a7d7a
commit 087be6ca90
2 changed files with 6 additions and 3 deletions

View File

@ -110,7 +110,6 @@ if ($uselegacyreader) {
$limittime = '';
if (!empty($minloginternalreader)) {
$limittime = ' AND time < :timeto ';
$params['timeto'] = $minloginternalreader;
}
// Check if we need to show the last access.
$sqllasttime = '';
@ -129,6 +128,9 @@ if ($uselegacyreader) {
AND m.visible = :visible $limittime
GROUP BY cm.id";
$params = array('courseid' => $course->id, 'action' => 'view%', 'visible' => 1);
if (!empty($minloginternalreader)) {
$params['timeto'] = $minloginternalreader;
}
$views = $DB->get_records_sql($sql, $params);
}
@ -156,6 +158,9 @@ if ($useinternalreader) {
foreach ($v as $key => $value) {
if (isset($views[$key]) && !empty($views[$key]->numviews)) {
$views[$key]->numviews += $value->numviews;
if ($value->lasttime > $views[$key]->lasttime) {
$views[$key]->lasttime = $value->lasttime;
}
} else {
$views[$key] = $value;
}

View File

@ -85,7 +85,6 @@ function report_outline_get_common_log_variables() {
// If legacy reader is preferred reader.
if ($readerpluginname == 'logstore_legacy') {
$uselegacyreader = true;
break;
}
// If sql_internal_reader is preferred reader.
@ -93,7 +92,6 @@ function report_outline_get_common_log_variables() {
$useinternalreader = true;
$logtable = $reader->get_internal_log_table_name();
$minloginternalreader = $DB->get_field_sql('SELECT min(timecreated) FROM {' . $logtable . '}');
break;
}
}
}