diff options
author | Julius Härtl <jus@bitgrid.net> | 2018-05-23 19:51:22 +0200 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2018-06-06 11:40:09 +0200 |
commit | d7b928fd9b688079f175e596f06f16199dfd0309 (patch) | |
tree | ca5eda83076873214c8990fceee275174dad662d /settings | |
parent | eccc391bdac3d900bb95ba3d5304ad9e61af629b (diff) | |
download | nextcloud-server-d7b928fd9b688079f175e596f06f16199dfd0309.tar.gz nextcloud-server-d7b928fd9b688079f175e596f06f16199dfd0309.zip |
Add install/remove to the new controller methods
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'settings')
-rw-r--r-- | settings/Controller/AppSettingsController.php | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/settings/Controller/AppSettingsController.php b/settings/Controller/AppSettingsController.php index 8e72b5ab2db..5aaee1871db 100644 --- a/settings/Controller/AppSettingsController.php +++ b/settings/Controller/AppSettingsController.php @@ -521,6 +521,18 @@ class AppSettingsController extends Controller { foreach ($appIds as $appId) { $appId = OC_App::cleanAppId($appId); + + // Check if app is already downloaded + /** @var Installer $installer */ + $installer = \OC::$server->query(Installer::class); + $isDownloaded = $installer->isDownloaded($appId); + + if(!$isDownloaded) { + $installer->downloadApp($appId); + } + + $installer->installApp($appId); + if (count($groups) > 0) { $this->appManager->enableAppForGroups($appId, $this->getGroupList($groups)); } else { @@ -575,7 +587,9 @@ class AppSettingsController extends Controller { */ public function uninstallApp(string $appId): JSONResponse { $appId = OC_App::cleanAppId($appId); - $result = OC_App::removeApp($appId); + /** @var Installer $installer */ + $installer = \OC::$server->query(\OC\Installer::class); + $result = $installer->removeApp($appId); if($result !== false) { // FIXME: Clear the cache - move that into some sane helper method \OC::$server->getMemCacheFactory()->createDistributed('settings')->remove('listApps-0'); |