Fix found errors

This commit is contained in:
Bart Visscher 2013-04-11 00:08:53 +02:00
parent 42c44d5165
commit e93ce26f27
6 changed files with 10 additions and 10 deletions

View file

@ -43,6 +43,6 @@ abstract class AbstractDatabase {
$this->dbpassword = $dbpass;
$this->dbname = $dbname;
$this->dbhost = $dbhost;
$this->tableprefix = $tableprefix;
$this->tableprefix = $dbtableprefix;
}
}

View file

@ -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) {

View file

@ -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);

View file

@ -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";

View file

@ -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);

View file

@ -6,6 +6,7 @@ class Sqlite extends AbstractDatabase {
public $dbprettyname = 'Sqlite';
public function validate($config) {
return array();
}
public function initialize($config) {