diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2016-08-16 18:31:59 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2016-08-16 18:31:59 +0200 |
commit | 717e22267a1c23dda1b25b9d01bb1fada9ce8ab7 (patch) | |
tree | 544774d1018e19d462e79360b3fc86b6cdd39b16 /lib/private/CapabilitiesManager.php | |
parent | 4946cc220de5926ef86dc8557ffb5c990f6482d3 (diff) | |
parent | 9db189174c26326bbb58d96f614a415cd15542d1 (diff) | |
download | nextcloud-server-717e22267a1c23dda1b25b9d01bb1fada9ce8ab7.tar.gz nextcloud-server-717e22267a1c23dda1b25b9d01bb1fada9ce8ab7.zip |
Merge branch 'master' into implement_712
Diffstat (limited to 'lib/private/CapabilitiesManager.php')
-rw-r--r-- | lib/private/CapabilitiesManager.php | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/private/CapabilitiesManager.php b/lib/private/CapabilitiesManager.php index 99a37d652a1..159fa97c708 100644 --- a/lib/private/CapabilitiesManager.php +++ b/lib/private/CapabilitiesManager.php @@ -22,15 +22,22 @@ namespace OC; +use OCP\AppFramework\QueryException; use OCP\Capabilities\ICapability; +use OCP\ILogger; class CapabilitiesManager { - /** - * @var \Closure[] - */ + /** @var \Closure[] */ private $capabilities = array(); + /** @var ILogger */ + private $logger; + + public function __construct(ILogger $logger) { + $this->logger = $logger; + } + /** * Get an array of al the capabilities that are registered at this manager * @@ -40,7 +47,13 @@ class CapabilitiesManager { public function getCapabilities() { $capabilities = []; foreach($this->capabilities as $capability) { - $c = $capability(); + try { + $c = $capability(); + } catch (QueryException $e) { + $this->logger->error('CapabilitiesManager: {message}', ['app' => 'core', 'message' => $e->getMessage()]); + continue; + } + if ($c instanceof ICapability) { $capabilities = array_replace_recursive($capabilities, $c->getCapabilities()); } else { |