aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Setup
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2021-04-22 15:22:50 +0200
committerJoas Schilling <coding@schilljs.com>2021-04-27 14:34:32 +0200
commit167efa19d706b1e430343554cdecd513cbb6610e (patch)
tree8f4afd2fd685a8434281046f7aa89713f7b8d798 /lib/private/Setup
parentdf47445c014b83d8400bada6dad53d26d24fd803 (diff)
downloadnextcloud-server-167efa19d706b1e430343554cdecd513cbb6610e.tar.gz
nextcloud-server-167efa19d706b1e430343554cdecd513cbb6610e.zip
Fix psalm errors
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Setup')
-rw-r--r--lib/private/Setup/MySQL.php9
-rw-r--r--lib/private/Setup/PostgreSQL.php24
2 files changed, 20 insertions, 13 deletions
diff --git a/lib/private/Setup/MySQL.php b/lib/private/Setup/MySQL.php
index c2b0cd8aaac..7b90e1f715c 100644
--- a/lib/private/Setup/MySQL.php
+++ b/lib/private/Setup/MySQL.php
@@ -66,7 +66,9 @@ class MySQL extends AbstractDatabase {
try {
$connection->connect();
} catch (\Exception $e) {
- $this->logger->logException($e);
+ $this->logger->error($e->getMessage(), [
+ 'exception' => $e,
+ ]);
throw new \OC\DatabaseSetupException($this->trans->t('MySQL username and/or password not valid'),
$this->trans->t('You need to enter details of an existing account.'), 0, $e);
}
@@ -177,9 +179,8 @@ class MySQL extends AbstractDatabase {
}
}
} catch (\Exception $ex) {
- $this->logger->logException($ex, [
- 'message' => 'Can not create a new MySQL user, will continue with the provided user.',
- 'level' => ILogger::INFO,
+ $this->logger->info('Can not create a new MySQL user, will continue with the provided user.', [
+ 'exception' => $ex,
'app' => 'mysql.setup',
]);
}
diff --git a/lib/private/Setup/PostgreSQL.php b/lib/private/Setup/PostgreSQL.php
index 7e59bf297f1..40386666341 100644
--- a/lib/private/Setup/PostgreSQL.php
+++ b/lib/private/Setup/PostgreSQL.php
@@ -82,8 +82,9 @@ class PostgreSQL extends AbstractDatabase {
// the connection to dbname=postgres is not needed anymore
$connection->close();
} catch (\Exception $e) {
- $this->logger->logException($e);
- $this->logger->warning('Error trying to connect as "postgres", assuming database is setup and tables need to be created');
+ $this->logger->warning('Error trying to connect as "postgres", assuming database is setup and tables need to be created', [
+ 'exception' => $e,
+ ]);
$this->config->setValues([
'dbuser' => $this->dbUser,
'dbpassword' => $this->dbPassword,
@@ -97,7 +98,9 @@ class PostgreSQL extends AbstractDatabase {
try {
$connection->connect();
} catch (\Exception $e) {
- $this->logger->logException($e);
+ $this->logger->error($e->getMessage(), [
+ 'exception' => $e,
+ ]);
throw new \OC\DatabaseSetupException($this->trans->t('PostgreSQL username and/or password not valid'),
$this->trans->t('You need to enter details of an existing account.'), 0, $e);
}
@@ -110,16 +113,18 @@ class PostgreSQL extends AbstractDatabase {
try {
$query->execute();
} catch (DatabaseException $e) {
- $this->logger->error('Error while trying to create database');
- $this->logger->logException($e);
+ $this->logger->error('Error while trying to create database', [
+ 'exception' => $e,
+ ]);
}
} else {
$query = $connection->prepare("REVOKE ALL PRIVILEGES ON DATABASE " . addslashes($this->dbName) . " FROM PUBLIC");
try {
$query->execute();
} catch (DatabaseException $e) {
- $this->logger->error('Error while trying to restrict database permissions');
- $this->logger->logException($e);
+ $this->logger->error('Error while trying to restrict database permissions', [
+ 'exception' => $e,
+ ]);
}
}
}
@@ -161,8 +166,9 @@ class PostgreSQL extends AbstractDatabase {
$query->execute();
}
} catch (DatabaseException $e) {
- $this->logger->error('Error while trying to create database user');
- $this->logger->logException($e);
+ $this->logger->error('Error while trying to create database user', [
+ 'exception' => $e,
+ ]);
}
}
}