]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix and improve check of create group result 17896/head
authorArthur Schiwon <blizzz@arthur-schiwon.de>
Tue, 5 Nov 2019 15:17:24 +0000 (16:17 +0100)
committerArthur Schiwon <blizzz@arthur-schiwon.de>
Mon, 25 Nov 2019 13:01:25 +0000 (14:01 +0100)
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
core/Command/Group/Add.php

index 284cf7a3e9d704b0430cbb0c0b26bceb240f4e2e..4850ec9ce6cf01086567eecdde4f38dfaf549ca6 100644 (file)
@@ -25,6 +25,7 @@ declare(strict_types=1);
 namespace OC\Core\Command\Group;
 
 use OC\Core\Command\Base;
+use OCP\IGroup;
 use OCP\IGroupManager;
 use Symfony\Component\Console\Input\InputArgument;
 use Symfony\Component\Console\Input\InputInterface;
@@ -68,16 +69,17 @@ class Add extends Base {
                        return 1;
                } else {
                        $group = $this->groupManager->createGroup($gid);
-                       if($group === false) {
+                       if (!$group instanceof IGroup) {
                                $output->writeln('<error>Could not create group</error>');
                                return 2;
                        }
                        $output->writeln('Created group "' . $group->getGID() . '"');
 
-                       $displayName = trim((string) $input->getOption('display-name'));
+                       $displayName = trim((string)$input->getOption('display-name'));
                        if ($displayName !== '') {
                                $group->setDisplayName($displayName);
                        }
                }
+               return 0;
        }
 }