diff options
author | Robin Appelman <robin@icewind.nl> | 2019-06-04 14:11:24 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2019-06-04 14:11:24 +0200 |
commit | 5209cdccdbe926d31bafec0e284a0b19f3962625 (patch) | |
tree | 1badd3bae62506a15939e89f8ecfafda4f7aab18 /apps/files_versions/lib | |
parent | fd9ff581e2a92f65def3f5d3209c4328fb65416a (diff) | |
download | nextcloud-server-5209cdccdbe926d31bafec0e284a0b19f3962625.tar.gz nextcloud-server-5209cdccdbe926d31bafec0e284a0b19f3962625.zip |
fix loading multiple version backends from one app
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/files_versions/lib')
-rw-r--r-- | apps/files_versions/lib/AppInfo/Application.php | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/apps/files_versions/lib/AppInfo/Application.php b/apps/files_versions/lib/AppInfo/Application.php index 45dc6da6e2c..6a8e50dba93 100644 --- a/apps/files_versions/lib/AppInfo/Application.php +++ b/apps/files_versions/lib/AppInfo/Application.php @@ -65,25 +65,36 @@ class Application extends App { public function registerVersionBackends() { $server = $this->getContainer()->getServer(); - $logger = $server->getLogger(); $appManager = $server->getAppManager(); - /** @var IVersionManager $versionManager */ - $versionManager = $this->getContainer()->getServer()->query(IVersionManager::class); foreach($appManager->getInstalledApps() as $app) { $appInfo = $appManager->getAppInfo($app); if (isset($appInfo['versions'])) { $backends = $appInfo['versions']; foreach($backends as $backend) { - $class = $backend['@value']; - $for = $backend['@attributes']['for']; - try { - $backendObject = $server->query($class); - $versionManager->registerBackend($for, $backendObject); - } catch (\Exception $e) { - $logger->logException($e); + if (isset($backend['@value'])) { + $this->loadBackend($backend); + } else { + foreach ($backend as $singleBackend) { + $this->loadBackend($singleBackend); + } } } } } } + + private function loadBackend(array $backend) { + $server = $this->getContainer()->getServer(); + $logger = $server->getLogger(); + /** @var IVersionManager $versionManager */ + $versionManager = $this->getContainer()->getServer()->query(IVersionManager::class); + $class = $backend['@value']; + $for = $backend['@attributes']['for']; + try { + $backendObject = $server->query($class); + $versionManager->registerBackend($for, $backendObject); + } catch (\Exception $e) { + $logger->logException($e); + } + } } |