diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-02-15 16:58:37 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-02-15 16:58:37 +0100 |
commit | 3ab328350a5b56e0554473789f8351e143db3690 (patch) | |
tree | 2760d78e679ac894b51bb166623570a48dc9b50d | |
parent | 46b39c3465e2db9ba26b23d8d0dfca6cc670aaea (diff) | |
parent | ef49f6ef5de3cd5321083a5be392caee1b6e6cdc (diff) | |
download | nextcloud-server-3ab328350a5b56e0554473789f8351e143db3690.tar.gz nextcloud-server-3ab328350a5b56e0554473789f8351e143db3690.zip |
Merge pull request #22376 from owncloud/fix-return-code-getAppPath
Properly handle return code of OC_App::getAppPath
-rw-r--r-- | lib/private/app.php | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/lib/private/app.php b/lib/private/app.php index 56422f2305c..49d4e942a09 100644 --- a/lib/private/app.php +++ b/lib/private/app.php @@ -132,8 +132,12 @@ class OC_App { */ public static function loadApp($app, $checkUpgrade = true) { self::$loadedApps[] = $app; - \OC::$loader->addValidRoot(self::getAppPath($app)); // in case someone calls loadApp() directly - if (is_file(self::getAppPath($app) . '/appinfo/app.php')) { + $appPath = self::getAppPath($app); + if($appPath === false) { + return; + } + \OC::$loader->addValidRoot($appPath); // in case someone calls loadApp() directly + if (is_file($appPath . '/appinfo/app.php')) { \OC::$server->getEventLogger()->start('load_app_' . $app, 'Load app: ' . $app); if ($checkUpgrade and self::shouldUpgrade($app)) { throw new \OC\NeedsUpdateException(); @@ -605,7 +609,11 @@ class OC_App { if (isset(self::$appInfo[$appId])) { return self::$appInfo[$appId]; } - $file = self::getAppPath($appId) . '/appinfo/info.xml'; + $appPath = self::getAppPath($appId); + if($appPath === false) { + return null; + } + $file = $appPath . '/appinfo/info.xml'; } $parser = new \OC\App\InfoParser(\OC::$server->getHTTPHelper(), \OC::$server->getURLGenerator()); @@ -806,15 +814,18 @@ class OC_App { $info['update'] = ($includeUpdateInfo) ? OC_Installer::isUpdateAvailable($app) : null; - $appIcon = self::getAppPath($app) . '/img/' . $app . '.svg'; - if (file_exists($appIcon)) { - $info['preview'] = \OC::$server->getURLGenerator()->imagePath($app, $app . '.svg'); - $info['previewAsIcon'] = true; - } else { - $appIcon = self::getAppPath($app) . '/img/app.svg'; + $appPath = self::getAppPath($app); + if($appPath !== false) { + $appIcon = $appPath . '/img/' . $app . '.svg'; if (file_exists($appIcon)) { - $info['preview'] = \OC::$server->getURLGenerator()->imagePath($app, 'app.svg'); + $info['preview'] = \OC::$server->getURLGenerator()->imagePath($app, $app . '.svg'); $info['previewAsIcon'] = true; + } else { + $appIcon = $appPath . '/img/app.svg'; + if (file_exists($appIcon)) { + $info['preview'] = \OC::$server->getURLGenerator()->imagePath($app, 'app.svg'); + $info['previewAsIcon'] = true; + } } } $info['version'] = OC_App::getAppVersion($app); @@ -1111,14 +1122,18 @@ class OC_App { * @return bool */ public static function updateApp($appId) { - if (file_exists(self::getAppPath($appId) . '/appinfo/database.xml')) { - OC_DB::updateDbFromStructure(self::getAppPath($appId) . '/appinfo/database.xml'); + $appPath = self::getAppPath($appId); + if($appPath === false) { + return false; + } + if (file_exists($appPath . '/appinfo/database.xml')) { + OC_DB::updateDbFromStructure($appPath . '/appinfo/database.xml'); } unset(self::$appVersion[$appId]); // run upgrade code - if (file_exists(self::getAppPath($appId) . '/appinfo/update.php')) { + if (file_exists($appPath . '/appinfo/update.php')) { self::loadApp($appId, false); - include self::getAppPath($appId) . '/appinfo/update.php'; + include $appPath . '/appinfo/update.php'; } //set remote/public handlers |