diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2016-12-09 22:46:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-09 22:46:03 +0100 |
commit | 341265fbcbcc908b8dca5a4200c4cacd915b2fb3 (patch) | |
tree | 27cc443a7fe9cef746cad9b3ef9bb72bd70a1f8b /lib/private | |
parent | 4f3f799e068161e72f96abb6b06ea49c2c80f91a (diff) | |
parent | a5a35cda7c4e7f4888b3d4884a7b61b8fe02163a (diff) | |
download | nextcloud-server-341265fbcbcc908b8dca5a4200c4cacd915b2fb3.tar.gz nextcloud-server-341265fbcbcc908b8dca5a4200c4cacd915b2fb3.zip |
Merge pull request #2590 from nextcloud/postgres-install-failing
Revert "Quote database and role in queries"
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/Setup/PostgreSQL.php | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/private/Setup/PostgreSQL.php b/lib/private/Setup/PostgreSQL.php index 4f4f8a03231..085e8609ab2 100644 --- a/lib/private/Setup/PostgreSQL.php +++ b/lib/private/Setup/PostgreSQL.php @@ -60,7 +60,7 @@ class PostgreSQL extends AbstractDatabase { //use the admin login data for the new database user //add prefix to the postgresql user name to prevent collisions - $this->dbUser = 'oc_' . $username; + $this->dbUser = 'oc_' . strtolower($username); //create a new password so we don't need to store the admin config in the config file $this->dbPassword = \OC::$server->getSecureRandom()->generate(30, \OCP\Security\ISecureRandom::CHAR_LOWER . \OCP\Security\ISecureRandom::CHAR_DIGITS); @@ -111,7 +111,7 @@ class PostgreSQL extends AbstractDatabase { private function createDatabase(IDBConnection $connection) { if (!$this->databaseExists($connection)) { //The database does not exists... let's create it - $query = $connection->prepare("CREATE DATABASE \"" . addslashes($this->dbName) . "\" OWNER '" . addslashes($this->dbUser) . "'"); + $query = $connection->prepare("CREATE DATABASE " . addslashes($this->dbName) . " OWNER " . addslashes($this->dbUser)); try { $query->execute(); } catch (DatabaseException $e) { @@ -119,7 +119,7 @@ class PostgreSQL extends AbstractDatabase { $this->logger->logException($e); } } else { - $query = $connection->prepare("REVOKE ALL PRIVILEGES ON DATABASE \"" . addslashes($this->dbName) . "\" FROM PUBLIC"); + $query = $connection->prepare("REVOKE ALL PRIVILEGES ON DATABASE " . addslashes($this->dbName) . " FROM PUBLIC"); try { $query->execute(); } catch (DatabaseException $e) { @@ -153,10 +153,10 @@ class PostgreSQL extends AbstractDatabase { try { if ($this->userExists($connection)) { // change the password - $query = $connection->prepare("ALTER ROLE \"" . addslashes($this->dbUser) . "\" WITH CREATEDB PASSWORD '" . addslashes($this->dbPassword) . "'"); + $query = $connection->prepare("ALTER ROLE " . addslashes($this->dbUser) . " WITH CREATEDB PASSWORD '" . addslashes($this->dbPassword) . "'"); } else { // create the user - $query = $connection->prepare("CREATE USER \"" . addslashes($this->dbUser) . "\" CREATEDB PASSWORD '" . addslashes($this->dbPassword) . "'"); + $query = $connection->prepare("CREATE USER " . addslashes($this->dbUser) . " CREATEDB PASSWORD '" . addslashes($this->dbPassword) . "'"); } $query->execute(); } catch (DatabaseException $e) { |