diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
commit | caff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch) | |
tree | 186d494c2aea5dea7255d3584ef5d595fc6e6194 /lib/private/Setup | |
parent | edf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff) | |
download | nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.tar.gz nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.zip |
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.
This also removes and empty lines from method/function bodies at the
beginning and end.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/private/Setup')
-rw-r--r-- | lib/private/Setup/AbstractDatabase.php | 8 | ||||
-rw-r--r-- | lib/private/Setup/MySQL.php | 7 |
2 files changed, 7 insertions, 8 deletions
diff --git a/lib/private/Setup/AbstractDatabase.php b/lib/private/Setup/AbstractDatabase.php index d509a6b8722..649afbe27cb 100644 --- a/lib/private/Setup/AbstractDatabase.php +++ b/lib/private/Setup/AbstractDatabase.php @@ -69,14 +69,14 @@ abstract class AbstractDatabase { public function validate($config) { $errors = []; - if(empty($config['dbuser']) && empty($config['dbname'])) { + if (empty($config['dbuser']) && empty($config['dbname'])) { $errors[] = $this->trans->t("%s enter the database username and name.", [$this->dbprettyname]); - } elseif(empty($config['dbuser'])) { + } elseif (empty($config['dbuser'])) { $errors[] = $this->trans->t("%s enter the database username.", [$this->dbprettyname]); - } elseif(empty($config['dbname'])) { + } elseif (empty($config['dbname'])) { $errors[] = $this->trans->t("%s enter the database name.", [$this->dbprettyname]); } - if(substr_count($config['dbname'], '.') >= 1) { + if (substr_count($config['dbname'], '.') >= 1) { $errors[] = $this->trans->t("%s you may not use dots in the database name", [$this->dbprettyname]); } return $errors; diff --git a/lib/private/Setup/MySQL.php b/lib/private/Setup/MySQL.php index 7371c7aeab2..9d48bbca488 100644 --- a/lib/private/Setup/MySQL.php +++ b/lib/private/Setup/MySQL.php @@ -74,7 +74,7 @@ class MySQL extends AbstractDatabase { * @param \OC\DB\Connection $connection */ private function createDatabase($connection) { - try{ + try { $name = $this->dbName; $user = $this->dbUser; //we can't use OC_DB functions here because we need to connect as the administrative user. @@ -108,7 +108,7 @@ class MySQL extends AbstractDatabase { * @throws \OC\DatabaseSetupException */ private function createDBUser($connection) { - try{ + try { $name = $this->dbUser; $password = $this->dbPassword; // we need to create 2 accounts, one for global use and one for local user. if we don't specify the local one, @@ -125,8 +125,7 @@ class MySQL extends AbstractDatabase { $query = "CREATE USER '$name'@'%' IDENTIFIED BY '$password'"; $connection->executeUpdate($query); } - } - catch (\Exception $ex){ + } catch (\Exception $ex) { $this->logger->logException($ex, [ 'message' => 'Database user creation failed.', 'level' => ILogger::ERROR, |