summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/appinfo/update.php
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2012-07-02 20:31:07 +0200
committerArthur Schiwon <blizzz@owncloud.com>2012-07-02 20:31:19 +0200
commit0a6f7b33c3b5e0552c041f3d529f577c0b392f40 (patch)
tree1f53d596245b37ef0d5b01586cf2aacce438a085 /apps/user_ldap/appinfo/update.php
parent52822652bce0466895a6ee139d625439fddc240b (diff)
downloadnextcloud-server-0a6f7b33c3b5e0552c041f3d529f577c0b392f40.tar.gz
nextcloud-server-0a6f7b33c3b5e0552c041f3d529f577c0b392f40.zip
LDAP: make it UTF-8 save
Diffstat (limited to 'apps/user_ldap/appinfo/update.php')
-rw-r--r--apps/user_ldap/appinfo/update.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/apps/user_ldap/appinfo/update.php b/apps/user_ldap/appinfo/update.php
index dc437ce21ce..badceb378d1 100644
--- a/apps/user_ldap/appinfo/update.php
+++ b/apps/user_ldap/appinfo/update.php
@@ -31,3 +31,21 @@ if($state == 'doCheck'){
OCP\Config::setSystemValue('ldapIgnoreNamingRules', true);
}
}
+
+
+//from version 0.2 to 0.2.1
+$objects = array('user', 'group');
+
+foreach($objects as $object) {
+ $fetchDNSql = 'SELECT ldap_dn from *PREFIX*ldap_'.$object.'_mapping';
+ $updateSql = 'UPDATE *PREFIX*ldap_'.$object.'_mapping SET ldap_DN = ? WHERE ldap_dn = ?';
+
+ $query = OCP\DB::prepare($fetchDNSql);
+ $res = $query->execute();
+ $DNs = $res->fetchAll();
+ $updateQuery = OCP\DB::prepare($updateSql);
+ foreach($DNs as $dn) {
+ $newDN = mb_strtolower($dn['ldap_dn'], 'UTF-8');
+ $updateQuery->execute(array($newDN, $dn['ldap_dn']));
+ }
+}