summaryrefslogtreecommitdiffstats
path: root/apps/files_versions
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2019-06-19 14:00:53 +0200
committerGitHub <noreply@github.com>2019-06-19 14:00:53 +0200
commit817bdc47c804ae8511ad3423eae216f6ccdee6c6 (patch)
tree077713c37d1747f46b49e101089691d54018ccee /apps/files_versions
parent94e4ce38cfa3ebde56f5a42b2cfd895cf66d1149 (diff)
parent5209cdccdbe926d31bafec0e284a0b19f3962625 (diff)
downloadnextcloud-server-817bdc47c804ae8511ad3423eae216f6ccdee6c6.tar.gz
nextcloud-server-817bdc47c804ae8511ad3423eae216f6ccdee6c6.zip
Merge pull request #15869 from nextcloud/multiple-version-backends
fix loading multiple version backends from one app
Diffstat (limited to 'apps/files_versions')
-rw-r--r--apps/files_versions/lib/AppInfo/Application.php31
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);
+ }
+ }
}