summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xcontrib/syncLDAP.pl15
1 files changed, 4 insertions, 11 deletions
diff --git a/contrib/syncLDAP.pl b/contrib/syncLDAP.pl
index ec0839ed5..6ad96477b 100755
--- a/contrib/syncLDAP.pl
+++ b/contrib/syncLDAP.pl
@@ -240,22 +240,15 @@ if($readonly == 0) {
print "Phase 2: updating existing users... " unless $quiet;
- my $sth_update_login = $dbh->prepare(
- 'UPDATE profiles
- SET login_name = ?
- WHERE ' . $dbh->sql_istrcmp('login_name', '?'));
- my $sth_update_realname = $dbh->prepare(
- 'UPDATE profiles
- SET realname = ?
- WHERE ' . $dbh->sql_istrcmp('login_name', '?'));
-
if($noupdate == 0) {
while( my ($key, $value) = each(%update_users) ) {
+ my $user = Bugzilla::User->check($key);
if(defined $value->{'new_login_name'}) {
- $sth_update_login->execute($value->{'new_login_name'}, $key);
+ $user->set_login($value->{'new_login_name'});
} else {
- $sth_update_realname->execute($value->{'realname'}, $key);
+ $user->set_name($value->{'realname'});
}
+ $user->update();
}
print "done!\n" unless $quiet;
}