Merge pull request #16119 from owncloud/fix-16056
[HHVM] Throw RunTimeException from OC\AppFramework\App::buildAppNamespace()
This commit is contained in:
commit
55eaa165f8
1 changed files with 14 additions and 11 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue