]> source.dussan.org Git - nextcloud-server.git/commitdiff
enhance detection of un-initialized database
authorThomas Schmidt <tschmidt@suse.de>
Fri, 30 Sep 2011 12:40:17 +0000 (14:40 +0200)
committerThomas Schmidt <tschmidt@suse.de>
Fri, 30 Sep 2011 12:40:17 +0000 (14:40 +0200)
lib/MDB2/Driver/sqlite3.php
lib/db.php

index a41aeed4850801d8a847ffdd3073bff9fed1a65a..967e3335b1338c3a5af33eaaf25a3f405d9a8e33 100644 (file)
@@ -582,6 +582,12 @@ class MDB2_Driver_sqlite3 extends MDB2_Driver_Common
         return $query;
     }
 
+    /* Dummy interface for sqlite, to stay compatible with the database abstraction */
+    function getUserInfo() {
+       return "sqlite standard user";
+    }
+
+
     // }}}
     // {{{ getServerVersion()
 
index ede8ba897e9ee321d88b859b634ab5fe160f9817..4bcb184b100f67a9a0aae044f653371443bc7fa4 100644 (file)
@@ -97,6 +97,14 @@ class OC_DB {
                                die( $error );
                        }
 
+                       self::$DBConnection->loadModule('Manager');
+                       if (count(self::$DBConnection->listTables()) == 0) {
+                               $error = 'database tables not initialized, using '.$CONFIG_DBTYPE.'. ('.self::$DBConnection->getUserInfo() . ')';
+                               if(defined("DEBUG") && DEBUG) {error_log( $error);}
+                               if(defined("DEBUG") && DEBUG) {error_log( self::$DBConnection->getUserInfo());}
+                               die( $error );
+                           }
+
                        // We always, really always want associative arrays
                        self::$DBConnection->setFetchMode(MDB2_FETCHMODE_ASSOC);