diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-11-24 16:24:26 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-11-25 11:53:28 +0100 |
commit | c503ecd54495167f97b6602e5b41c1cf95467395 (patch) | |
tree | f0d8dfa42dda7c4d8c2e5e64d8ec19204c7fc24e /lib/private/app.php | |
parent | 6fb2477fb75d4c982a1568e2392d17fd7cc2fd4b (diff) | |
download | nextcloud-server-c503ecd54495167f97b6602e5b41c1cf95467395.tar.gz nextcloud-server-c503ecd54495167f97b6602e5b41c1cf95467395.zip |
Introduce app info xml parser including basic unit test - necessary for #10777
Diffstat (limited to 'lib/private/app.php')
-rw-r--r-- | lib/private/app.php | 59 |
1 files changed, 3 insertions, 56 deletions
diff --git a/lib/private/app.php b/lib/private/app.php index bc9ca0351ea..8e36d43bfb1 100644 --- a/lib/private/app.php +++ b/lib/private/app.php @@ -635,63 +635,10 @@ class OC_App { } $file = self::getAppPath($appId) . '/appinfo/info.xml'; } - $data = array(); - if (!file_exists($file)) { - return null; - } - $content = @file_get_contents($file); - if (!$content) { - return null; - } - $xml = new SimpleXMLElement($content); - $data['info'] = array(); - $data['remote'] = array(); - $data['public'] = array(); - foreach ($xml->children() as $child) { - /** - * @var $child SimpleXMLElement - */ - if ($child->getName() == 'remote') { - foreach ($child->children() as $remote) { - /** - * @var $remote SimpleXMLElement - */ - $data['remote'][$remote->getName()] = (string)$remote; - } - } elseif ($child->getName() == 'public') { - foreach ($child->children() as $public) { - /** - * @var $public SimpleXMLElement - */ - $data['public'][$public->getName()] = (string)$public; - } - } elseif ($child->getName() == 'types') { - $data['types'] = array(); - foreach ($child->children() as $type) { - /** - * @var $type SimpleXMLElement - */ - $data['types'][] = $type->getName(); - } - } elseif ($child->getName() == 'description') { - $xml = (string)$child->asXML(); - $data[$child->getName()] = substr($xml, 13, -14); //script <description> tags - } elseif ($child->getName() == 'documentation') { - foreach ($child as $subChild) { - $url = (string) $subChild; - - // 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(!\OC::$server->getHTTPHelper()->isHTTPURL($url)) { - $url = OC_Helper::linkToDocs($url); - } - $data["documentation"][$subChild->getName()] = $url; - } - } else { - $data[$child->getName()] = (string)$child; - } - } + $parser = new \OC\App\InfoParser(\OC::$server->getHTTPHelper(), \OC::$server->getURLGenerator()); + $data = $parser->parse($file); + self::$appInfo[$appId] = $data; return $data; |