Commit b1ee27e0 authored by Aaron Wells's avatar Aaron Wells Committed by Yuliya Bozhko

Adjust auth_get_auth_instances_for_wwwroot() to handle the new institution.id column

Bug 1323911: Now that the auth_instance table and the institution table both have a
column called "id", the SQL query is ambiguous about which one it will return.
Cutting the query down so that it only returns the fields actually used in the code
resolves this ambiguity.

Change-Id: I5242aa7bdee38af9aa0a7da308bb0d30dc700621
Signed-off-by: default avatarYuliya Bozhko <yuliya.bozhko@totaralms.com>
parent 4c6b29de
......@@ -666,22 +666,21 @@ function auth_get_auth_instances_for_institution($institution=null) {
* @return array array of record objects
*/
function auth_get_auth_instances_for_wwwroot($wwwroot) {
// TODO: we just need ai.id and ai.authname... rewrite query, or
// just drop this function
$query = " SELECT
ai.*,
aic.*,
i.*
ai.id,
ai.authname,
i.id as institutionid,
i.displayname,
i.suspended
FROM
{auth_instance} ai,
{auth_instance_config} aic,
{institution} i
{auth_instance} ai
INNER JOIN {institution} i
ON ai.institution = i.name
INNER JOIN {auth_instance_config} aic
ON aic.field = 'wwwroot'
AND aic.instance = ai.id
WHERE
aic.field = 'wwwroot' AND
aic.value = ? AND
aic.instance = ai.id AND
i.name = ai.institution";
aic.value = ?";
return get_records_sql_array($query, array('value' => $wwwroot));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment