From c4917a7e6e9b7832d80a291f6bcc58b66a1834ee Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Thu, 18 Mar 2010 22:45:30 +1300 Subject: [PATCH] A more readable fix that might even be faster... --- inc/drivers_ldap.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/inc/drivers_ldap.php b/inc/drivers_ldap.php index efe98a8b..473d6cb7 100644 --- a/inc/drivers_ldap.php +++ b/inc/drivers_ldap.php @@ -379,17 +379,14 @@ function sync_LDAP(){ // deactivating all users $params = array(); - $usr_in = ''; $i = 0; foreach( $users_to_deactivate AS $v ) { if ( isset($c->do_not_sync_from_ldap) && isset($c->do_not_sync_from_ldap[$v]) ) continue; - $usr_in .= ($usr_in == '' ? '' : ', ') . ':u'.$i; - $params[':u'.$i] = strtolower($v); - $i++; + $params[':u'.$i++] = strtolower($v); } if ( $usr_in != '' ) { $c->messages[] = sprintf(i18n('- deactivating users : %s'),join(', ',$users_to_deactivate)); - $qry = new AwlQuery( 'UPDATE usr SET active = FALSE WHERE lower(username) IN ($usr_in)', $params); + $qry = new AwlQuery( 'UPDATE usr SET active = FALSE WHERE lower(username) IN ('.implode(',',array_keys($params)).')', $params); $qry->Exec('sync_LDAP',__LINE__,__FILE__); }