]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add install logic for enable command
authorDaniel Kesselberg <mail@danielkesselberg.de>
Sun, 27 Jan 2019 20:53:09 +0000 (21:53 +0100)
committerDaniel Kesselberg <mail@danielkesselberg.de>
Tue, 19 Feb 2019 20:03:06 +0000 (21:03 +0100)
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
build/integration/run.sh
core/Command/App/Enable.php
tests/Core/Command/Apps/AppsEnableTest.php

index e13a77c27beb702eae80d645efd44b566440bb36..fc6e35f078b4530c7d8611731a64162616e0c560 100755 (executable)
@@ -48,8 +48,6 @@ export TEST_SERVER_FED_URL="http://localhost:$PORT_FED/ocs/"
 if [ "$INSTALLED" == "true" ]; then
 
     #Enable external storage app
-    $OCC app:install --keep-disabled files_external
-    $OCC app:install --keep-disabled user_ldap
     $OCC app:enable files_external user_ldap
 
     mkdir -p work/local_storage
index c91e715e1fa2d4e3d1f4bb16f26c0d9de5adfe54..75833753170f756d09980d40c28283d3f49bd015 100644 (file)
@@ -26,6 +26,7 @@
 
 namespace OC\Core\Command\App;
 
+use OC\Installer;
 use OCP\App\AppPathNotFoundException;
 use OCP\App\IAppManager;
 use OCP\IGroup;
@@ -97,7 +98,17 @@ class Enable extends Command implements CompletionAwareInterface {
                        return $group->getDisplayName();
                }, $groupIds);
 
+
                try {
+                       /** @var Installer $installer */
+                       $installer = \OC::$server->query(Installer::class);
+
+                       if (false === $installer->isDownloaded($appId)) {
+                               $installer->downloadApp($appId);
+                       }
+
+                       $installer->installApp($appId);
+
                        if ($groupIds === []) {
                                $this->appManager->enableApp($appId);
                                $output->writeln($appId . ' enabled');
index 43f377c70a06cdd778bf0ac94bb8674318aab9a5..2d0ffd9f958d05b0ef3542dd2a25a6439b92b9ed 100644 (file)
@@ -74,10 +74,10 @@ class AppsEnableTest extends TestCase {
                return [
                        [['admin_audit'], null, 0, 'admin_audit enabled'],
                        [['comments'], null, 0, 'comments enabled'],
-                       [['invalid_app'], null, 1, 'invalid_app not found'],
+                       [['invalid_app'], null, 1, 'Could not download app invalid_app'],
 
                        [['admin_audit', 'comments'], null, 0, "admin_audit enabled\ncomments enabled"],
-                       [['admin_audit', 'comments', 'invalid_app'], null, 1, "admin_audit enabled\ncomments enabled\ninvalid_app not found"],
+                       [['admin_audit', 'comments', 'invalid_app'], null, 1, "admin_audit enabled\ncomments enabled\nCould not download app invalid_app"],
 
                        [['admin_audit'], ['admin'], 1, "admin_audit can't be enabled for groups"],
                        [['comments'], ['admin'], 1, "comments can't be enabled for groups"],
@@ -87,7 +87,7 @@ class AppsEnableTest extends TestCase {
 
                        [['updatenotification'], ['admin', 'invalid_group'], 0, 'updatenotification enabled for groups: admin'],
                        [['updatenotification', 'logreader'], ['admin', 'invalid_group'], 0, "updatenotification enabled for groups: admin\nlogreader enabled for groups: admin"],
-                       [['updatenotification', 'logreader', 'invalid_app'], ['admin', 'invalid_group'], 0, "updatenotification enabled for groups: admin\nlogreader enabled for groups: admin"],
+                       [['updatenotification', 'logreader', 'invalid_app'], ['admin', 'invalid_group'], 1, "updatenotification enabled for groups: admin\nlogreader enabled for groups: admin\nCould not download app invalid_app"],
                ];
        }
 }