From e93ce26f27fa8c2c364696a7a7ce5122eb4a91e2 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Thu, 11 Apr 2013 00:08:53 +0200 Subject: [PATCH] Fix found errors --- lib/setup/abstractdatabase.php | 2 +- lib/setup/mssql.php | 2 +- lib/setup/mysql.php | 4 ++-- lib/setup/oci.php | 7 +++---- lib/setup/postgresql.php | 4 ++-- lib/setup/sqlite.php | 1 + 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/setup/abstractdatabase.php b/lib/setup/abstractdatabase.php index c1b611e655..66202251e9 100644 --- a/lib/setup/abstractdatabase.php +++ b/lib/setup/abstractdatabase.php @@ -43,6 +43,6 @@ abstract class AbstractDatabase { $this->dbpassword = $dbpass; $this->dbname = $dbname; $this->dbhost = $dbhost; - $this->tableprefix = $tableprefix; + $this->tableprefix = $dbtableprefix; } } diff --git a/lib/setup/mssql.php b/lib/setup/mssql.php index 74ac8f294a..5ed0d030c7 100644 --- a/lib/setup/mssql.php +++ b/lib/setup/mssql.php @@ -149,7 +149,7 @@ class MSSQL extends AbstractDatabase { //fill the database if needed $query = "SELECT * FROM INFORMATION_SCHEMA.TABLES" ." WHERE TABLE_SCHEMA = '".$this->dbname."'" - ." AND TABLE_NAME = '".$this->dbtableprefix."users'"; + ." AND TABLE_NAME = '".$this->tableprefix."users'"; $result = sqlsrv_query($connection, $query); if ($result === false) { if ( ($errors = sqlsrv_errors() ) != null) { diff --git a/lib/setup/mysql.php b/lib/setup/mysql.php index aa0344f686..1ab1b6ea8a 100644 --- a/lib/setup/mysql.php +++ b/lib/setup/mysql.php @@ -23,7 +23,7 @@ class MySQL extends AbstractDatabase { $this->dbuser=substr('oc_'.$username, 0, 16); if($this->dbuser!=$oldUser) { //hash the password so we don't need to store the admin config in the config file - $this->dbpassword=OC_Util::generate_random_bytes(30); + $this->dbpassword=\OC_Util::generate_random_bytes(30); $this->createDBUser($connection); @@ -46,7 +46,7 @@ class MySQL extends AbstractDatabase { //fill the database if needed $query='select count(*) from information_schema.tables' - ." where table_schema='".$this->dbname."' AND table_name = '".$this->dbtableprefix."users';"; + ." where table_schema='".$this->dbname."' AND table_name = '".$this->tableprefix."users';"; $result = mysql_query($query, $connection); if($result) { $row=mysql_fetch_row($result); diff --git a/lib/setup/oci.php b/lib/setup/oci.php index 56452c65a5..cda7ff7c50 100644 --- a/lib/setup/oci.php +++ b/lib/setup/oci.php @@ -65,14 +65,14 @@ class OCI extends AbstractDatabase { //add prefix to the oracle user name to prevent collisions $this->dbuser='oc_'.$username; //create a new password so we don't need to store the admin config in the config file - $this->dbpassword=OC_Util::generate_random_bytes(30); + $this->dbpassword=\OC_Util::generate_random_bytes(30); //oracle passwords are treated as identifiers: // must start with aphanumeric char // needs to be shortened to 30 bytes, as the two " needed to escape the identifier count towards the identifier length. $this->dbpassword=substr($this->dbpassword, 0, 30); - $this->createDBUser($this->dbtablespace, $connection); + $this->createDBUser($connection); \OC_Config::setValue('dbuser', $this->dbusername); \OC_Config::setValue('dbname', $this->dbusername); @@ -136,10 +136,9 @@ class OCI extends AbstractDatabase { * * @param String $name * @param String $password - * @param String $tablespace * @param resource $connection */ - private function createDBUser($tablespace, $connection) { + private function createDBUser($connection) { $name = $this->dbuser; $password = $this->password; $query = "SELECT * FROM all_users WHERE USERNAME = :un"; diff --git a/lib/setup/postgresql.php b/lib/setup/postgresql.php index 67e4f901a9..d5b135a957 100644 --- a/lib/setup/postgresql.php +++ b/lib/setup/postgresql.php @@ -33,7 +33,7 @@ class PostgreSQL extends AbstractDatabase { //add prefix to the postgresql user name to prevent collisions $this->dbuser='oc_'.$username; //create a new password so we don't need to store the admin config in the config file - $this->dbpassword=OC_Util::generate_random_bytes(30); + $this->dbpassword=\OC_Util::generate_random_bytes(30); $this->createDBUser($connection); @@ -69,7 +69,7 @@ class PostgreSQL extends AbstractDatabase { throw new \DatabaseSetupException($this->trans->t('PostgreSQL username and/or password not valid'), $this->trans->t('You need to enter either an existing account or the administrator.')); } - $query = "select count(*) FROM pg_class WHERE relname='".$this->dbtableprefix."users' limit 1"; + $query = "select count(*) FROM pg_class WHERE relname='".$this->tableprefix."users' limit 1"; $result = pg_query($connection, $query); if($result) { $row = pg_fetch_row($result); diff --git a/lib/setup/sqlite.php b/lib/setup/sqlite.php index 0b96ec6000..4b0a572bb3 100644 --- a/lib/setup/sqlite.php +++ b/lib/setup/sqlite.php @@ -6,6 +6,7 @@ class Sqlite extends AbstractDatabase { public $dbprettyname = 'Sqlite'; public function validate($config) { + return array(); } public function initialize($config) {