Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kesselberg <mail@danielkesselberg.de>2019-02-22 17:45:55 +0300
committerDaniel Kesselberg <mail@danielkesselberg.de>2019-02-22 17:57:14 +0300
commit36c51bc4f160d8b18de64739e9ffccccee8a5b25 (patch)
treea7ed5edf4aa085a8c36792993a7be8caffe681cb /lib/private
parent2083103d0ba8ce41489632ebe240f6dde51baccc (diff)
Parse multiple navigation items
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/App/InfoParser.php16
-rw-r--r--lib/private/NavigationManager.php4
2 files changed, 16 insertions, 4 deletions
diff --git a/lib/private/App/InfoParser.php b/lib/private/App/InfoParser.php
index e0ed63fc784..ef96156dfed 100644
--- a/lib/private/App/InfoParser.php
+++ b/lib/private/App/InfoParser.php
@@ -52,7 +52,7 @@ class InfoParser {
return null;
}
- if(!is_null($this->cache)) {
+ if ($this->cache !== null) {
$fileCacheKey = $file . filemtime($file);
if ($cachedValue = $this->cache->get($fileCacheKey)) {
return json_decode($cachedValue, true);
@@ -205,13 +205,25 @@ class InfoParser {
$array['settings']['personal-section'] = [$array['settings']['personal-section']];
}
- if(!is_null($this->cache)) {
+ if (isset($array['navigations']['navigation']) && $this->isNavigationItem($array['navigations']['navigation'])) {
+ $array['navigations']['navigation'] = [$array['navigations']['navigation']];
+ }
+
+ if ($this->cache !== null) {
$this->cache->set($fileCacheKey, json_encode($array));
}
return $array;
}
/**
+ * @param $data
+ * @return bool
+ */
+ private function isNavigationItem($data): bool {
+ return isset($data['name'], $data['route']);
+ }
+
+ /**
* @param \SimpleXMLElement $xml
* @return array
*/
diff --git a/lib/private/NavigationManager.php b/lib/private/NavigationManager.php
index 1874cd0e4ff..a1d3d252af1 100644
--- a/lib/private/NavigationManager.php
+++ b/lib/private/NavigationManager.php
@@ -271,10 +271,10 @@ class NavigationManager implements INavigationManager {
// load plugins and collections from info.xml
$info = $this->appManager->getAppInfo($app);
- if (empty($info['navigations'])) {
+ if (!isset($info['navigations']['navigation'])) {
continue;
}
- foreach ($info['navigations'] as $nav) {
+ foreach ($info['navigations']['navigation'] as $nav) {
if (!isset($nav['name'])) {
continue;
}