aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/App
diff options
context:
space:
mode:
authorRichard Steinmetz <richard@steinmetz.cloud>2024-07-13 16:51:16 +0200
committerRichard Steinmetz <richard@steinmetz.cloud>2024-07-16 09:18:33 +0200
commite42bceac9fc5845ad3614d3254bbb270e0d9d847 (patch)
tree53062f9f3ee11966417266a241c0f2800514c7ad /lib/private/App
parent70dd8d513bf73c8d56fea2aae4a02718a328f6e3 (diff)
downloadnextcloud-server-e42bceac9fc5845ad3614d3254bbb270e0d9d847.tar.gz
nextcloud-server-e42bceac9fc5845ad3614d3254bbb270e0d9d847.zip
feat: hide caldav server settings if no app uses the caldav backend
Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
Diffstat (limited to 'lib/private/App')
-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));