]> source.dussan.org Git - nextcloud-server.git/commitdiff
LDAP: sqlite compatibility
authorArthur Schiwon <blizzz@owncloud.com>
Tue, 8 May 2012 11:56:07 +0000 (13:56 +0200)
committerArthur Schiwon <blizzz@owncloud.com>
Tue, 8 May 2012 11:56:07 +0000 (13:56 +0200)
apps/user_ldap/lib_ldap.php

index 31a39327ddf7fe4a86d4cd873308718ac5c4d96c..505181ff8821ba0a1dcd6f1dabcbd7822cc0f75b 100755 (executable)
@@ -360,8 +360,14 @@ class OC_LDAP {
        static private function mapComponent($dn, $ocname, $isUser = true) {
                $table = self::getMapTable($isUser);
 
+               $sqliteAdjustment = '';
+               $dbtype = OCP\Config::getSystemValue('dbtype');
+               if(($dbtype == 'sqlite') || ($dbtype == 'sqlite3')) {
+                       $sqliteAdjustment = 'OR';
+               }
+
                $insert = OCP\DB::prepare('
-                       INSERT IGNORE INTO '.$table.'
+                       INSERT '.$sqliteAdjustment.' IGNORE INTO '.$table.'
                        (ldap_dn, owncloud_name)
                        VALUES (?,?)
                ');
@@ -453,7 +459,6 @@ class OC_LDAP {
                if(!is_null($attr) && !is_array($attr)) {
                        $attr = array(strtolower($attr));
                }
-
                $sr = @ldap_search(self::getConnectionResource(), $base, $filter, $attr);
                $findings = @ldap_get_entries(self::getConnectionResource(), $sr );
                // if we're here, probably no connection ressource is returned.