Skip to content

Commit

Permalink
Merge branch 'MDL-48702_backport_log_27' of https://github.com/andyjd…
Browse files Browse the repository at this point in the history
…avis/moodle into MOODLE_27_STABLE
  • Loading branch information
danpoltawski committed Apr 13, 2015
2 parents ab3ac68 + 9f1149e commit 81c0cd9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 7 additions & 2 deletions admin/tool/log/store/legacy/classes/log/store.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,24 @@ public function get_events_select($selectwhere, array $params, $sort, $limitfrom
// Replace the query with hardcoded mappings required for core.
list($selectwhere, $params, $sort) = self::replace_sql_legacy($selectwhere, $params, $sort);

$events = array();
$records = array();

try {
$records = $DB->get_records_select('log', $selectwhere, $params, $sort, '*', $limitfrom, $limitnum);
// A custom report + on the fly SQL rewriting = a possible exception.
$records = $DB->get_recordset_select('log', $selectwhere, $params, $sort, '*', $limitfrom, $limitnum);
} catch (\moodle_exception $ex) {
debugging("error converting legacy event data " . $ex->getMessage() . $ex->debuginfo, DEBUG_DEVELOPER);
return array();
}

$events = array();

foreach ($records as $data) {
$events[$data->id] = \logstore_legacy\event\legacy_logged::restore_legacy($data);
}

$records->close();

return $events;
}

Expand Down
4 changes: 3 additions & 1 deletion admin/tool/log/store/standard/classes/log/store.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function get_events_select($selectwhere, array $params, $sort, $limitfrom
$sort = self::tweak_sort_by_id($sort);

$events = array();
$records = $DB->get_records_select('logstore_standard_log', $selectwhere, $params, $sort, '*', $limitfrom, $limitnum);
$records = $DB->get_recordset_select('logstore_standard_log', $selectwhere, $params, $sort, '*', $limitfrom, $limitnum);

foreach ($records as $data) {
$extra = array('origin' => $data->origin, 'ip' => $data->ip, 'realuserid' => $data->realuserid);
Expand All @@ -94,6 +94,8 @@ public function get_events_select($selectwhere, array $params, $sort, $limitfrom
}
}

$records->close();

return $events;
}

Expand Down

0 comments on commit 81c0cd9

Please sign in to comment.