aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/appinfo
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2012-05-18 17:38:22 +0200
committerArthur Schiwon <blizzz@owncloud.com>2012-05-18 18:00:30 +0200
commitbae954a7972c84cfd71ced68173bde0e3b36a2eb (patch)
tree22cf05963f6a351a97d82e68495ffb6d67bd08db /apps/user_ldap/appinfo
parent792233805044ad21f91450a59cb0e32c6806acd5 (diff)
downloadnextcloud-server-bae954a7972c84cfd71ced68173bde0e3b36a2eb.tar.gz
nextcloud-server-bae954a7972c84cfd71ced68173bde0e3b36a2eb.zip
LDAP: only check once for name conflicts on update. Set a value on install as well
Diffstat (limited to 'apps/user_ldap/appinfo')
-rw-r--r--apps/user_ldap/appinfo/install.php6
-rw-r--r--apps/user_ldap/appinfo/update.php33
2 files changed, 24 insertions, 15 deletions
diff --git a/apps/user_ldap/appinfo/install.php b/apps/user_ldap/appinfo/install.php
new file mode 100644
index 00000000000..9efc3bb24d2
--- /dev/null
+++ b/apps/user_ldap/appinfo/install.php
@@ -0,0 +1,6 @@
+<?php
+
+$state = OCP\Config::getSystemValue('ldapIgnoreNamingRules', 'doSet');
+if($state == 'doSet'){
+ OCP\Config::setSystemValue('ldapIgnoreNamingRules', false);
+}
diff --git a/apps/user_ldap/appinfo/update.php b/apps/user_ldap/appinfo/update.php
index 048d804217b..b3f7a397db9 100644
--- a/apps/user_ldap/appinfo/update.php
+++ b/apps/user_ldap/appinfo/update.php
@@ -12,22 +12,25 @@ if(!is_null($pw)) {
//detect if we can switch on naming guidelines. We won't do it on conflicts.
//it's a bit spaghetti, but hey.
-$sqlCleanMap = 'DELETE FROM *PREFIX*ldap_user_mapping';
+$state = OCP\Config::getSystemValue('ldapIgnoreNamingRules', 'doCheck');
+if($state == 'doCheck'){
+ $sqlCleanMap = 'DELETE FROM *PREFIX*ldap_user_mapping';
-require_once(OC::$APPSROOT.'/apps/user_ldap/lib_ldap.php');
-require_once(OC::$APPSROOT.'/apps/user_ldap/user_ldap.php');
+ require_once(OC::$APPSROOT.'/apps/user_ldap/lib_ldap.php');
+ require_once(OC::$APPSROOT.'/apps/user_ldap/user_ldap.php');
-OCP\Config::setSystemValue('ldapIgnoreNamingRules', true);
-$LDAP_USER = new OC_USER_LDAP();
-$users_old = $LDAP_USER->getUsers();
-$query = OCP\DB::prepare($sqlCleanMap);
-$query->execute();
-OCP\Config::setSystemValue('ldapIgnoreNamingRules', false);
-OC_LDAP::init(true);
-$users_new = $LDAP_USER->getUsers();
-$query = OCP\DB::prepare($sqlCleanMap);
-$query->execute();
-if($users_old !== $users_new) {
- //we don't need to check Groups, because they were not supported in 3'
OCP\Config::setSystemValue('ldapIgnoreNamingRules', true);
+ $LDAP_USER = new OC_USER_LDAP();
+ $users_old = $LDAP_USER->getUsers();
+ $query = OCP\DB::prepare($sqlCleanMap);
+ $query->execute();
+ OCP\Config::setSystemValue('ldapIgnoreNamingRules', false);
+ OC_LDAP::init(true);
+ $users_new = $LDAP_USER->getUsers();
+ $query = OCP\DB::prepare($sqlCleanMap);
+ $query->execute();
+ if($users_old !== $users_new) {
+ //we don't need to check Groups, because they were not supported in 3'
+ OCP\Config::setSystemValue('ldapIgnoreNamingRules', true);
+ }
} \ No newline at end of file