mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-65847 auth_db: user_update() handle errors
The external database authentication plugin (auth_db) can update the external database if mapped fields are set to Update external: On update. This change adds error handling in case this update fails.
This commit is contained in:
parent
07238ca511
commit
5049102eb6
@ -603,9 +603,12 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
}
|
||||
}
|
||||
if (!empty($update)) {
|
||||
$authdb->Execute("UPDATE {$this->config->table}
|
||||
SET ".implode(',', $update)."
|
||||
WHERE {$this->config->fielduser}='".$this->ext_addslashes($extusername)."'");
|
||||
$sql = "UPDATE {$this->config->table}
|
||||
SET ".implode(',', $update)."
|
||||
WHERE {$this->config->fielduser} = ?";
|
||||
if (!$authdb->Execute($sql, array($this->ext_addslashes($extusername)))) {
|
||||
print_error('auth_dbupdateerror', 'auth_db');
|
||||
}
|
||||
}
|
||||
$authdb->Close();
|
||||
return true;
|
||||
|
@ -74,5 +74,6 @@ $string['auth_dbcannotconnect'] = 'Cannot connect to external database.';
|
||||
$string['auth_dbcannotreadtable'] = 'Cannot read external table.';
|
||||
$string['auth_dbtableempty'] = 'External table is empty.';
|
||||
$string['auth_dbcolumnlist'] = 'External table contains the following columns:<br />{$a}';
|
||||
$string['auth_dbupdateerror'] = 'Error updating external database.';
|
||||
$string['pluginname'] = 'External database';
|
||||
$string['privacy:metadata'] = 'The External database authentication plugin does not store any personal data.';
|
||||
|
Loading…
x
Reference in New Issue
Block a user