summaryrefslogtreecommitdiffstats
path: root/lib/private/Installer.php
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-05-15 00:03:35 -0500
committerMorris Jobke <hey@morrisjobke.de>2017-05-15 00:03:35 -0500
commitbe33234266db3cae8f2836c579be21b926aea162 (patch)
tree415e86ab01727dd9d0c183fefc3d361839d7be29 /lib/private/Installer.php
parent9ad57cabc8aeaaf0565001936233979426d41a6a (diff)
downloadnextcloud-server-be33234266db3cae8f2836c579be21b926aea162.tar.gz
nextcloud-server-be33234266db3cae8f2836c579be21b926aea162.zip
Remove OC_App:installApp
* uses Installer->installApp now * removes unused code * fixes #4453 * added some additional checks Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'lib/private/Installer.php')
-rw-r--r--lib/private/Installer.php28
1 files changed, 27 insertions, 1 deletions
diff --git a/lib/private/Installer.php b/lib/private/Installer.php
index 8702f264e54..35f51b19b07 100644
--- a/lib/private/Installer.php
+++ b/lib/private/Installer.php
@@ -98,7 +98,7 @@ class Installer {
*
* @param string $appId App to install
* @throws \Exception
- * @return integer
+ * @return string app ID
*/
public function installApp($appId) {
$app = \OC_App::findAppInDirectories($appId);
@@ -109,6 +109,29 @@ class Installer {
$basedir = $app['path'].'/'.$appId;
$info = OC_App::getAppInfo($basedir.'/appinfo/info.xml', true);
+ $l = \OC::$server->getL10N('core');
+
+ if(!is_array($info)) {
+ throw new \Exception(
+ $l->t('App "%s" cannot be installed because appinfo file cannot be read.',
+ [$info['name']]
+ )
+ );
+ }
+
+ $version = \OCP\Util::getVersion();
+ if (!\OC_App::isAppCompatible($version, $info)) {
+ throw new \Exception(
+ // TODO $l
+ $l->t('App "%s" cannot be installed because it is not compatible with this version of the server.',
+ [$info['name']]
+ )
+ );
+ }
+
+ // check for required dependencies
+ \OC_App::checkAppDependencies($this->config, $l, $info);
+
//install the database
if(is_file($basedir.'/appinfo/database.xml')) {
if (\OC::$server->getAppConfig()->getValue($info['id'], 'installed_version') === null) {
@@ -120,6 +143,9 @@ class Installer {
\OC_App::registerAutoloading($appId, $basedir);
\OC_App::setupBackgroundJobs($info['background-jobs']);
+ if(isset($info['settings']) && is_array($info['settings'])) {
+ \OC::$server->getSettingsManager()->setupSettings($info['settings']);
+ }
//run appinfo/install.php
if((!isset($data['noinstall']) or $data['noinstall']==false)) {