mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-47201 Reports: Read from multiple log stores in outline report
This commit is contained in:
parent
32a69a7d7a
commit
087be6ca90
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user