diff options
author | Thomas Müller <DeepDiver1975@users.noreply.github.com> | 2016-09-23 21:47:47 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2016-10-07 20:58:22 +0200 |
commit | 67d3574bdfdc08ad5815b5034a7c2c2e35afb4c0 (patch) | |
tree | 422684c7cb62f1f0e6b709e9160d0073cbadc5ea /lib/private/App/InfoParser.php | |
parent | bccc4e618a58281f390b6baa88cc0b03b1e40172 (diff) | |
download | nextcloud-server-67d3574bdfdc08ad5815b5034a7c2c2e35afb4c0.tar.gz nextcloud-server-67d3574bdfdc08ad5815b5034a7c2c2e35afb4c0.zip |
Don't parse info.xml but reuse already cached app infos - fixes #25603 (#25968)
* Don't parse info.xml but reuse already cached app infos - fixes #25603
* Use === in InfoParser. Fixes test
* InfoParser should not depend on UrlGenerator - fixes issue with session being closed too early
Diffstat (limited to 'lib/private/App/InfoParser.php')
-rw-r--r-- | lib/private/App/InfoParser.php | 32 |
1 files changed, 4 insertions, 28 deletions
diff --git a/lib/private/App/InfoParser.php b/lib/private/App/InfoParser.php index e975ad6f096..3c14fe7c0cf 100644 --- a/lib/private/App/InfoParser.php +++ b/lib/private/App/InfoParser.php @@ -26,20 +26,8 @@ namespace OC\App; -use OCP\IURLGenerator; - class InfoParser { - /** @var IURLGenerator */ - private $urlGenerator; - - /** - * @param IURLGenerator $urlGenerator - */ - public function __construct(IURLGenerator $urlGenerator) { - $this->urlGenerator = $urlGenerator; - } - /** * @param string $file the xml file to be loaded * @return null|array where null is an indicator for an error @@ -52,15 +40,18 @@ class InfoParser { libxml_use_internal_errors(true); $loadEntities = libxml_disable_entity_loader(false); $xml = simplexml_load_file($file); + libxml_disable_entity_loader($loadEntities); - if ($xml == false) { + if ($xml === false) { libxml_clear_errors(); return null; } $array = $this->xmlToArray($xml); + if (is_null($array)) { return null; } + if (!array_key_exists('info', $array)) { $array['info'] = []; } @@ -98,17 +89,6 @@ class InfoParser { $array['two-factor-providers'] = []; } - if (array_key_exists('documentation', $array) && is_array($array['documentation'])) { - foreach ($array['documentation'] as $key => $url) { - // If it is not an absolute URL we assume it is a key - // i.e. admin-ldap will get converted to go.php?to=admin-ldap - if (!$this->isHTTPURL($url)) { - $url = $this->urlGenerator->linkToDocs($url); - } - - $array['documentation'][$key] = $url; - } - } if (array_key_exists('types', $array)) { if (is_array($array['types'])) { foreach ($array['types'] as $type => $v) { @@ -193,8 +173,4 @@ class InfoParser { return $array; } - - private function isHTTPURL($url) { - return stripos($url, 'https://') === 0 || stripos($url, 'http://') === 0; - } } |