aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorRichard Steinmetz <richard@steinmetz.cloud>2024-07-17 18:57:08 +0200
committerGitHub <noreply@github.com>2024-07-17 18:57:08 +0200
commit718ef5dea5288a13e9536fd9a611ff777ee7168d (patch)
tree952cef73e40bb468dd92d5d157f8a18fe603d447 /lib/private
parent7cb67c67c746d35f4762fb8e7a8ae40367a78fa5 (diff)
parente42bceac9fc5845ad3614d3254bbb270e0d9d847 (diff)
downloadnextcloud-server-718ef5dea5288a13e9536fd9a611ff777ee7168d.tar.gz
nextcloud-server-718ef5dea5288a13e9536fd9a611ff777ee7168d.zip
Merge pull request #46510 from nextcloud/feat/info-xml-backends
feat: hide caldav server settings if no app uses the caldav backend
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/App/AppManager.php12
-rw-r--r--lib/private/App/InfoParser.php10
2 files changed, 21 insertions, 1 deletions
diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php
index 52a88a724ff..2f129ca77fa 100644
--- a/lib/private/App/AppManager.php
+++ b/lib/private/App/AppManager.php
@@ -875,4 +875,16 @@ class AppManager implements IAppManager {
$this->config->setSystemValue('defaultapp', join(',', $defaultApps));
}
+
+ public function isBackendRequired(string $backend): bool {
+ foreach ($this->appInfos as $appInfo) {
+ foreach ($appInfo['dependencies']['backend'] as $appBackend) {
+ if ($backend === $appBackend) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
}
diff --git a/lib/private/App/InfoParser.php b/lib/private/App/InfoParser.php
index d29b1d6596d..54afd0069fb 100644
--- a/lib/private/App/InfoParser.php
+++ b/lib/private/App/InfoParser.php
@@ -113,6 +113,12 @@ class InfoParser {
if (!array_key_exists('personal-section', $array['settings'])) {
$array['settings']['personal-section'] = [];
}
+ if (!array_key_exists('dependencies', $array)) {
+ $array['dependencies'] = [];
+ }
+ if (!array_key_exists('backend', $array['dependencies'])) {
+ $array['dependencies']['backend'] = [];
+ }
if (array_key_exists('types', $array)) {
if (is_array($array['types'])) {
@@ -177,10 +183,12 @@ class InfoParser {
if (isset($array['settings']['personal-section']) && !is_array($array['settings']['personal-section'])) {
$array['settings']['personal-section'] = [$array['settings']['personal-section']];
}
-
if (isset($array['navigations']['navigation']) && $this->isNavigationItem($array['navigations']['navigation'])) {
$array['navigations']['navigation'] = [$array['navigations']['navigation']];
}
+ if (isset($array['dependencies']['backend']) && !is_array($array['dependencies']['backend'])) {
+ $array['dependencies']['backend'] = [$array['dependencies']['backend']];
+ }
if ($this->cache !== null) {
$this->cache->set($fileCacheKey, json_encode($array));