MDL-63785 core_portfolio: performance improvement

This commit is contained in:
Shamim Rezaie 2018-10-26 22:59:17 +11:00
parent cb624f41d8
commit 28dfbe77bf

View File

@ -113,27 +113,16 @@ class provider implements
return;
}
$params = [
'contextid' => $context->id,
'contextuser' => CONTEXT_USER,
];
$sql = "SELECT ctx.instanceid as userid
FROM {portfolio_instance_user} piu
JOIN {context} ctx
ON ctx.instanceid = piu.userid
AND ctx.contextlevel = :contextuser
WHERE ctx.id = :contextid";
$params = [$context->instanceid];
$sql = "SELECT userid
FROM {portfolio_instance_user}
WHERE userid = ?";
$userlist->add_from_sql('userid', $sql, $params);
$sql = "SELECT ctx.instanceid as userid
FROM {portfolio_log} pl
JOIN {context} ctx
ON ctx.instanceid = pl.userid
AND ctx.contextlevel = :contextuser
WHERE ctx.id = :contextid";
$sql = "SELECT userid
FROM {portfolio_log}
WHERE userid = ?";
$userlist->add_from_sql('userid', $sql, $params);
}