diff options
author | Julius Härtl <jus@bitgrid.net> | 2022-02-25 16:18:02 +0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2022-02-28 11:24:41 +0100 |
commit | 83717a7800e8854b3f3ba17608157598d1fe28ca (patch) | |
tree | ee7e264c35c991fe182853dbf853b95760cd4fa6 /lib/private/DB/Connection.php | |
parent | f13c150a560f31ed3e03833b9ed416d8c7c592f4 (diff) | |
download | nextcloud-server-83717a7800e8854b3f3ba17608157598d1fe28ca.tar.gz nextcloud-server-83717a7800e8854b3f3ba17608157598d1fe28ca.zip |
Add event logging for db and redis connection
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib/private/DB/Connection.php')
-rw-r--r-- | lib/private/DB/Connection.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/private/DB/Connection.php b/lib/private/DB/Connection.php index 2203893d427..e32c530c19e 100644 --- a/lib/private/DB/Connection.php +++ b/lib/private/DB/Connection.php @@ -81,7 +81,17 @@ class Connection extends \Doctrine\DBAL\Connection { */ public function connect() { try { - return parent::connect(); + if ($this->_conn) { + return parent::connect(); + } + + // Only trigger the event logger for the initial connect call + $eventLogger = \OC::$server->getEventLogger(); + $eventLogger->start('connect:db', 'db connection opened'); + $status = parent::connect(); + $eventLogger->end('connect:db'); + + return $status; } catch (Exception $e) { // throw a new exception to prevent leaking info from the stacktrace throw new Exception('Failed to connect to the database: ' . $e->getMessage(), $e->getCode()); |