summaryrefslogtreecommitdiffstats
path: root/lib/private/app.php
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-12-11 17:02:07 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2014-12-11 17:02:07 +0100
commitd94c1731d7887fa15156cec94916d71ee763d9d0 (patch)
tree09de736a333570da695aeefd5562bbd62f441e37 /lib/private/app.php
parentf1d17141133efa267ed5b30f01a4117162b76ce6 (diff)
downloadnextcloud-server-d94c1731d7887fa15156cec94916d71ee763d9d0.tar.gz
nextcloud-server-d94c1731d7887fa15156cec94916d71ee763d9d0.zip
check app dependencies on installation as well
Diffstat (limited to 'lib/private/app.php')
-rw-r--r--lib/private/app.php27
1 files changed, 21 insertions, 6 deletions
diff --git a/lib/private/app.php b/lib/private/app.php
index 86db8fd9f55..c84e9c5e981 100644
--- a/lib/private/app.php
+++ b/lib/private/app.php
@@ -25,6 +25,8 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
+use OC\App\DependencyAnalyzer;
+use OC\App\Platform;
/**
* This class manages the apps. It allows them to register and integrate in the
@@ -1082,6 +1084,7 @@ class OC_App {
*/
public static function installApp($app) {
$l = \OC::$server->getL10N('core');
+ $config = \OC::$server->getConfig();
$appData=OC_OCSClient::getApplication($app);
// check if app is a shipped app or not. OCS apps have an integer as id, shipped apps use a string
@@ -1106,13 +1109,25 @@ class OC_App {
array($info['name'])
)
);
- }else{
- OC_Appconfig::setValue( $app, 'enabled', 'yes' );
- if(isset($appData['id'])) {
- OC_Appconfig::setValue( $app, 'ocsid', $appData['id'] );
- }
- \OC_Hook::emit('OC_App', 'post_enable', array('app' => $app));
}
+
+ // check for required dependencies
+ $dependencyAnalyzer = new DependencyAnalyzer($app, new Platform($config), $l);
+ $missing = $dependencyAnalyzer->analyze();
+ 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)
+ )
+ );
+ }
+
+ $config->setAppValue($app, 'enabled', 'yes');
+ if(isset($appData['id'])) {
+ $config->setAppValue($app, 'ocsid', $appData['id'] );
+ }
+ \OC_Hook::emit('OC_App', 'post_enable', array('app' => $app));
}else{
throw new \Exception($l->t("No app name specified"));
}