diff options
author | Andreas Fischer <bantu@owncloud.com> | 2015-05-06 14:18:38 +0200 |
---|---|---|
committer | Andreas Fischer <bantu@owncloud.com> | 2015-05-06 17:15:28 +0200 |
commit | e418ced656aa78d52c5d03206d16ef7e453d77f0 (patch) | |
tree | adac11fa5022a9b6976adc463a6fce3deb9b74f6 /lib | |
parent | 84960feee8f0ba5fba4c7ad9f822a80a7316f8f6 (diff) | |
download | nextcloud-server-e418ced656aa78d52c5d03206d16ef7e453d77f0.tar.gz nextcloud-server-e418ced656aa78d52c5d03206d16ef7e453d77f0.zip |
Check return value of OC_App::getAppPath() and verify info.xml exists.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/appframework/app.php | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/lib/private/appframework/app.php b/lib/private/appframework/app.php index ede97180fe2..f6c1e31cddd 100644 --- a/lib/private/appframework/app.php +++ b/lib/private/appframework/app.php @@ -49,19 +49,22 @@ class App { */ public static function buildAppNamespace($appId, $topNamespace='OCA\\') { // first try to parse the app's appinfo/info.xml <namespace> tag - $filePath = OC_App::getAppPath($appId) . '/appinfo/info.xml'; - $loadEntities = libxml_disable_entity_loader(false); - $xml = @simplexml_load_file($filePath); - libxml_disable_entity_loader($loadEntities); - - if ($xml) { - $result = $xml->xpath('/info/namespace'); - if ($result && count($result) > 0) { - // take first namespace result - return $topNamespace . trim((string) $result[0]); + $appPath = OC_App::getAppPath($appId); + if ($appPath !== false) { + $filePath = "$appPath/appinfo/info.xml"; + if (is_file($filePath)) { + $loadEntities = libxml_disable_entity_loader(false); + $xml = @simplexml_load_file($filePath); + libxml_disable_entity_loader($loadEntities); + if ($xml) { + $result = $xml->xpath('/info/namespace'); + if ($result && count($result) > 0) { + // take first namespace result + return $topNamespace . trim((string) $result[0]); + } + } } } - // if the tag is not found, fall back to uppercasing the first letter return $topNamespace . ucfirst($appId); } |