Hi!
Found in version 4.1
We can't open report_logs in the context of course modules.
When I started to figure it out, I discovered that the search is not by indexes.
And since we have 200 million logs, it is unlikely that the DB will be able to handle this request.
Since bug fix support for 4.1 ended, I looked at the code for 4.3 and 4.4. So I posted tags for those versions.
Class: report_log_table_log
Method: get_cm_sql()
What's happening now:
public function get_cm_sql() { |
$joins = array(); |
$params = array(); |
|
$joins[] = "contextinstanceid = :contextinstanceid"; |
$joins[] = "contextlevel = :contextmodule"; |
$params['contextinstanceid'] = $this->filterparams->modid; |
$params['contextmodule'] = CONTEXT_MODULE; |
|
$sql = implode(' AND ', $joins); |
return array($sql, $params); |
}
|
I suggest:
public function get_cm_sql() { |
$joins = array(); |
$params = array(); |
|
$joins[] = "contextinstanceid = :contextinstanceid"; |
$joins[] = "contextlevel = :contextmodule"; |
$params['contextinstanceid'] = $this->filterparams->modid; |
$params['contextmodule'] = CONTEXT_MODULE; |
|
$context = \context_module::instance($this->filterparams->modid); |
$joins[] = "contextid = :contextid"; |
$params['contextid'] = $context->id; |
|
$sql = implode(' AND ', $joins); |
return array($sql, $params); |
}
|