diff --git a/lib/private/ocs/cloud.php b/lib/private/ocs/cloud.php index ff6b7977cd..8f4f1769e9 100644 --- a/lib/private/ocs/cloud.php +++ b/lib/private/ocs/cloud.php @@ -37,14 +37,7 @@ class OC_OCS_Cloud { 'edition' => OC_Util::getEditionString(), ); - $result['capabilities'] = array( - 'core' => array( - 'pollinterval' => OC_Config::getValue('pollinterval', 60), - ), - ); - - - $result['capabilities'] = array_merge_recursive($result['capabilities'], \OC::$server->getCapabilitiesManager()->getCapabilities()); + $result['capabilities'] = \OC::$server->getCapabilitiesManager()->getCapabilities(); return new OC_OCS_Result($result); } diff --git a/lib/private/ocs/corecapabilities.php b/lib/private/ocs/corecapabilities.php new file mode 100644 index 0000000000..6b620ab0a8 --- /dev/null +++ b/lib/private/ocs/corecapabilities.php @@ -0,0 +1,56 @@ + + * + * @copyright Copyright (c) 2015, ownCloud, Inc. + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see + * + */ + +namespace OC\OCS; + +use OCP\Capabilities\ICapability; +use OCP\IConfig; + +/** + * Class Capabilities + * + * @package OC\OCS + */ +class CoreCapabilities implements ICapability { + + /** @var IConfig */ + private $config; + + /** + * @param IConfig $config + */ + public function __construct(IConfig $config) { + $this->config = $config; + } + + /** + * Return this classes capabilities + * + * @return array + */ + public function getCapabilities() { + return [ + 'core' => [ + 'pollinterval' => $this->config->getSystemValue('pollinterval', 60) + ] + ]; + } +} diff --git a/lib/private/server.php b/lib/private/server.php index 2c0793f4c1..5bf3121ec0 100644 --- a/lib/private/server.php +++ b/lib/private/server.php @@ -59,7 +59,6 @@ use OC\Security\SecureRandom; use OC\Security\TrustedDomainHelper; use OC\Tagging\TagMapper; use OCP\IServerContainer; -use OC\CapabilitiesManager; /** * Class Server @@ -450,8 +449,14 @@ class Server extends SimpleContainer implements IServerContainer { $c->getURLGenerator(), \OC::$configDir); }); - $this->registerService('CapabilitiesManager', function () { - return new CapabilitiesManager(); + $this->registerService('CapabilitiesManager', function (Server $c) { + $manager = new \OC\CapabilitiesManager(); + $manager->registerCapability(function() use ($c) { + return new \OC\OCS\CoreCapabilities( + $c->getConfig() + ); + }); + return $manager; }); }