Passed
Push — master ( 078203...c81798 )
by Joas
14:40 queued 14s
created
apps/dav/lib/Command/RemoveInvalidShares.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -38,50 +38,50 @@
 block discarded – undo
38 38
  */
39 39
 class RemoveInvalidShares extends Command {
40 40
 
41
-	/** @var IDBConnection */
42
-	private $connection;
43
-	/** @var Principal */
44
-	private $principalBackend;
41
+    /** @var IDBConnection */
42
+    private $connection;
43
+    /** @var Principal */
44
+    private $principalBackend;
45 45
 
46
-	public function __construct(IDBConnection $connection,
47
-								Principal $principalBackend) {
48
-		parent::__construct();
46
+    public function __construct(IDBConnection $connection,
47
+                                Principal $principalBackend) {
48
+        parent::__construct();
49 49
 
50
-		$this->connection = $connection;
51
-		$this->principalBackend = $principalBackend;
52
-	}
50
+        $this->connection = $connection;
51
+        $this->principalBackend = $principalBackend;
52
+    }
53 53
 
54
-	protected function configure() {
55
-		$this
56
-			->setName('dav:remove-invalid-shares')
57
-			->setDescription('Remove invalid dav shares');
58
-	}
54
+    protected function configure() {
55
+        $this
56
+            ->setName('dav:remove-invalid-shares')
57
+            ->setDescription('Remove invalid dav shares');
58
+    }
59 59
 
60
-	protected function execute(InputInterface $input, OutputInterface $output): int {
61
-		$query = $this->connection->getQueryBuilder();
62
-		$result = $query->selectDistinct('principaluri')
63
-			->from('dav_shares')
64
-			->execute();
60
+    protected function execute(InputInterface $input, OutputInterface $output): int {
61
+        $query = $this->connection->getQueryBuilder();
62
+        $result = $query->selectDistinct('principaluri')
63
+            ->from('dav_shares')
64
+            ->execute();
65 65
 
66
-		while ($row = $result->fetch()) {
67
-			$principaluri = $row['principaluri'];
68
-			$p = $this->principalBackend->getPrincipalByPath($principaluri);
69
-			if ($p === null) {
70
-				$this->deleteSharesForPrincipal($principaluri);
71
-			}
72
-		}
66
+        while ($row = $result->fetch()) {
67
+            $principaluri = $row['principaluri'];
68
+            $p = $this->principalBackend->getPrincipalByPath($principaluri);
69
+            if ($p === null) {
70
+                $this->deleteSharesForPrincipal($principaluri);
71
+            }
72
+        }
73 73
 
74
-		$result->closeCursor();
75
-		return 0;
76
-	}
74
+        $result->closeCursor();
75
+        return 0;
76
+    }
77 77
 
78
-	/**
79
-	 * @param string $principaluri
80
-	 */
81
-	private function deleteSharesForPrincipal($principaluri) {
82
-		$delete = $this->connection->getQueryBuilder();
83
-		$delete->delete('dav_shares')
84
-			->where($delete->expr()->eq('principaluri', $delete->createNamedParameter($principaluri)));
85
-		$delete->execute();
86
-	}
78
+    /**
79
+     * @param string $principaluri
80
+     */
81
+    private function deleteSharesForPrincipal($principaluri) {
82
+        $delete = $this->connection->getQueryBuilder();
83
+        $delete->delete('dav_shares')
84
+            ->where($delete->expr()->eq('principaluri', $delete->createNamedParameter($principaluri)));
85
+        $delete->execute();
86
+    }
87 87
 }
Please login to merge, or discard this patch.
apps/dav/lib/Command/SendEventReminders.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -37,50 +37,50 @@
 block discarded – undo
37 37
  */
38 38
 class SendEventReminders extends Command {
39 39
 
40
-	/** @var ReminderService */
41
-	protected $reminderService;
40
+    /** @var ReminderService */
41
+    protected $reminderService;
42 42
 
43
-	/** @var IConfig */
44
-	protected $config;
43
+    /** @var IConfig */
44
+    protected $config;
45 45
 
46
-	/**
47
-	 * @param ReminderService $reminderService
48
-	 * @param IConfig $config
49
-	 */
50
-	public function __construct(ReminderService $reminderService,
51
-								IConfig $config) {
52
-		parent::__construct();
53
-		$this->reminderService = $reminderService;
54
-		$this->config = $config;
55
-	}
46
+    /**
47
+     * @param ReminderService $reminderService
48
+     * @param IConfig $config
49
+     */
50
+    public function __construct(ReminderService $reminderService,
51
+                                IConfig $config) {
52
+        parent::__construct();
53
+        $this->reminderService = $reminderService;
54
+        $this->config = $config;
55
+    }
56 56
 
57
-	/**
58
-	 * @inheritDoc
59
-	 */
60
-	protected function configure():void {
61
-		$this
62
-			->setName('dav:send-event-reminders')
63
-			->setDescription('Sends event reminders');
64
-	}
57
+    /**
58
+     * @inheritDoc
59
+     */
60
+    protected function configure():void {
61
+        $this
62
+            ->setName('dav:send-event-reminders')
63
+            ->setDescription('Sends event reminders');
64
+    }
65 65
 
66
-	/**
67
-	 * @param InputInterface $input
68
-	 * @param OutputInterface $output
69
-	 */
70
-	protected function execute(InputInterface $input, OutputInterface $output): int {
71
-		if ($this->config->getAppValue('dav', 'sendEventReminders', 'yes') !== 'yes') {
72
-			$output->writeln('<error>Sending event reminders disabled!</error>');
73
-			$output->writeln('<info>Please run "php occ config:app:set dav sendEventReminders --value yes"');
74
-			return 1;
75
-		}
66
+    /**
67
+     * @param InputInterface $input
68
+     * @param OutputInterface $output
69
+     */
70
+    protected function execute(InputInterface $input, OutputInterface $output): int {
71
+        if ($this->config->getAppValue('dav', 'sendEventReminders', 'yes') !== 'yes') {
72
+            $output->writeln('<error>Sending event reminders disabled!</error>');
73
+            $output->writeln('<info>Please run "php occ config:app:set dav sendEventReminders --value yes"');
74
+            return 1;
75
+        }
76 76
 
77
-		if ($this->config->getAppValue('dav', 'sendEventRemindersMode', 'backgroundjob') !== 'occ') {
78
-			$output->writeln('<error>Sending event reminders mode set to background-job!</error>');
79
-			$output->writeln('<info>Please run "php occ config:app:set dav sendEventRemindersMode --value occ"');
80
-			return 1;
81
-		}
77
+        if ($this->config->getAppValue('dav', 'sendEventRemindersMode', 'backgroundjob') !== 'occ') {
78
+            $output->writeln('<error>Sending event reminders mode set to background-job!</error>');
79
+            $output->writeln('<info>Please run "php occ config:app:set dav sendEventRemindersMode --value occ"');
80
+            return 1;
81
+        }
82 82
 
83
-		$this->reminderService->processReminders();
84
-		return 0;
85
-	}
83
+        $this->reminderService->processReminders();
84
+        return 0;
85
+    }
86 86
 }
Please login to merge, or discard this patch.
apps/dav/lib/Command/ListCalendars.php 1 patch
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -37,70 +37,70 @@
 block discarded – undo
37 37
 
38 38
 class ListCalendars extends Command {
39 39
 
40
-	/** @var IUserManager */
41
-	protected $userManager;
40
+    /** @var IUserManager */
41
+    protected $userManager;
42 42
 
43
-	/** @var CalDavBackend */
44
-	private $caldav;
43
+    /** @var CalDavBackend */
44
+    private $caldav;
45 45
 
46
-	/**
47
-	 * @param IUserManager $userManager
48
-	 * @param CalDavBackend $caldav
49
-	 */
50
-	public function __construct(IUserManager $userManager, CalDavBackend $caldav) {
51
-		parent::__construct();
52
-		$this->userManager = $userManager;
53
-		$this->caldav = $caldav;
54
-	}
46
+    /**
47
+     * @param IUserManager $userManager
48
+     * @param CalDavBackend $caldav
49
+     */
50
+    public function __construct(IUserManager $userManager, CalDavBackend $caldav) {
51
+        parent::__construct();
52
+        $this->userManager = $userManager;
53
+        $this->caldav = $caldav;
54
+    }
55 55
 
56
-	protected function configure() {
57
-		$this
58
-			->setName('dav:list-calendars')
59
-			->setDescription('List all calendars of a user')
60
-			->addArgument('uid',
61
-				InputArgument::REQUIRED,
62
-				'User for whom all calendars will be listed');
63
-	}
56
+    protected function configure() {
57
+        $this
58
+            ->setName('dav:list-calendars')
59
+            ->setDescription('List all calendars of a user')
60
+            ->addArgument('uid',
61
+                InputArgument::REQUIRED,
62
+                'User for whom all calendars will be listed');
63
+    }
64 64
 
65
-	protected function execute(InputInterface $input, OutputInterface $output): int {
66
-		$user = $input->getArgument('uid');
67
-		if (!$this->userManager->userExists($user)) {
68
-			throw new \InvalidArgumentException("User <$user> is unknown.");
69
-		}
65
+    protected function execute(InputInterface $input, OutputInterface $output): int {
66
+        $user = $input->getArgument('uid');
67
+        if (!$this->userManager->userExists($user)) {
68
+            throw new \InvalidArgumentException("User <$user> is unknown.");
69
+        }
70 70
 
71
-		$calendars = $this->caldav->getCalendarsForUser("principals/users/$user");
71
+        $calendars = $this->caldav->getCalendarsForUser("principals/users/$user");
72 72
 
73
-		$calendarTableData = [];
74
-		foreach ($calendars as $calendar) {
75
-			// skip birthday calendar
76
-			if ($calendar['uri'] === BirthdayService::BIRTHDAY_CALENDAR_URI) {
77
-				continue;
78
-			}
73
+        $calendarTableData = [];
74
+        foreach ($calendars as $calendar) {
75
+            // skip birthday calendar
76
+            if ($calendar['uri'] === BirthdayService::BIRTHDAY_CALENDAR_URI) {
77
+                continue;
78
+            }
79 79
 
80
-			$readOnly = false;
81
-			$readOnlyIndex = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only';
82
-			if (isset($calendar[$readOnlyIndex])) {
83
-				$readOnly = $calendar[$readOnlyIndex];
84
-			}
80
+            $readOnly = false;
81
+            $readOnlyIndex = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only';
82
+            if (isset($calendar[$readOnlyIndex])) {
83
+                $readOnly = $calendar[$readOnlyIndex];
84
+            }
85 85
 
86
-			$calendarTableData[] = [
87
-				$calendar['uri'],
88
-				$calendar['{DAV:}displayname'],
89
-				$calendar['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'],
90
-				$calendar['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'],
91
-				$readOnly ? ' x ' : ' ✓ ',
92
-			];
93
-		}
86
+            $calendarTableData[] = [
87
+                $calendar['uri'],
88
+                $calendar['{DAV:}displayname'],
89
+                $calendar['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'],
90
+                $calendar['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'],
91
+                $readOnly ? ' x ' : ' ✓ ',
92
+            ];
93
+        }
94 94
 
95
-		if (count($calendarTableData) > 0) {
96
-			$table = new Table($output);
97
-			$table->setHeaders(['uri', 'displayname', 'owner\'s userid', 'owner\'s displayname', 'writable'])
98
-				->setRows($calendarTableData);
95
+        if (count($calendarTableData) > 0) {
96
+            $table = new Table($output);
97
+            $table->setHeaders(['uri', 'displayname', 'owner\'s userid', 'owner\'s displayname', 'writable'])
98
+                ->setRows($calendarTableData);
99 99
 
100
-			$table->render();
101
-		} else {
102
-			$output->writeln("<info>User <$user> has no calendars</info>");
103
-		}
104
-		return 0;
105
-	}
100
+            $table->render();
101
+        } else {
102
+            $output->writeln("<info>User <$user> has no calendars</info>");
103
+        }
104
+        return 0;
105
+    }
106 106
 }
Please login to merge, or discard this patch.
apps/dav/lib/Command/CreateAddressBook.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -34,44 +34,44 @@
 block discarded – undo
34 34
 
35 35
 class CreateAddressBook extends Command {
36 36
 
37
-	/** @var IUserManager */
38
-	private $userManager;
37
+    /** @var IUserManager */
38
+    private $userManager;
39 39
 
40
-	/** @var CardDavBackend */
41
-	private $cardDavBackend;
40
+    /** @var CardDavBackend */
41
+    private $cardDavBackend;
42 42
 
43
-	/**
44
-	 * @param IUserManager $userManager
45
-	 * @param CardDavBackend $cardDavBackend
46
-	 */
47
-	public function __construct(IUserManager $userManager,
48
-						 CardDavBackend $cardDavBackend
49
-	) {
50
-		parent::__construct();
51
-		$this->userManager = $userManager;
52
-		$this->cardDavBackend = $cardDavBackend;
53
-	}
43
+    /**
44
+     * @param IUserManager $userManager
45
+     * @param CardDavBackend $cardDavBackend
46
+     */
47
+    public function __construct(IUserManager $userManager,
48
+                            CardDavBackend $cardDavBackend
49
+    ) {
50
+        parent::__construct();
51
+        $this->userManager = $userManager;
52
+        $this->cardDavBackend = $cardDavBackend;
53
+    }
54 54
 
55
-	protected function configure() {
56
-		$this
57
-				->setName('dav:create-addressbook')
58
-				->setDescription('Create a dav addressbook')
59
-				->addArgument('user',
60
-						InputArgument::REQUIRED,
61
-						'User for whom the addressbook will be created')
62
-				->addArgument('name',
63
-						InputArgument::REQUIRED,
64
-						'Name of the addressbook');
65
-	}
55
+    protected function configure() {
56
+        $this
57
+                ->setName('dav:create-addressbook')
58
+                ->setDescription('Create a dav addressbook')
59
+                ->addArgument('user',
60
+                        InputArgument::REQUIRED,
61
+                        'User for whom the addressbook will be created')
62
+                ->addArgument('name',
63
+                        InputArgument::REQUIRED,
64
+                        'Name of the addressbook');
65
+    }
66 66
 
67
-	protected function execute(InputInterface $input, OutputInterface $output): int {
68
-		$user = $input->getArgument('user');
69
-		if (!$this->userManager->userExists($user)) {
70
-			throw new \InvalidArgumentException("User <$user> in unknown.");
71
-		}
67
+    protected function execute(InputInterface $input, OutputInterface $output): int {
68
+        $user = $input->getArgument('user');
69
+        if (!$this->userManager->userExists($user)) {
70
+            throw new \InvalidArgumentException("User <$user> in unknown.");
71
+        }
72 72
 
73
-		$name = $input->getArgument('name');
74
-		$this->cardDavBackend->createAddressBook("principals/users/$user", $name, []);
75
-		return 0;
76
-	}
73
+        $name = $input->getArgument('name');
74
+        $this->cardDavBackend->createAddressBook("principals/users/$user", $name, []);
75
+        return 0;
76
+    }
77 77
 }
Please login to merge, or discard this patch.
apps/dav/lib/Command/SyncBirthdayCalendar.php 1 patch
Indentation   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -38,87 +38,87 @@
 block discarded – undo
38 38
 
39 39
 class SyncBirthdayCalendar extends Command {
40 40
 
41
-	/** @var BirthdayService */
42
-	private $birthdayService;
43
-
44
-	/** @var IConfig */
45
-	private $config;
46
-
47
-	/** @var IUserManager */
48
-	private $userManager;
49
-
50
-	/**
51
-	 * @param IUserManager $userManager
52
-	 * @param IConfig $config
53
-	 * @param BirthdayService $birthdayService
54
-	 */
55
-	public function __construct(IUserManager $userManager, IConfig $config,
56
-						 BirthdayService $birthdayService) {
57
-		parent::__construct();
58
-		$this->birthdayService = $birthdayService;
59
-		$this->config = $config;
60
-		$this->userManager = $userManager;
61
-	}
62
-
63
-	protected function configure() {
64
-		$this
65
-			->setName('dav:sync-birthday-calendar')
66
-			->setDescription('Synchronizes the birthday calendar')
67
-			->addArgument('user',
68
-				InputArgument::OPTIONAL,
69
-				'User for whom the birthday calendar will be synchronized');
70
-	}
71
-
72
-	/**
73
-	 * @param InputInterface $input
74
-	 * @param OutputInterface $output
75
-	 */
76
-	protected function execute(InputInterface $input, OutputInterface $output): int {
77
-		$this->verifyEnabled();
78
-
79
-		$user = $input->getArgument('user');
80
-		if (!is_null($user)) {
81
-			if (!$this->userManager->userExists($user)) {
82
-				throw new \InvalidArgumentException("User <$user> in unknown.");
83
-			}
84
-
85
-			// re-enable the birthday calendar in case it's called directly with a user name
86
-			$isEnabled = $this->config->getUserValue($user, 'dav', 'generateBirthdayCalendar', 'yes');
87
-			if ($isEnabled !== 'yes') {
88
-				$this->config->setUserValue($user, 'dav', 'generateBirthdayCalendar', 'yes');
89
-				$output->writeln("Re-enabling birthday calendar for $user");
90
-			}
91
-
92
-			$output->writeln("Start birthday calendar sync for $user");
93
-			$this->birthdayService->syncUser($user);
94
-			return 0;
95
-		}
96
-		$output->writeln("Start birthday calendar sync for all users ...");
97
-		$p = new ProgressBar($output);
98
-		$p->start();
99
-		$this->userManager->callForSeenUsers(function ($user) use ($p) {
100
-			$p->advance();
101
-
102
-			$userId = $user->getUID();
103
-			$isEnabled = $this->config->getUserValue($userId, 'dav', 'generateBirthdayCalendar', 'yes');
104
-			if ($isEnabled !== 'yes') {
105
-				return;
106
-			}
107
-
108
-			/** @var IUser $user */
109
-			$this->birthdayService->syncUser($user->getUID());
110
-		});
111
-
112
-		$p->finish();
113
-		$output->writeln('');
114
-		return 0;
115
-	}
116
-
117
-	protected function verifyEnabled() {
118
-		$isEnabled = $this->config->getAppValue('dav', 'generateBirthdayCalendar', 'yes');
119
-
120
-		if ($isEnabled !== 'yes') {
121
-			throw new \InvalidArgumentException('Birthday calendars are disabled');
122
-		}
123
-	}
41
+    /** @var BirthdayService */
42
+    private $birthdayService;
43
+
44
+    /** @var IConfig */
45
+    private $config;
46
+
47
+    /** @var IUserManager */
48
+    private $userManager;
49
+
50
+    /**
51
+     * @param IUserManager $userManager
52
+     * @param IConfig $config
53
+     * @param BirthdayService $birthdayService
54
+     */
55
+    public function __construct(IUserManager $userManager, IConfig $config,
56
+                            BirthdayService $birthdayService) {
57
+        parent::__construct();
58
+        $this->birthdayService = $birthdayService;
59
+        $this->config = $config;
60
+        $this->userManager = $userManager;
61
+    }
62
+
63
+    protected function configure() {
64
+        $this
65
+            ->setName('dav:sync-birthday-calendar')
66
+            ->setDescription('Synchronizes the birthday calendar')
67
+            ->addArgument('user',
68
+                InputArgument::OPTIONAL,
69
+                'User for whom the birthday calendar will be synchronized');
70
+    }
71
+
72
+    /**
73
+     * @param InputInterface $input
74
+     * @param OutputInterface $output
75
+     */
76
+    protected function execute(InputInterface $input, OutputInterface $output): int {
77
+        $this->verifyEnabled();
78
+
79
+        $user = $input->getArgument('user');
80
+        if (!is_null($user)) {
81
+            if (!$this->userManager->userExists($user)) {
82
+                throw new \InvalidArgumentException("User <$user> in unknown.");
83
+            }
84
+
85
+            // re-enable the birthday calendar in case it's called directly with a user name
86
+            $isEnabled = $this->config->getUserValue($user, 'dav', 'generateBirthdayCalendar', 'yes');
87
+            if ($isEnabled !== 'yes') {
88
+                $this->config->setUserValue($user, 'dav', 'generateBirthdayCalendar', 'yes');
89
+                $output->writeln("Re-enabling birthday calendar for $user");
90
+            }
91
+
92
+            $output->writeln("Start birthday calendar sync for $user");
93
+            $this->birthdayService->syncUser($user);
94
+            return 0;
95
+        }
96
+        $output->writeln("Start birthday calendar sync for all users ...");
97
+        $p = new ProgressBar($output);
98
+        $p->start();
99
+        $this->userManager->callForSeenUsers(function ($user) use ($p) {
100
+            $p->advance();
101
+
102
+            $userId = $user->getUID();
103
+            $isEnabled = $this->config->getUserValue($userId, 'dav', 'generateBirthdayCalendar', 'yes');
104
+            if ($isEnabled !== 'yes') {
105
+                return;
106
+            }
107
+
108
+            /** @var IUser $user */
109
+            $this->birthdayService->syncUser($user->getUID());
110
+        });
111
+
112
+        $p->finish();
113
+        $output->writeln('');
114
+        return 0;
115
+    }
116
+
117
+    protected function verifyEnabled() {
118
+        $isEnabled = $this->config->getAppValue('dav', 'generateBirthdayCalendar', 'yes');
119
+
120
+        if ($isEnabled !== 'yes') {
121
+            throw new \InvalidArgumentException('Birthday calendars are disabled');
122
+        }
123
+    }
124 124
 }
Please login to merge, or discard this patch.
apps/user_ldap/lib/Command/DeleteConfig.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -33,41 +33,41 @@
 block discarded – undo
33 33
 use Symfony\Component\Console\Output\OutputInterface;
34 34
 
35 35
 class DeleteConfig extends Command {
36
-	/** @var \OCA\User_LDAP\Helper */
37
-	protected $helper;
36
+    /** @var \OCA\User_LDAP\Helper */
37
+    protected $helper;
38 38
 
39
-	/**
40
-	 * @param Helper $helper
41
-	 */
42
-	public function __construct(Helper $helper) {
43
-		$this->helper = $helper;
44
-		parent::__construct();
45
-	}
39
+    /**
40
+     * @param Helper $helper
41
+     */
42
+    public function __construct(Helper $helper) {
43
+        $this->helper = $helper;
44
+        parent::__construct();
45
+    }
46 46
 
47
-	protected function configure() {
48
-		$this
49
-			->setName('ldap:delete-config')
50
-			->setDescription('deletes an existing LDAP configuration')
51
-			->addArgument(
52
-					'configID',
53
-					InputArgument::REQUIRED,
54
-					'the configuration ID'
55
-					 )
56
-		;
57
-	}
47
+    protected function configure() {
48
+        $this
49
+            ->setName('ldap:delete-config')
50
+            ->setDescription('deletes an existing LDAP configuration')
51
+            ->addArgument(
52
+                    'configID',
53
+                    InputArgument::REQUIRED,
54
+                    'the configuration ID'
55
+                        )
56
+        ;
57
+    }
58 58
 
59 59
 
60
-	protected function execute(InputInterface $input, OutputInterface $output): int {
61
-		$configPrefix = $input->getArgument('configID');
60
+    protected function execute(InputInterface $input, OutputInterface $output): int {
61
+        $configPrefix = $input->getArgument('configID');
62 62
 
63
-		$success = $this->helper->deleteServerConfiguration($configPrefix);
63
+        $success = $this->helper->deleteServerConfiguration($configPrefix);
64 64
 
65
-		if ($success) {
66
-			$output->writeln("Deleted configuration with configID '{$configPrefix}'");
67
-			return 0;
68
-		} else {
69
-			$output->writeln("Cannot delete configuration with configID '{$configPrefix}'");
70
-			return 1;
71
-		}
72
-	}
65
+        if ($success) {
66
+            $output->writeln("Deleted configuration with configID '{$configPrefix}'");
67
+            return 0;
68
+        } else {
69
+            $output->writeln("Cannot delete configuration with configID '{$configPrefix}'");
70
+            return 1;
71
+        }
72
+    }
73 73
 }
Please login to merge, or discard this patch.
apps/files_sharing/lib/Command/ExiprationNotification.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -36,64 +36,64 @@
 block discarded – undo
36 36
 use Symfony\Component\Console\Output\OutputInterface;
37 37
 
38 38
 class ExiprationNotification extends Command {
39
-	/** @var NotificationManager */
40
-	private $notificationManager;
41
-	/** @var IDBConnection */
42
-	private $connection;
43
-	/** @var ITimeFactory */
44
-	private $time;
45
-	/** @var ShareManager */
46
-	private $shareManager;
39
+    /** @var NotificationManager */
40
+    private $notificationManager;
41
+    /** @var IDBConnection */
42
+    private $connection;
43
+    /** @var ITimeFactory */
44
+    private $time;
45
+    /** @var ShareManager */
46
+    private $shareManager;
47 47
 
48
-	public function __construct(ITimeFactory $time,
49
-								NotificationManager $notificationManager,
50
-								IDBConnection $connection,
51
-								ShareManager $shareManager) {
52
-		parent::__construct();
48
+    public function __construct(ITimeFactory $time,
49
+                                NotificationManager $notificationManager,
50
+                                IDBConnection $connection,
51
+                                ShareManager $shareManager) {
52
+        parent::__construct();
53 53
 
54
-		$this->notificationManager = $notificationManager;
55
-		$this->connection = $connection;
56
-		$this->time = $time;
57
-		$this->shareManager = $shareManager;
58
-	}
54
+        $this->notificationManager = $notificationManager;
55
+        $this->connection = $connection;
56
+        $this->time = $time;
57
+        $this->shareManager = $shareManager;
58
+    }
59 59
 
60
-	protected function configure() {
61
-		$this
62
-			->setName('sharing:expiration-notification')
63
-			->setDescription('Notify share initiators when a share will expire the next day.');
64
-	}
60
+    protected function configure() {
61
+        $this
62
+            ->setName('sharing:expiration-notification')
63
+            ->setDescription('Notify share initiators when a share will expire the next day.');
64
+    }
65 65
 
66
-	public function execute(InputInterface $input, OutputInterface $output): int {
67
-		//Current time
68
-		$minTime = $this->time->getDateTime();
69
-		$minTime->add(new \DateInterval('P1D'));
70
-		$minTime->setTime(0,0,0);
66
+    public function execute(InputInterface $input, OutputInterface $output): int {
67
+        //Current time
68
+        $minTime = $this->time->getDateTime();
69
+        $minTime->add(new \DateInterval('P1D'));
70
+        $minTime->setTime(0,0,0);
71 71
 
72
-		$maxTime = clone $minTime;
73
-		$maxTime->setTime(23, 59, 59);
72
+        $maxTime = clone $minTime;
73
+        $maxTime->setTime(23, 59, 59);
74 74
 
75
-		$shares = $this->shareManager->getAllShares();
75
+        $shares = $this->shareManager->getAllShares();
76 76
 
77
-		$now = $this->time->getDateTime();
77
+        $now = $this->time->getDateTime();
78 78
 
79
-		/** @var IShare $share */
80
-		foreach ($shares as $share) {
81
-			if ($share->getExpirationDate() === null
82
-				|| $share->getExpirationDate()->getTimestamp() < $minTime->getTimestamp()
83
-				|| $share->getExpirationDate()->getTimestamp() > $maxTime->getTimestamp()) {
84
-				continue;
85
-			}
79
+        /** @var IShare $share */
80
+        foreach ($shares as $share) {
81
+            if ($share->getExpirationDate() === null
82
+                || $share->getExpirationDate()->getTimestamp() < $minTime->getTimestamp()
83
+                || $share->getExpirationDate()->getTimestamp() > $maxTime->getTimestamp()) {
84
+                continue;
85
+            }
86 86
 
87
-			$notification = $this->notificationManager->createNotification();
88
-			$notification->setApp('files_sharing')
89
-				->setDateTime($now)
90
-				->setObject('share', $share->getFullId())
91
-				->setSubject('expiresTomorrow');
87
+            $notification = $this->notificationManager->createNotification();
88
+            $notification->setApp('files_sharing')
89
+                ->setDateTime($now)
90
+                ->setObject('share', $share->getFullId())
91
+                ->setSubject('expiresTomorrow');
92 92
 
93
-			// Only send to initiator for now
94
-			$notification->setUser($share->getSharedBy());
95
-			$this->notificationManager->notify($notification);
96
-		}
97
-		return 0;
98
-	}
93
+            // Only send to initiator for now
94
+            $notification->setUser($share->getSharedBy());
95
+            $this->notificationManager->notify($notification);
96
+        }
97
+        return 0;
98
+    }
99 99
 }
Please login to merge, or discard this patch.
apps/workflowengine/lib/Command/Index.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -35,48 +35,48 @@
 block discarded – undo
35 35
 
36 36
 class Index extends Command {
37 37
 
38
-	/** @var Manager */
39
-	private $manager;
38
+    /** @var Manager */
39
+    private $manager;
40 40
 
41
-	public function __construct(Manager $manager) {
42
-		$this->manager = $manager;
43
-		parent::__construct();
44
-	}
41
+    public function __construct(Manager $manager) {
42
+        $this->manager = $manager;
43
+        parent::__construct();
44
+    }
45 45
 
46
-	protected function configure() {
47
-		$this
48
-			->setName('workflows:list')
49
-			->setDescription('Lists configured workflows')
50
-			->addArgument(
51
-				'scope',
52
-				InputArgument::OPTIONAL,
53
-				'Lists workflows for "admin", "user"',
54
-				'admin'
55
-			)
56
-			->addArgument(
57
-				'scopeId',
58
-				InputArgument::OPTIONAL,
59
-				'User IDs when the scope is "user"',
60
-				null
61
-			);
62
-	}
46
+    protected function configure() {
47
+        $this
48
+            ->setName('workflows:list')
49
+            ->setDescription('Lists configured workflows')
50
+            ->addArgument(
51
+                'scope',
52
+                InputArgument::OPTIONAL,
53
+                'Lists workflows for "admin", "user"',
54
+                'admin'
55
+            )
56
+            ->addArgument(
57
+                'scopeId',
58
+                InputArgument::OPTIONAL,
59
+                'User IDs when the scope is "user"',
60
+                null
61
+            );
62
+    }
63 63
 
64
-	protected function mappedScope(string $scope): int {
65
-		static $scopes = [
66
-			'admin' => IManager::SCOPE_ADMIN,
67
-			'user' => IManager::SCOPE_USER,
68
-		];
69
-		return $scopes[$scope] ?? -1;
70
-	}
64
+    protected function mappedScope(string $scope): int {
65
+        static $scopes = [
66
+            'admin' => IManager::SCOPE_ADMIN,
67
+            'user' => IManager::SCOPE_USER,
68
+        ];
69
+        return $scopes[$scope] ?? -1;
70
+    }
71 71
 
72
-	protected function execute(InputInterface $input, OutputInterface $output): int {
73
-		$ops = $this->manager->getAllOperations(
74
-			new ScopeContext(
75
-				$this->mappedScope($input->getArgument('scope')),
76
-				$input->getArgument('scopeId')
77
-			)
78
-		);
79
-		$output->writeln(\json_encode($ops));
80
-		return 0;
81
-	}
72
+    protected function execute(InputInterface $input, OutputInterface $output): int {
73
+        $ops = $this->manager->getAllOperations(
74
+            new ScopeContext(
75
+                $this->mappedScope($input->getArgument('scope')),
76
+                $input->getArgument('scopeId')
77
+            )
78
+        );
79
+        $output->writeln(\json_encode($ops));
80
+        return 0;
81
+    }
82 82
 }
Please login to merge, or discard this patch.
apps/files_trashbin/lib/Command/CleanUp.php 1 patch
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -39,98 +39,98 @@
 block discarded – undo
39 39
 
40 40
 class CleanUp extends Command {
41 41
 
42
-	/** @var IUserManager */
43
-	protected $userManager;
42
+    /** @var IUserManager */
43
+    protected $userManager;
44 44
 
45
-	/** @var IRootFolder */
46
-	protected $rootFolder;
45
+    /** @var IRootFolder */
46
+    protected $rootFolder;
47 47
 
48
-	/** @var \OCP\IDBConnection */
49
-	protected $dbConnection;
48
+    /** @var \OCP\IDBConnection */
49
+    protected $dbConnection;
50 50
 
51
-	/**
52
-	 * @param IRootFolder $rootFolder
53
-	 * @param IUserManager $userManager
54
-	 * @param IDBConnection $dbConnection
55
-	 */
56
-	public function __construct(IRootFolder $rootFolder, IUserManager $userManager, IDBConnection $dbConnection) {
57
-		parent::__construct();
58
-		$this->userManager = $userManager;
59
-		$this->rootFolder = $rootFolder;
60
-		$this->dbConnection = $dbConnection;
61
-	}
51
+    /**
52
+     * @param IRootFolder $rootFolder
53
+     * @param IUserManager $userManager
54
+     * @param IDBConnection $dbConnection
55
+     */
56
+    public function __construct(IRootFolder $rootFolder, IUserManager $userManager, IDBConnection $dbConnection) {
57
+        parent::__construct();
58
+        $this->userManager = $userManager;
59
+        $this->rootFolder = $rootFolder;
60
+        $this->dbConnection = $dbConnection;
61
+    }
62 62
 
63
-	protected function configure() {
64
-		$this
65
-			->setName('trashbin:cleanup')
66
-			->setDescription('Remove deleted files')
67
-			->addArgument(
68
-				'user_id',
69
-				InputArgument::OPTIONAL | InputArgument::IS_ARRAY,
70
-				'remove deleted files of the given user(s)'
71
-			)
72
-			->addOption(
73
-				'all-users',
74
-				null,
75
-				InputOption::VALUE_NONE,
76
-				'run action on all users'
77
-			);
78
-	}
63
+    protected function configure() {
64
+        $this
65
+            ->setName('trashbin:cleanup')
66
+            ->setDescription('Remove deleted files')
67
+            ->addArgument(
68
+                'user_id',
69
+                InputArgument::OPTIONAL | InputArgument::IS_ARRAY,
70
+                'remove deleted files of the given user(s)'
71
+            )
72
+            ->addOption(
73
+                'all-users',
74
+                null,
75
+                InputOption::VALUE_NONE,
76
+                'run action on all users'
77
+            );
78
+    }
79 79
 
80
-	protected function execute(InputInterface $input, OutputInterface $output): int {
81
-		$users = $input->getArgument('user_id');
82
-		if ((!empty($users)) and ($input->getOption('all-users'))) {
83
-			throw new InvalidOptionException('Either specify a user_id or --all-users');
84
-		} elseif (!empty($users)) {
85
-			foreach ($users as $user) {
86
-				if ($this->userManager->userExists($user)) {
87
-					$output->writeln("Remove deleted files of   <info>$user</info>");
88
-					$this->removeDeletedFiles($user);
89
-				} else {
90
-					$output->writeln("<error>Unknown user $user</error>");
91
-					return 1;
92
-				}
93
-			}
94
-		} elseif ($input->getOption('all-users')) {
95
-			$output->writeln('Remove deleted files for all users');
96
-			foreach ($this->userManager->getBackends() as $backend) {
97
-				$name = get_class($backend);
98
-				if ($backend instanceof IUserBackend) {
99
-					$name = $backend->getBackendName();
100
-				}
101
-				$output->writeln("Remove deleted files for users on backend <info>$name</info>");
102
-				$limit = 500;
103
-				$offset = 0;
104
-				do {
105
-					$users = $backend->getUsers('', $limit, $offset);
106
-					foreach ($users as $user) {
107
-						$output->writeln("   <info>$user</info>");
108
-						$this->removeDeletedFiles($user);
109
-					}
110
-					$offset += $limit;
111
-				} while (count($users) >= $limit);
112
-			}
113
-		} else {
114
-			throw new InvalidOptionException('Either specify a user_id or --all-users');
115
-		}
116
-		return 0;
117
-	}
80
+    protected function execute(InputInterface $input, OutputInterface $output): int {
81
+        $users = $input->getArgument('user_id');
82
+        if ((!empty($users)) and ($input->getOption('all-users'))) {
83
+            throw new InvalidOptionException('Either specify a user_id or --all-users');
84
+        } elseif (!empty($users)) {
85
+            foreach ($users as $user) {
86
+                if ($this->userManager->userExists($user)) {
87
+                    $output->writeln("Remove deleted files of   <info>$user</info>");
88
+                    $this->removeDeletedFiles($user);
89
+                } else {
90
+                    $output->writeln("<error>Unknown user $user</error>");
91
+                    return 1;
92
+                }
93
+            }
94
+        } elseif ($input->getOption('all-users')) {
95
+            $output->writeln('Remove deleted files for all users');
96
+            foreach ($this->userManager->getBackends() as $backend) {
97
+                $name = get_class($backend);
98
+                if ($backend instanceof IUserBackend) {
99
+                    $name = $backend->getBackendName();
100
+                }
101
+                $output->writeln("Remove deleted files for users on backend <info>$name</info>");
102
+                $limit = 500;
103
+                $offset = 0;
104
+                do {
105
+                    $users = $backend->getUsers('', $limit, $offset);
106
+                    foreach ($users as $user) {
107
+                        $output->writeln("   <info>$user</info>");
108
+                        $this->removeDeletedFiles($user);
109
+                    }
110
+                    $offset += $limit;
111
+                } while (count($users) >= $limit);
112
+            }
113
+        } else {
114
+            throw new InvalidOptionException('Either specify a user_id or --all-users');
115
+        }
116
+        return 0;
117
+    }
118 118
 
119
-	/**
120
-	 * remove deleted files for the given user
121
-	 *
122
-	 * @param string $uid
123
-	 */
124
-	protected function removeDeletedFiles($uid) {
125
-		\OC_Util::tearDownFS();
126
-		\OC_Util::setupFS($uid);
127
-		if ($this->rootFolder->nodeExists('/' . $uid . '/files_trashbin')) {
128
-			$this->rootFolder->get('/' . $uid . '/files_trashbin')->delete();
129
-			$query = $this->dbConnection->getQueryBuilder();
130
-			$query->delete('files_trash')
131
-				->where($query->expr()->eq('user', $query->createParameter('uid')))
132
-				->setParameter('uid', $uid);
133
-			$query->execute();
134
-		}
135
-	}
119
+    /**
120
+     * remove deleted files for the given user
121
+     *
122
+     * @param string $uid
123
+     */
124
+    protected function removeDeletedFiles($uid) {
125
+        \OC_Util::tearDownFS();
126
+        \OC_Util::setupFS($uid);
127
+        if ($this->rootFolder->nodeExists('/' . $uid . '/files_trashbin')) {
128
+            $this->rootFolder->get('/' . $uid . '/files_trashbin')->delete();
129
+            $query = $this->dbConnection->getQueryBuilder();
130
+            $query->delete('files_trash')
131
+                ->where($query->expr()->eq('user', $query->createParameter('uid')))
132
+                ->setParameter('uid', $uid);
133
+            $query->execute();
134
+        }
135
+    }
136 136
 }
Please login to merge, or discard this patch.