From 0a6f7b33c3b5e0552c041f3d529f577c0b392f40 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Mon, 2 Jul 2012 20:31:07 +0200 Subject: LDAP: make it UTF-8 save --- apps/user_ldap/appinfo/update.php | 18 ++++++++++++++++++ apps/user_ldap/appinfo/version | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'apps/user_ldap/appinfo') 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'])); + } +} diff --git a/apps/user_ldap/appinfo/version b/apps/user_ldap/appinfo/version index 2f4536184bc..5f021e960ec 100644 --- a/apps/user_ldap/appinfo/version +++ b/apps/user_ldap/appinfo/version @@ -1 +1 @@ -0.2 \ No newline at end of file +0.2.0.5 \ No newline at end of file -- cgit v1.2.3