summaryrefslogtreecommitdiffstats
path: root/apps/files_versions
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-07-16 10:32:34 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-07-16 15:53:40 +0200
commit3b0478773aa6c4f3816363e46b9f76529af67fd2 (patch)
treeb3eb6fe6676e6b776be306db15a4e0928941ad83 /apps/files_versions
parent33aeef2d101029dd4538994d462a51062a5975d7 (diff)
downloadnextcloud-server-3b0478773aa6c4f3816363e46b9f76529af67fd2.tar.gz
nextcloud-server-3b0478773aa6c4f3816363e46b9f76529af67fd2.zip
Migrate files versions to the PSR container
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/files_versions')
-rw-r--r--apps/files_versions/lib/AppInfo/Application.php23
1 files changed, 12 insertions, 11 deletions
diff --git a/apps/files_versions/lib/AppInfo/Application.php b/apps/files_versions/lib/AppInfo/Application.php
index 82a12fbc5b0..b062d64af6b 100644
--- a/apps/files_versions/lib/AppInfo/Application.php
+++ b/apps/files_versions/lib/AppInfo/Application.php
@@ -43,9 +43,9 @@ use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
-use OCP\AppFramework\IAppContainer;
use OCP\ILogger;
use OCP\IServerContainer;
+use Psr\Container\ContainerInterface;
class Application extends App implements IBootstrap {
public const APP_ID = 'files_versions';
@@ -63,20 +63,21 @@ class Application extends App implements IBootstrap {
/**
* Register $principalBackend for the DAV collection
*/
- $context->registerService('principalBackend', function (IAppContainer $c) {
- $server = $c->getServer();
+ $context->registerService('principalBackend', function (ContainerInterface $c) {
+ /** @var IServerContainer $server */
+ $server = $c->get(IServerContainer::class);
return new Principal(
$server->getUserManager(),
$server->getGroupManager(),
$server->getShareManager(),
$server->getUserSession(),
$server->getAppManager(),
- $server->query(ProxyMapper::class),
+ $server->get(ProxyMapper::class),
$server->getConfig()
);
});
- $context->registerService(IVersionManager::class, function (IAppContainer $c) {
+ $context->registerService(IVersionManager::class, function () {
return new VersionManager();
});
@@ -96,17 +97,17 @@ class Application extends App implements IBootstrap {
Hooks::connectHooks();
}
- public function registerVersionBackends(IServerContainer $server, IAppManager $appManager, ILogger $logger) {
+ public function registerVersionBackends(ContainerInterface $container, IAppManager $appManager, ILogger $logger) {
foreach ($appManager->getInstalledApps() as $app) {
$appInfo = $appManager->getAppInfo($app);
if (isset($appInfo['versions'])) {
$backends = $appInfo['versions'];
foreach ($backends as $backend) {
if (isset($backend['@value'])) {
- $this->loadBackend($backend, $server, $logger);
+ $this->loadBackend($backend, $container, $logger);
} else {
foreach ($backend as $singleBackend) {
- $this->loadBackend($singleBackend, $server, $logger);
+ $this->loadBackend($singleBackend, $container, $logger);
}
}
}
@@ -114,13 +115,13 @@ class Application extends App implements IBootstrap {
}
}
- private function loadBackend(array $backend, IServerContainer $server, ILogger $logger) {
+ private function loadBackend(array $backend, ContainerInterface $container, ILogger $logger) {
/** @var IVersionManager $versionManager */
- $versionManager = $server->query(IVersionManager::class);
+ $versionManager = $container->get(IVersionManager::class);
$class = $backend['@value'];
$for = $backend['@attributes']['for'];
try {
- $backendObject = $server->query($class);
+ $backendObject = $container->get($class);
$versionManager->registerBackend($for, $backendObject);
} catch (\Exception $e) {
$logger->logException($e);