Merge branch 'MDL-48729_legacy_log_error' of https://github.com/andyjdavis/moodle

This commit is contained in:
Dan Poltawski 2015-01-13 10:26:21 +00:00
commit c81689fa75

View File

@ -91,15 +91,18 @@ class store implements \tool_log\log\store, \core\log\sql_select_reader {
// 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 {
// 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);
}