Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2021-07-02 18:45:03 +0300
committerVincent Petry <vincent@nextcloud.com>2021-07-27 13:19:24 +0300
commitcff8ae7ded95ca035c7a6ec9fe5c4212273e2b6c (patch)
treebcfb6086210a25de3a5ab7a72846a2734bc8f58a /apps/files_sharing/lib
parent46b8cf4f64a8a2d9320ded762eeb0a4b9347181d (diff)
Add logging to external shares manager
Instead of just returning false, also log the exception to make debugging database issues easier. Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'apps/files_sharing/lib')
-rw-r--r--apps/files_sharing/lib/AppInfo/Application.php3
-rw-r--r--apps/files_sharing/lib/External/Manager.php37
-rw-r--r--apps/files_sharing/lib/Hooks.php3
3 files changed, 28 insertions, 15 deletions
diff --git a/apps/files_sharing/lib/AppInfo/Application.php b/apps/files_sharing/lib/AppInfo/Application.php
index 7f234e63660..3975a8a3bde 100644
--- a/apps/files_sharing/lib/AppInfo/Application.php
+++ b/apps/files_sharing/lib/AppInfo/Application.php
@@ -98,7 +98,8 @@ class Application extends App {
$server->getGroupManager(),
$server->getUserManager(),
$uid,
- $server->query(IEventDispatcher::class)
+ $server->query(IEventDispatcher::class),
+ $server->getLogger()
);
});
diff --git a/apps/files_sharing/lib/External/Manager.php b/apps/files_sharing/lib/External/Manager.php
index 247be47ac90..de566692d6b 100644
--- a/apps/files_sharing/lib/External/Manager.php
+++ b/apps/files_sharing/lib/External/Manager.php
@@ -14,6 +14,7 @@
* @author Robin Appelman <robin@icewind.nl>
* @author Roeland Jago Douma <roeland@famdouma.nl>
* @author Stefan Weil <sw@weilnetz.de>
+ * @author Vincent Petry <vincent@nextcloud.com>
*
* @license AGPL-3.0
*
@@ -44,6 +45,7 @@ use OCP\Files\Storage\IStorageFactory;
use OCP\Http\Client\IClientService;
use OCP\IDBConnection;
use OCP\IGroupManager;
+use OCP\ILogger;
use OCP\IUserManager;
use OCP\Notification\IManager;
use OCP\OCS\IDiscoveryService;
@@ -89,18 +91,24 @@ class Manager {
/** @var IEventDispatcher */
private $eventDispatcher;
- public function __construct(IDBConnection $connection,
- \OC\Files\Mount\Manager $mountManager,
- IStorageFactory $storageLoader,
- IClientService $clientService,
- IManager $notificationManager,
- IDiscoveryService $discoveryService,
- ICloudFederationProviderManager $cloudFederationProviderManager,
- ICloudFederationFactory $cloudFederationFactory,
- IGroupManager $groupManager,
- IUserManager $userManager,
- ?string $uid,
- IEventDispatcher $eventDispatcher) {
+ /** @var ILogger */
+ private $logger;
+
+ public function __construct(
+ IDBConnection $connection,
+ \OC\Files\Mount\Manager $mountManager,
+ IStorageFactory $storageLoader,
+ IClientService $clientService,
+ IManager $notificationManager,
+ IDiscoveryService $discoveryService,
+ ICloudFederationProviderManager $cloudFederationProviderManager,
+ ICloudFederationFactory $cloudFederationFactory,
+ IGroupManager $groupManager,
+ IUserManager $userManager,
+ ?string $uid,
+ IEventDispatcher $eventDispatcher,
+ ILogger $logger
+ ) {
$this->connection = $connection;
$this->mountManager = $mountManager;
$this->storageLoader = $storageLoader;
@@ -113,6 +121,7 @@ class Manager {
$this->groupManager = $groupManager;
$this->userManager = $userManager;
$this->eventDispatcher = $eventDispatcher;
+ $this->logger = $logger;
}
/**
@@ -535,6 +544,7 @@ class Manager {
$this->removeReShares($id);
} catch (\Doctrine\DBAL\Exception $ex) {
+ $this->logger->logException($ex);
return false;
}
@@ -606,6 +616,7 @@ class Manager {
$deleteResult->closeCursor();
}
} catch (\Doctrine\DBAL\Exception $ex) {
+ $this->logger->logException($ex);
return false;
}
@@ -677,7 +688,7 @@ class Manager {
}
return array_values($shares);
} catch (\Doctrine\DBAL\Exception $e) {
- // FIXME
+ $this->logger->logException($e);
return [];
}
}
diff --git a/apps/files_sharing/lib/Hooks.php b/apps/files_sharing/lib/Hooks.php
index ff4ca59339a..26e799297ff 100644
--- a/apps/files_sharing/lib/Hooks.php
+++ b/apps/files_sharing/lib/Hooks.php
@@ -43,7 +43,8 @@ class Hooks {
\OC::$server->getGroupManager(),
\OC::$server->getUserManager(),
$params['uid'],
- \OC::$server->query(IEventDispatcher::class)
+ \OC::$server->query(IEventDispatcher::class),
+ \OC::$server->getLogger()
);
$manager->removeUserShares($params['uid']);