diff options
author | Morris Jobke <hey@morrisjobke.de> | 2016-10-24 21:26:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-24 21:26:50 +0200 |
commit | 567e28b01a4d852aeeec8f8b27fe1a34fde841ae (patch) | |
tree | 9212d5f7205c94e0adfb7dd1464c56f8d1f1eb56 /lib/private/legacy | |
parent | 72b5206c44826ba4604a71a2c53d58562fd0a49e (diff) | |
parent | 03ec052b4edd12d01cc4014e1145d59d2a4426f9 (diff) | |
download | nextcloud-server-567e28b01a4d852aeeec8f8b27fe1a34fde841ae.tar.gz nextcloud-server-567e28b01a4d852aeeec8f8b27fe1a34fde841ae.zip |
Merge pull request #1885 from nextcloud/downstream-26295
App dependencies are now analysed on app enable as well - not only on…
Diffstat (limited to 'lib/private/legacy')
-rw-r--r-- | lib/private/legacy/app.php | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php index 5e05884f5c0..d25534aa822 100644 --- a/lib/private/legacy/app.php +++ b/lib/private/legacy/app.php @@ -334,9 +334,16 @@ class OC_App { * This function set an app as enabled in appconfig. */ public static function enable($app, $groups = null) { - self::$enabledAppsCache = array(); // flush + self::$enabledAppsCache = []; // flush if (!Installer::isInstalled($app)) { $app = self::installApp($app); + } else { + // check for required dependencies + $config = \OC::$server->getConfig(); + $l = \OC::$server->getL10N('core'); + $info = self::getAppInfo($app); + + self::checkAppDependencies($config, $l, $info); } $appManager = \OC::$server->getAppManager(); @@ -1186,16 +1193,7 @@ class OC_App { } // check for required dependencies - $dependencyAnalyzer = new DependencyAnalyzer(new Platform($config), $l); - $missing = $dependencyAnalyzer->analyze($info); - if (!empty($missing)) { - $missingMsg = join(PHP_EOL, $missing); - throw new \Exception( - $l->t('App "%s" cannot be installed because the following dependencies are not fulfilled: %s', - array($info['name'], $missingMsg) - ) - ); - } + self::checkAppDependencies($config, $l, $info); $config->setAppValue($app, 'enabled', 'yes'); if (isset($appData['id'])) { @@ -1438,4 +1436,23 @@ class OC_App { return $data; } + + /** + * @param $config + * @param $l + * @param $info + * @throws Exception + */ + protected static function checkAppDependencies($config, $l, $info) { + $dependencyAnalyzer = new DependencyAnalyzer(new Platform($config), $l); + $missing = $dependencyAnalyzer->analyze($info); + if (!empty($missing)) { + $missingMsg = join(PHP_EOL, $missing); + throw new \Exception( + $l->t('App "%s" cannot be installed because the following dependencies are not fulfilled: %s', + [$info['name'], $missingMsg] + ) + ); + } + } } |