Add install/remove to the new controller methods
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
parent
eccc391bda
commit
d7b928fd9b
1 changed files with 15 additions and 1 deletions
|
@ -521,6 +521,18 @@ class AppSettingsController extends Controller {
|
||||||
|
|
||||||
foreach ($appIds as $appId) {
|
foreach ($appIds as $appId) {
|
||||||
$appId = OC_App::cleanAppId($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) {
|
if (count($groups) > 0) {
|
||||||
$this->appManager->enableAppForGroups($appId, $this->getGroupList($groups));
|
$this->appManager->enableAppForGroups($appId, $this->getGroupList($groups));
|
||||||
} else {
|
} else {
|
||||||
|
@ -575,7 +587,9 @@ class AppSettingsController extends Controller {
|
||||||
*/
|
*/
|
||||||
public function uninstallApp(string $appId): JSONResponse {
|
public function uninstallApp(string $appId): JSONResponse {
|
||||||
$appId = OC_App::cleanAppId($appId);
|
$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) {
|
if($result !== false) {
|
||||||
// FIXME: Clear the cache - move that into some sane helper method
|
// FIXME: Clear the cache - move that into some sane helper method
|
||||||
\OC::$server->getMemCacheFactory()->createDistributed('settings')->remove('listApps-0');
|
\OC::$server->getMemCacheFactory()->createDistributed('settings')->remove('listApps-0');
|
||||||
|
|
Loading…
Reference in a new issue