Move core capabilities to new class
This commit is contained in:
parent
e84cffc063
commit
c80c9819dc
|
@ -37,14 +37,7 @@ class OC_OCS_Cloud {
|
||||||
'edition' => OC_Util::getEditionString(),
|
'edition' => OC_Util::getEditionString(),
|
||||||
);
|
);
|
||||||
|
|
||||||
$result['capabilities'] = array(
|
$result['capabilities'] = \OC::$server->getCapabilitiesManager()->getCapabilities();
|
||||||
'core' => array(
|
|
||||||
'pollinterval' => OC_Config::getValue('pollinterval', 60),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
$result['capabilities'] = array_merge_recursive($result['capabilities'], \OC::$server->getCapabilitiesManager()->getCapabilities());
|
|
||||||
|
|
||||||
return new OC_OCS_Result($result);
|
return new OC_OCS_Result($result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @author Roeland Jago Douma <roeland@famdouma.nl>
|
||||||
|
*
|
||||||
|
* @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 <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
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)
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
|
@ -59,7 +59,6 @@ use OC\Security\SecureRandom;
|
||||||
use OC\Security\TrustedDomainHelper;
|
use OC\Security\TrustedDomainHelper;
|
||||||
use OC\Tagging\TagMapper;
|
use OC\Tagging\TagMapper;
|
||||||
use OCP\IServerContainer;
|
use OCP\IServerContainer;
|
||||||
use OC\CapabilitiesManager;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Server
|
* Class Server
|
||||||
|
@ -450,8 +449,14 @@ class Server extends SimpleContainer implements IServerContainer {
|
||||||
$c->getURLGenerator(),
|
$c->getURLGenerator(),
|
||||||
\OC::$configDir);
|
\OC::$configDir);
|
||||||
});
|
});
|
||||||
$this->registerService('CapabilitiesManager', function () {
|
$this->registerService('CapabilitiesManager', function (Server $c) {
|
||||||
return new CapabilitiesManager();
|
$manager = new \OC\CapabilitiesManager();
|
||||||
|
$manager->registerCapability(function() use ($c) {
|
||||||
|
return new \OC\OCS\CoreCapabilities(
|
||||||
|
$c->getConfig()
|
||||||
|
);
|
||||||
|
});
|
||||||
|
return $manager;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue