Skip to content

Commit

Permalink
MDL-40613 auth: moved lang string to common auth file
Browse files Browse the repository at this point in the history
Also fixed call to get_string() and defined var 'errorlogtag'
in base class.

AMOS BEGIN
 MOV [auth_dbusernotexist,auth_db],[auth_usernotexist,auth]
AMOS END
  • Loading branch information
mdjnelson committed Dec 19, 2017
1 parent 4e133e7 commit 4afad1f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions auth/db/auth.php
Expand Up @@ -42,6 +42,7 @@ function __construct() {

$this->authtype = 'db';
$this->config = get_config('auth_db');
$this->errorlogtag = '[AUTH DB] ';
if (empty($this->config->extencoding)) {
$this->config->extencoding = 'utf-8';
}
Expand Down
1 change: 0 additions & 1 deletion auth/db/lang/en/auth_db.php
Expand Up @@ -66,7 +66,6 @@
$string['auth_dbupdatinguser'] = 'Updating user {$a->name} id {$a->id}';
$string['auth_dbuser'] = 'Username with read access to the database';
$string['auth_dbuser_key'] = 'DB user';
$string['auth_dbusernotexist'] = 'Cannot update non-existent user: {$a}';
$string['auth_dbuserstoadd'] = 'User entries to add: {$a}';
$string['auth_dbuserstoremove'] = 'User entries to remove: {$a}';
$string['pluginname'] = 'External database';
1 change: 1 addition & 0 deletions lang/en/auth.php
Expand Up @@ -64,6 +64,7 @@
$string['auth_user_create'] = 'Enable user creation';
$string['auth_user_creation'] = 'New (anonymous) users can create user accounts on the external authentication source and confirmed via email. If you enable this , remember to also configure module-specific options for user creation.';
$string['auth_usernameexists'] = 'Selected username already exists. Please choose a new one.';
$string['auth_usernotexist'] = 'Cannot update non-existent user: {$a}';
$string['auto_add_remote_users'] = 'Auto add remote users';
$string['cannotmapfield'] = 'Field "{$a->fieldname}" can not be mapped because its short name "{$a->shortname}" is too long. To enable mapping reduce the profile field short name down to {$a->charlimit} characters. <a href="{$a->link}">Edit user profile fields</a>';
$string['createpassword'] = 'Generate password and notify user';
Expand Down
11 changes: 9 additions & 2 deletions lib/authlib.php
Expand Up @@ -110,6 +110,13 @@ class auth_plugin_base {
*/
var $customfields = null;

/**
* The tag we want to prepend to any error log messages.
*
* @var string
*/
protected $errorlogtag = '';

/**
* This is the primary method that is used by the authenticate_user_login()
* function in moodlelib.php.
Expand Down Expand Up @@ -641,8 +648,8 @@ protected function update_user_record($username, $updatekeys = false, $triggerev
// Get the current user record.
$user = $DB->get_record('user', array('username' => $username, 'mnethostid' => $CFG->mnet_localhost_id));
if (empty($user)) { // Trouble.
error_log($this->errorlogtag.get_string('auth_dbusernotexist', 'auth_db', '', $username));
print_error('auth_dbusernotexist', 'auth_db', '', $username);
error_log($this->errorlogtag . get_string('auth_usernotexist', 'auth', $username));
print_error('auth_usernotexist', 'auth', '', $username);
die;
}

Expand Down

0 comments on commit 4afad1f

Please sign in to comment.