]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix review items
authorBart Visscher <bartv@thisnet.nl>
Thu, 27 Jun 2013 18:19:51 +0000 (20:19 +0200)
committerBart Visscher <bartv@thisnet.nl>
Sat, 29 Jun 2013 19:15:06 +0000 (21:15 +0200)
lib/setup.php
lib/setup/abstractdatabase.php
lib/setup/mssql.php
lib/setup/mysql.php
lib/setup/oci.php
lib/setup/postgresql.php
lib/setup/sqlite.php

index 11c6cc76b66bfdc4bf7ac15c0f72fdc6c202f35f..d8f4cbfbcbd982f19624710e5cbaf503cec2ea98 100644 (file)
@@ -19,7 +19,7 @@ class DatabaseSetupException extends Exception
 }
 
 class OC_Setup {
-       static $db_setup_classes = array(
+       static $dbSetupClasses = array(
                'mysql' => '\OC\Setup\MySQL',
                'pgsql' => '\OC\Setup\PostgreSQL',
                'oci'   => '\OC\Setup\OCI',
@@ -48,13 +48,13 @@ class OC_Setup {
                        $options['directory'] = OC::$SERVERROOT."/data";
                }
 
-               if (!isset(self::$db_setup_classes[$dbtype])) {
+               if (!isset(self::$dbSetupClasses[$dbtype])) {
                        $dbtype = 'sqlite';
                }
 
-               $class = self::$db_setup_classes[$dbtype];
-               $db_setup = new $class(self::getTrans());
-               $error = array_merge($error, $db_setup->validate($options));
+               $class = self::$dbSetupClasses[$dbtype];
+               $dbSetup = new $class(self::getTrans(), 'db_structure.xml');
+               $error = array_merge($error, $dbSetup->validate($options));
 
                if(count($error) != 0) {
                        return $error;
@@ -83,8 +83,8 @@ class OC_Setup {
                OC_Config::setValue('dbtype', $dbtype);
                OC_Config::setValue('version', implode('.', OC_Util::getVersion()));
                try {
-                       $db_setup->initialize($options);
-                       $db_setup->setupDatabase($username);
+                       $dbSetup->initialize($options);
+                       $dbSetup->setupDatabase($username);
                } catch (DatabaseSetupException $e) {
                        $error[] = array(
                                'error' => $e->getMessage(),
index 66202251e975c0e735aede219c1fbeea77089879..0beada7bd299d2151e24842e2ad271f6c867a4d3 100644 (file)
@@ -4,14 +4,16 @@ namespace OC\Setup;
 
 abstract class AbstractDatabase {
        protected $trans;
+       protected $dbDefinitionFile;
        protected $dbuser;
        protected $dbpassword;
        protected $dbname;
        protected $dbhost;
        protected $tableprefix;
 
-       public function __construct($trans) {
+       public function __construct($trans, $dbDefinitionFile) {
                $this->trans = $trans;
+               $this->dbDefinitionFile = $dbDefinitionFile;
        }
 
        public function validate($config) {
index 5ed0d030c7c9917fe1e917577e1c959e608de5ea..b8329f9907963d26f8dc6f0b991b7488e6e9eb41 100644 (file)
@@ -172,7 +172,7 @@ class MSSQL extends AbstractDatabase {
                                \OC_Log::write('setup.mssql', $entry, \OC_Log::WARN);
                        } else {
                                if ($row == null) {
-                                       \OC_DB::createDbFromStructure('db_structure.xml');
+                                       \OC_DB::createDbFromStructure($this->dbDefinitionFile);
                                }
                        }
                }
index 1ab1b6ea8ae1b943f4ec640ba73da9f232348f81..0cf04fde5a1ca17c68c6d04ec61e66a3f8c32b11 100644 (file)
@@ -52,7 +52,7 @@ class MySQL extends AbstractDatabase {
                        $row=mysql_fetch_row($result);
                }
                if(!$result or $row[0]==0) {
-                       \OC_DB::createDbFromStructure('db_structure.xml');
+                       \OC_DB::createDbFromStructure($this->dbDefinitionFile);
                }
                mysql_close($connection);
        }
index cda7ff7c50c98cf2b30aef14da6d190d7e390cc3..577948766bd8abc459621a5abdaca638e1b58714 100644 (file)
@@ -128,7 +128,7 @@ class OCI extends AbstractDatabase {
                        $row = oci_fetch_row($stmt);
                }
                if(!$result or $row[0]==0) {
-                       \OC_DB::createDbFromStructure('db_structure.xml');
+                       \OC_DB::createDbFromStructure($this->dbDefinitionFile);
                }
        }
 
index d5b135a957790a5be3b19c0c6034ca3c96110b58..49fcbf0326e5e23b655a5683b357acf86e5c7a50 100644 (file)
@@ -75,7 +75,7 @@ class PostgreSQL extends AbstractDatabase {
                        $row = pg_fetch_row($result);
                }
                if(!$result or $row[0]==0) {
-                       \OC_DB::createDbFromStructure('db_structure.xml');
+                       \OC_DB::createDbFromStructure($this->dbDefinitionFile);
                }
        }
 
index 4b0a572bb39d3bdca62225159a0beb4db5352a90..fd4df792d622c0cdcb05775dab94d307313817f9 100644 (file)
@@ -21,6 +21,6 @@ class Sqlite extends AbstractDatabase {
                }
                //in case of sqlite, we can always fill the database
                error_log("creating sqlite db");
-               \OC_DB::createDbFromStructure('db_structure.xml');
+               \OC_DB::createDbFromStructure($this->dbDefinitionFile);
        }
 }