Passed
Push — master ( 8ada0c...f8b4e0 )
by Robin
15:48 queued 13s
created
core/register_command.php 1 patch
Indentation   +146 added lines, -146 removed lines patch added patch discarded remove patch
@@ -55,161 +55,161 @@
 block discarded – undo
55 55
 $application->add(new OC\Core\Command\Check(\OC::$server->getSystemConfig()));
56 56
 $application->add(new OC\Core\Command\L10n\CreateJs());
57 57
 $application->add(new \OC\Core\Command\Integrity\SignApp(
58
-	\OC::$server->getIntegrityCodeChecker(),
59
-	new \OC\IntegrityCheck\Helpers\FileAccessHelper(),
60
-	\OC::$server->getURLGenerator()
58
+    \OC::$server->getIntegrityCodeChecker(),
59
+    new \OC\IntegrityCheck\Helpers\FileAccessHelper(),
60
+    \OC::$server->getURLGenerator()
61 61
 ));
62 62
 $application->add(new \OC\Core\Command\Integrity\SignCore(
63
-	\OC::$server->getIntegrityCodeChecker(),
64
-	new \OC\IntegrityCheck\Helpers\FileAccessHelper()
63
+    \OC::$server->getIntegrityCodeChecker(),
64
+    new \OC\IntegrityCheck\Helpers\FileAccessHelper()
65 65
 ));
66 66
 $application->add(new \OC\Core\Command\Integrity\CheckApp(
67
-	\OC::$server->getIntegrityCodeChecker()
67
+    \OC::$server->getIntegrityCodeChecker()
68 68
 ));
69 69
 $application->add(new \OC\Core\Command\Integrity\CheckCore(
70
-	\OC::$server->getIntegrityCodeChecker()
70
+    \OC::$server->getIntegrityCodeChecker()
71 71
 ));
72 72
 
73 73
 
74 74
 if (\OC::$server->getConfig()->getSystemValue('installed', false)) {
75
-	$application->add(new OC\Core\Command\App\Disable(\OC::$server->getAppManager()));
76
-	$application->add(new OC\Core\Command\App\Enable(\OC::$server->getAppManager(), \OC::$server->getGroupManager()));
77
-	$application->add(new OC\Core\Command\App\Install());
78
-	$application->add(new OC\Core\Command\App\GetPath());
79
-	$application->add(new OC\Core\Command\App\ListApps(\OC::$server->getAppManager()));
80
-	$application->add(new OC\Core\Command\App\Remove(\OC::$server->getAppManager(), \OC::$server->query(\OC\Installer::class), \OC::$server->get(LoggerInterface::class)));
81
-	$application->add(\OC::$server->query(\OC\Core\Command\App\Update::class));
82
-
83
-	$application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Cleanup::class));
84
-	$application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Enforce::class));
85
-	$application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Enable::class));
86
-	$application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Disable::class));
87
-	$application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\State::class));
88
-
89
-	$application->add(new OC\Core\Command\Background\Cron(\OC::$server->getConfig()));
90
-	$application->add(new OC\Core\Command\Background\WebCron(\OC::$server->getConfig()));
91
-	$application->add(new OC\Core\Command\Background\Ajax(\OC::$server->getConfig()));
92
-	$application->add(new OC\Core\Command\Background\Job(\OC::$server->getJobList(), \OC::$server->getLogger()));
93
-	$application->add(new OC\Core\Command\Background\ListCommand(\OC::$server->getJobList()));
94
-
95
-	$application->add(\OC::$server->query(\OC\Core\Command\Broadcast\Test::class));
96
-
97
-	$application->add(new OC\Core\Command\Config\App\DeleteConfig(\OC::$server->getConfig()));
98
-	$application->add(new OC\Core\Command\Config\App\GetConfig(\OC::$server->getConfig()));
99
-	$application->add(new OC\Core\Command\Config\App\SetConfig(\OC::$server->getConfig()));
100
-	$application->add(new OC\Core\Command\Config\Import(\OC::$server->getConfig()));
101
-	$application->add(new OC\Core\Command\Config\ListConfigs(\OC::$server->getSystemConfig(), \OC::$server->getAppConfig()));
102
-	$application->add(new OC\Core\Command\Config\System\DeleteConfig(\OC::$server->getSystemConfig()));
103
-	$application->add(new OC\Core\Command\Config\System\GetConfig(\OC::$server->getSystemConfig()));
104
-	$application->add(new OC\Core\Command\Config\System\SetConfig(\OC::$server->getSystemConfig()));
105
-
106
-	$application->add(\OC::$server->get(OC\Core\Command\Info\File::class));
107
-	$application->add(\OC::$server->get(OC\Core\Command\Info\Space::class));
108
-
109
-	$application->add(new OC\Core\Command\Db\ConvertType(\OC::$server->getConfig(), new \OC\DB\ConnectionFactory(\OC::$server->getSystemConfig())));
110
-	$application->add(new OC\Core\Command\Db\ConvertMysqlToMB4(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection(), \OC::$server->getURLGenerator(), \OC::$server->get(LoggerInterface::class)));
111
-	$application->add(new OC\Core\Command\Db\ConvertFilecacheBigInt(\OC::$server->get(\OC\DB\Connection::class)));
112
-	$application->add(new OC\Core\Command\Db\AddMissingIndices(\OC::$server->get(\OC\DB\Connection::class), \OC::$server->getEventDispatcher()));
113
-	$application->add(new OC\Core\Command\Db\AddMissingColumns(\OC::$server->get(\OC\DB\Connection::class), \OC::$server->getEventDispatcher()));
114
-	$application->add(new OC\Core\Command\Db\AddMissingPrimaryKeys(\OC::$server->get(\OC\DB\Connection::class), \OC::$server->getEventDispatcher()));
115
-
116
-	if (\OC::$server->getConfig()->getSystemValueBool('debug', false)) {
117
-		$application->add(new OC\Core\Command\Db\Migrations\StatusCommand(\OC::$server->get(\OC\DB\Connection::class)));
118
-		$application->add(new OC\Core\Command\Db\Migrations\MigrateCommand(\OC::$server->get(\OC\DB\Connection::class)));
119
-		$application->add(new OC\Core\Command\Db\Migrations\GenerateCommand(\OC::$server->get(\OC\DB\Connection::class), \OC::$server->getAppManager()));
120
-		$application->add(new OC\Core\Command\Db\Migrations\ExecuteCommand(\OC::$server->get(\OC\DB\Connection::class), \OC::$server->getConfig()));
121
-	}
122
-
123
-	$application->add(new OC\Core\Command\Encryption\Disable(\OC::$server->getConfig()));
124
-	$application->add(new OC\Core\Command\Encryption\Enable(\OC::$server->getConfig(), \OC::$server->getEncryptionManager()));
125
-	$application->add(new OC\Core\Command\Encryption\ListModules(\OC::$server->getEncryptionManager(), \OC::$server->getConfig()));
126
-	$application->add(new OC\Core\Command\Encryption\SetDefaultModule(\OC::$server->getEncryptionManager(), \OC::$server->getConfig()));
127
-	$application->add(new OC\Core\Command\Encryption\Status(\OC::$server->getEncryptionManager()));
128
-	$application->add(new OC\Core\Command\Encryption\EncryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getAppManager(), \OC::$server->getConfig(), new \Symfony\Component\Console\Helper\QuestionHelper()));
129
-	$application->add(new OC\Core\Command\Encryption\DecryptAll(
130
-		\OC::$server->getEncryptionManager(),
131
-		\OC::$server->getAppManager(),
132
-		\OC::$server->getConfig(),
133
-		new \OC\Encryption\DecryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getUserManager(), new \OC\Files\View()),
134
-		new \Symfony\Component\Console\Helper\QuestionHelper())
135
-	);
136
-
137
-	$application->add(new OC\Core\Command\Log\Manage(\OC::$server->getConfig()));
138
-	$application->add(new OC\Core\Command\Log\File(\OC::$server->getConfig()));
139
-
140
-	$view = new \OC\Files\View();
141
-	$util = new \OC\Encryption\Util(
142
-		$view,
143
-		\OC::$server->getUserManager(),
144
-		\OC::$server->getGroupManager(),
145
-		\OC::$server->getConfig()
146
-	);
147
-	$application->add(new OC\Core\Command\Encryption\ChangeKeyStorageRoot(
148
-		$view,
149
-		\OC::$server->getUserManager(),
150
-		\OC::$server->getConfig(),
151
-		$util,
152
-		new \Symfony\Component\Console\Helper\QuestionHelper()
153
-	)
154
-	);
155
-	$application->add(new OC\Core\Command\Encryption\ShowKeyStorageRoot($util));
156
-	$application->add(new OC\Core\Command\Encryption\MigrateKeyStorage(
157
-		$view,
158
-		\OC::$server->getUserManager(),
159
-		\OC::$server->getConfig(),
160
-		$util,
161
-		\OC::$server->getCrypto()
162
-	)
163
-	);
164
-
165
-	$application->add(new OC\Core\Command\Maintenance\DataFingerprint(\OC::$server->getConfig(), new \OC\AppFramework\Utility\TimeFactory()));
166
-	$application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateDB(\OC::$server->getMimeTypeDetector(), \OC::$server->getMimeTypeLoader()));
167
-	$application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateJS(\OC::$server->getMimeTypeDetector()));
168
-	$application->add(new OC\Core\Command\Maintenance\Mode(\OC::$server->getConfig()));
169
-	$application->add(new OC\Core\Command\Maintenance\UpdateHtaccess());
170
-	$application->add(new OC\Core\Command\Maintenance\UpdateTheme(\OC::$server->getMimeTypeDetector(), \OC::$server->getMemCacheFactory()));
171
-
172
-	$application->add(new OC\Core\Command\Upgrade(\OC::$server->getConfig(), \OC::$server->get(LoggerInterface::class), \OC::$server->query(\OC\Installer::class)));
173
-	$application->add(new OC\Core\Command\Maintenance\Repair(
174
-		new \OC\Repair([], \OC::$server->get(\OCP\EventDispatcher\IEventDispatcher::class), \OC::$server->get(LoggerInterface::class)),
175
-		\OC::$server->getConfig(),
176
-		\OC::$server->get(\OCP\EventDispatcher\IEventDispatcher::class),
177
-		\OC::$server->getAppManager()
178
-	));
179
-	$application->add(\OC::$server->query(OC\Core\Command\Maintenance\RepairShareOwnership::class));
180
-
181
-	$application->add(\OC::$server->get(\OC\Core\Command\Preview\Generate::class));
182
-	$application->add(\OC::$server->query(\OC\Core\Command\Preview\Repair::class));
183
-	$application->add(\OC::$server->query(\OC\Core\Command\Preview\ResetRenderedTexts::class));
184
-
185
-	$application->add(new OC\Core\Command\User\Add(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
186
-	$application->add(new OC\Core\Command\User\Delete(\OC::$server->getUserManager()));
187
-	$application->add(new OC\Core\Command\User\Disable(\OC::$server->getUserManager()));
188
-	$application->add(new OC\Core\Command\User\Enable(\OC::$server->getUserManager()));
189
-	$application->add(new OC\Core\Command\User\LastSeen(\OC::$server->getUserManager()));
190
-	$application->add(\OC::$server->get(\OC\Core\Command\User\Report::class));
191
-	$application->add(new OC\Core\Command\User\ResetPassword(\OC::$server->getUserManager(), \OC::$server->getAppManager()));
192
-	$application->add(new OC\Core\Command\User\Setting(\OC::$server->getUserManager(), \OC::$server->getConfig()));
193
-	$application->add(new OC\Core\Command\User\ListCommand(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
194
-	$application->add(new OC\Core\Command\User\Info(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
195
-	$application->add(new OC\Core\Command\User\AddAppPassword(\OC::$server->get(\OCP\IUserManager::class), \OC::$server->get(\OC\Authentication\Token\IProvider::class), \OC::$server->get(\OCP\Security\ISecureRandom::class), \OC::$server->get(\OCP\EventDispatcher\IEventDispatcher::class)));
196
-
197
-	$application->add(new OC\Core\Command\Group\Add(\OC::$server->getGroupManager()));
198
-	$application->add(new OC\Core\Command\Group\Delete(\OC::$server->getGroupManager()));
199
-	$application->add(new OC\Core\Command\Group\ListCommand(\OC::$server->getGroupManager()));
200
-	$application->add(new OC\Core\Command\Group\AddUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
201
-	$application->add(new OC\Core\Command\Group\RemoveUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
202
-	$application->add(new OC\Core\Command\Group\Info(\OC::$server->get(\OCP\IGroupManager::class)));
203
-
204
-	$application->add(new OC\Core\Command\SystemTag\ListCommand(\OC::$server->get(\OCP\SystemTag\ISystemTagManager::class)));
205
-	$application->add(new OC\Core\Command\SystemTag\Delete(\OC::$server->get(\OCP\SystemTag\ISystemTagManager::class)));
206
-	$application->add(new OC\Core\Command\SystemTag\Add(\OC::$server->get(\OCP\SystemTag\ISystemTagManager::class)));
207
-	$application->add(new OC\Core\Command\SystemTag\Edit(\OC::$server->get(\OCP\SystemTag\ISystemTagManager::class)));
208
-
209
-	$application->add(new OC\Core\Command\Security\ListCertificates(\OC::$server->getCertificateManager(), \OC::$server->getL10N('core')));
210
-	$application->add(new OC\Core\Command\Security\ImportCertificate(\OC::$server->getCertificateManager()));
211
-	$application->add(new OC\Core\Command\Security\RemoveCertificate(\OC::$server->getCertificateManager()));
212
-	$application->add(new OC\Core\Command\Security\ResetBruteforceAttempts(\OC::$server->getBruteForceThrottler()));
75
+    $application->add(new OC\Core\Command\App\Disable(\OC::$server->getAppManager()));
76
+    $application->add(new OC\Core\Command\App\Enable(\OC::$server->getAppManager(), \OC::$server->getGroupManager()));
77
+    $application->add(new OC\Core\Command\App\Install());
78
+    $application->add(new OC\Core\Command\App\GetPath());
79
+    $application->add(new OC\Core\Command\App\ListApps(\OC::$server->getAppManager()));
80
+    $application->add(new OC\Core\Command\App\Remove(\OC::$server->getAppManager(), \OC::$server->query(\OC\Installer::class), \OC::$server->get(LoggerInterface::class)));
81
+    $application->add(\OC::$server->query(\OC\Core\Command\App\Update::class));
82
+
83
+    $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Cleanup::class));
84
+    $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Enforce::class));
85
+    $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Enable::class));
86
+    $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Disable::class));
87
+    $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\State::class));
88
+
89
+    $application->add(new OC\Core\Command\Background\Cron(\OC::$server->getConfig()));
90
+    $application->add(new OC\Core\Command\Background\WebCron(\OC::$server->getConfig()));
91
+    $application->add(new OC\Core\Command\Background\Ajax(\OC::$server->getConfig()));
92
+    $application->add(new OC\Core\Command\Background\Job(\OC::$server->getJobList(), \OC::$server->getLogger()));
93
+    $application->add(new OC\Core\Command\Background\ListCommand(\OC::$server->getJobList()));
94
+
95
+    $application->add(\OC::$server->query(\OC\Core\Command\Broadcast\Test::class));
96
+
97
+    $application->add(new OC\Core\Command\Config\App\DeleteConfig(\OC::$server->getConfig()));
98
+    $application->add(new OC\Core\Command\Config\App\GetConfig(\OC::$server->getConfig()));
99
+    $application->add(new OC\Core\Command\Config\App\SetConfig(\OC::$server->getConfig()));
100
+    $application->add(new OC\Core\Command\Config\Import(\OC::$server->getConfig()));
101
+    $application->add(new OC\Core\Command\Config\ListConfigs(\OC::$server->getSystemConfig(), \OC::$server->getAppConfig()));
102
+    $application->add(new OC\Core\Command\Config\System\DeleteConfig(\OC::$server->getSystemConfig()));
103
+    $application->add(new OC\Core\Command\Config\System\GetConfig(\OC::$server->getSystemConfig()));
104
+    $application->add(new OC\Core\Command\Config\System\SetConfig(\OC::$server->getSystemConfig()));
105
+
106
+    $application->add(\OC::$server->get(OC\Core\Command\Info\File::class));
107
+    $application->add(\OC::$server->get(OC\Core\Command\Info\Space::class));
108
+
109
+    $application->add(new OC\Core\Command\Db\ConvertType(\OC::$server->getConfig(), new \OC\DB\ConnectionFactory(\OC::$server->getSystemConfig())));
110
+    $application->add(new OC\Core\Command\Db\ConvertMysqlToMB4(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection(), \OC::$server->getURLGenerator(), \OC::$server->get(LoggerInterface::class)));
111
+    $application->add(new OC\Core\Command\Db\ConvertFilecacheBigInt(\OC::$server->get(\OC\DB\Connection::class)));
112
+    $application->add(new OC\Core\Command\Db\AddMissingIndices(\OC::$server->get(\OC\DB\Connection::class), \OC::$server->getEventDispatcher()));
113
+    $application->add(new OC\Core\Command\Db\AddMissingColumns(\OC::$server->get(\OC\DB\Connection::class), \OC::$server->getEventDispatcher()));
114
+    $application->add(new OC\Core\Command\Db\AddMissingPrimaryKeys(\OC::$server->get(\OC\DB\Connection::class), \OC::$server->getEventDispatcher()));
115
+
116
+    if (\OC::$server->getConfig()->getSystemValueBool('debug', false)) {
117
+        $application->add(new OC\Core\Command\Db\Migrations\StatusCommand(\OC::$server->get(\OC\DB\Connection::class)));
118
+        $application->add(new OC\Core\Command\Db\Migrations\MigrateCommand(\OC::$server->get(\OC\DB\Connection::class)));
119
+        $application->add(new OC\Core\Command\Db\Migrations\GenerateCommand(\OC::$server->get(\OC\DB\Connection::class), \OC::$server->getAppManager()));
120
+        $application->add(new OC\Core\Command\Db\Migrations\ExecuteCommand(\OC::$server->get(\OC\DB\Connection::class), \OC::$server->getConfig()));
121
+    }
122
+
123
+    $application->add(new OC\Core\Command\Encryption\Disable(\OC::$server->getConfig()));
124
+    $application->add(new OC\Core\Command\Encryption\Enable(\OC::$server->getConfig(), \OC::$server->getEncryptionManager()));
125
+    $application->add(new OC\Core\Command\Encryption\ListModules(\OC::$server->getEncryptionManager(), \OC::$server->getConfig()));
126
+    $application->add(new OC\Core\Command\Encryption\SetDefaultModule(\OC::$server->getEncryptionManager(), \OC::$server->getConfig()));
127
+    $application->add(new OC\Core\Command\Encryption\Status(\OC::$server->getEncryptionManager()));
128
+    $application->add(new OC\Core\Command\Encryption\EncryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getAppManager(), \OC::$server->getConfig(), new \Symfony\Component\Console\Helper\QuestionHelper()));
129
+    $application->add(new OC\Core\Command\Encryption\DecryptAll(
130
+        \OC::$server->getEncryptionManager(),
131
+        \OC::$server->getAppManager(),
132
+        \OC::$server->getConfig(),
133
+        new \OC\Encryption\DecryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getUserManager(), new \OC\Files\View()),
134
+        new \Symfony\Component\Console\Helper\QuestionHelper())
135
+    );
136
+
137
+    $application->add(new OC\Core\Command\Log\Manage(\OC::$server->getConfig()));
138
+    $application->add(new OC\Core\Command\Log\File(\OC::$server->getConfig()));
139
+
140
+    $view = new \OC\Files\View();
141
+    $util = new \OC\Encryption\Util(
142
+        $view,
143
+        \OC::$server->getUserManager(),
144
+        \OC::$server->getGroupManager(),
145
+        \OC::$server->getConfig()
146
+    );
147
+    $application->add(new OC\Core\Command\Encryption\ChangeKeyStorageRoot(
148
+        $view,
149
+        \OC::$server->getUserManager(),
150
+        \OC::$server->getConfig(),
151
+        $util,
152
+        new \Symfony\Component\Console\Helper\QuestionHelper()
153
+    )
154
+    );
155
+    $application->add(new OC\Core\Command\Encryption\ShowKeyStorageRoot($util));
156
+    $application->add(new OC\Core\Command\Encryption\MigrateKeyStorage(
157
+        $view,
158
+        \OC::$server->getUserManager(),
159
+        \OC::$server->getConfig(),
160
+        $util,
161
+        \OC::$server->getCrypto()
162
+    )
163
+    );
164
+
165
+    $application->add(new OC\Core\Command\Maintenance\DataFingerprint(\OC::$server->getConfig(), new \OC\AppFramework\Utility\TimeFactory()));
166
+    $application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateDB(\OC::$server->getMimeTypeDetector(), \OC::$server->getMimeTypeLoader()));
167
+    $application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateJS(\OC::$server->getMimeTypeDetector()));
168
+    $application->add(new OC\Core\Command\Maintenance\Mode(\OC::$server->getConfig()));
169
+    $application->add(new OC\Core\Command\Maintenance\UpdateHtaccess());
170
+    $application->add(new OC\Core\Command\Maintenance\UpdateTheme(\OC::$server->getMimeTypeDetector(), \OC::$server->getMemCacheFactory()));
171
+
172
+    $application->add(new OC\Core\Command\Upgrade(\OC::$server->getConfig(), \OC::$server->get(LoggerInterface::class), \OC::$server->query(\OC\Installer::class)));
173
+    $application->add(new OC\Core\Command\Maintenance\Repair(
174
+        new \OC\Repair([], \OC::$server->get(\OCP\EventDispatcher\IEventDispatcher::class), \OC::$server->get(LoggerInterface::class)),
175
+        \OC::$server->getConfig(),
176
+        \OC::$server->get(\OCP\EventDispatcher\IEventDispatcher::class),
177
+        \OC::$server->getAppManager()
178
+    ));
179
+    $application->add(\OC::$server->query(OC\Core\Command\Maintenance\RepairShareOwnership::class));
180
+
181
+    $application->add(\OC::$server->get(\OC\Core\Command\Preview\Generate::class));
182
+    $application->add(\OC::$server->query(\OC\Core\Command\Preview\Repair::class));
183
+    $application->add(\OC::$server->query(\OC\Core\Command\Preview\ResetRenderedTexts::class));
184
+
185
+    $application->add(new OC\Core\Command\User\Add(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
186
+    $application->add(new OC\Core\Command\User\Delete(\OC::$server->getUserManager()));
187
+    $application->add(new OC\Core\Command\User\Disable(\OC::$server->getUserManager()));
188
+    $application->add(new OC\Core\Command\User\Enable(\OC::$server->getUserManager()));
189
+    $application->add(new OC\Core\Command\User\LastSeen(\OC::$server->getUserManager()));
190
+    $application->add(\OC::$server->get(\OC\Core\Command\User\Report::class));
191
+    $application->add(new OC\Core\Command\User\ResetPassword(\OC::$server->getUserManager(), \OC::$server->getAppManager()));
192
+    $application->add(new OC\Core\Command\User\Setting(\OC::$server->getUserManager(), \OC::$server->getConfig()));
193
+    $application->add(new OC\Core\Command\User\ListCommand(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
194
+    $application->add(new OC\Core\Command\User\Info(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
195
+    $application->add(new OC\Core\Command\User\AddAppPassword(\OC::$server->get(\OCP\IUserManager::class), \OC::$server->get(\OC\Authentication\Token\IProvider::class), \OC::$server->get(\OCP\Security\ISecureRandom::class), \OC::$server->get(\OCP\EventDispatcher\IEventDispatcher::class)));
196
+
197
+    $application->add(new OC\Core\Command\Group\Add(\OC::$server->getGroupManager()));
198
+    $application->add(new OC\Core\Command\Group\Delete(\OC::$server->getGroupManager()));
199
+    $application->add(new OC\Core\Command\Group\ListCommand(\OC::$server->getGroupManager()));
200
+    $application->add(new OC\Core\Command\Group\AddUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
201
+    $application->add(new OC\Core\Command\Group\RemoveUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
202
+    $application->add(new OC\Core\Command\Group\Info(\OC::$server->get(\OCP\IGroupManager::class)));
203
+
204
+    $application->add(new OC\Core\Command\SystemTag\ListCommand(\OC::$server->get(\OCP\SystemTag\ISystemTagManager::class)));
205
+    $application->add(new OC\Core\Command\SystemTag\Delete(\OC::$server->get(\OCP\SystemTag\ISystemTagManager::class)));
206
+    $application->add(new OC\Core\Command\SystemTag\Add(\OC::$server->get(\OCP\SystemTag\ISystemTagManager::class)));
207
+    $application->add(new OC\Core\Command\SystemTag\Edit(\OC::$server->get(\OCP\SystemTag\ISystemTagManager::class)));
208
+
209
+    $application->add(new OC\Core\Command\Security\ListCertificates(\OC::$server->getCertificateManager(), \OC::$server->getL10N('core')));
210
+    $application->add(new OC\Core\Command\Security\ImportCertificate(\OC::$server->getCertificateManager()));
211
+    $application->add(new OC\Core\Command\Security\RemoveCertificate(\OC::$server->getCertificateManager()));
212
+    $application->add(new OC\Core\Command\Security\ResetBruteforceAttempts(\OC::$server->getBruteForceThrottler()));
213 213
 } else {
214
-	$application->add(\OC::$server->get(\OC\Core\Command\Maintenance\Install::class));
214
+    $application->add(\OC::$server->get(\OC\Core\Command\Maintenance\Install::class));
215 215
 }
Please login to merge, or discard this patch.
core/Command/Info/Space.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -32,36 +32,36 @@
 block discarded – undo
32 32
 use Symfony\Component\Console\Output\OutputInterface;
33 33
 
34 34
 class Space extends Command {
35
-	private FileUtils $fileUtils;
35
+    private FileUtils $fileUtils;
36 36
 
37
-	public function __construct(FileUtils $fileUtils) {
38
-		$this->fileUtils = $fileUtils;
39
-		parent::__construct();
40
-	}
37
+    public function __construct(FileUtils $fileUtils) {
38
+        $this->fileUtils = $fileUtils;
39
+        parent::__construct();
40
+    }
41 41
 
42
-	protected function configure(): void {
43
-		$this
44
-			->setName('info:file:space')
45
-			->setDescription('Summarize space usage of specified folder')
46
-			->addArgument('file', InputArgument::REQUIRED, "File id or path")
47
-			->addOption('count', 'c', InputOption::VALUE_REQUIRED, "Number of items to display", 25)
48
-			->addOption('all', 'a', InputOption::VALUE_NONE, "Display all items");
49
-	}
42
+    protected function configure(): void {
43
+        $this
44
+            ->setName('info:file:space')
45
+            ->setDescription('Summarize space usage of specified folder')
46
+            ->addArgument('file', InputArgument::REQUIRED, "File id or path")
47
+            ->addOption('count', 'c', InputOption::VALUE_REQUIRED, "Number of items to display", 25)
48
+            ->addOption('all', 'a', InputOption::VALUE_NONE, "Display all items");
49
+    }
50 50
 
51
-	public function execute(InputInterface $input, OutputInterface $output): int {
52
-		$fileInput = $input->getArgument('file');
53
-		$count = (int)$input->getOption('count');
54
-		$all = $input->getOption('all');
55
-		$node = $this->fileUtils->getNode($fileInput);
56
-		if (!$node) {
57
-			$output->writeln("<error>file $fileInput not found</error>");
58
-			return 1;
59
-		}
60
-		$output->writeln($node->getName() . ": <info>" . Util::humanFileSize($node->getSize()) . "</info>");
61
-		if ($node instanceof Folder) {
62
-			$limits = $all ? [] : array_fill(0, $count - 1, 0);
63
-			$this->fileUtils->outputLargeFilesTree($output, $node, '', $limits, $all);
64
-		}
65
-		return 0;
66
-	}
51
+    public function execute(InputInterface $input, OutputInterface $output): int {
52
+        $fileInput = $input->getArgument('file');
53
+        $count = (int)$input->getOption('count');
54
+        $all = $input->getOption('all');
55
+        $node = $this->fileUtils->getNode($fileInput);
56
+        if (!$node) {
57
+            $output->writeln("<error>file $fileInput not found</error>");
58
+            return 1;
59
+        }
60
+        $output->writeln($node->getName() . ": <info>" . Util::humanFileSize($node->getSize()) . "</info>");
61
+        if ($node instanceof Folder) {
62
+            $limits = $all ? [] : array_fill(0, $count - 1, 0);
63
+            $this->fileUtils->outputLargeFilesTree($output, $node, '', $limits, $all);
64
+        }
65
+        return 0;
66
+    }
67 67
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,14 +50,14 @@
 block discarded – undo
50 50
 
51 51
 	public function execute(InputInterface $input, OutputInterface $output): int {
52 52
 		$fileInput = $input->getArgument('file');
53
-		$count = (int)$input->getOption('count');
53
+		$count = (int) $input->getOption('count');
54 54
 		$all = $input->getOption('all');
55 55
 		$node = $this->fileUtils->getNode($fileInput);
56 56
 		if (!$node) {
57 57
 			$output->writeln("<error>file $fileInput not found</error>");
58 58
 			return 1;
59 59
 		}
60
-		$output->writeln($node->getName() . ": <info>" . Util::humanFileSize($node->getSize()) . "</info>");
60
+		$output->writeln($node->getName().": <info>".Util::humanFileSize($node->getSize())."</info>");
61 61
 		if ($node instanceof Folder) {
62 62
 			$limits = $all ? [] : array_fill(0, $count - 1, 0);
63 63
 			$this->fileUtils->outputLargeFilesTree($output, $node, '', $limits, $all);
Please login to merge, or discard this patch.
core/Command/Info/File.php 2 patches
Indentation   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -22,120 +22,120 @@
 block discarded – undo
22 22
 use Symfony\Component\Console\Output\OutputInterface;
23 23
 
24 24
 class File extends Command {
25
-	private IL10N $l10n;
26
-	private FileUtils $fileUtils;
25
+    private IL10N $l10n;
26
+    private FileUtils $fileUtils;
27 27
 
28
-	public function __construct(IFactory $l10nFactory, FileUtils $fileUtils) {
29
-		$this->l10n = $l10nFactory->get("core");
30
-		$this->fileUtils = $fileUtils;
31
-		parent::__construct();
32
-	}
28
+    public function __construct(IFactory $l10nFactory, FileUtils $fileUtils) {
29
+        $this->l10n = $l10nFactory->get("core");
30
+        $this->fileUtils = $fileUtils;
31
+        parent::__construct();
32
+    }
33 33
 
34
-	protected function configure(): void {
35
-		$this
36
-			->setName('info:file')
37
-			->setDescription('get information for a file')
38
-			->addArgument('file', InputArgument::REQUIRED, "File id or path")
39
-			->addOption('children', 'c', InputOption::VALUE_NONE, "List children of folders");
40
-	}
34
+    protected function configure(): void {
35
+        $this
36
+            ->setName('info:file')
37
+            ->setDescription('get information for a file')
38
+            ->addArgument('file', InputArgument::REQUIRED, "File id or path")
39
+            ->addOption('children', 'c', InputOption::VALUE_NONE, "List children of folders");
40
+    }
41 41
 
42
-	public function execute(InputInterface $input, OutputInterface $output): int {
43
-		$fileInput = $input->getArgument('file');
44
-		$showChildren = $input->getOption('children');
45
-		$node = $this->fileUtils->getNode($fileInput);
46
-		if (!$node) {
47
-			$output->writeln("<error>file $fileInput not found</error>");
48
-			return 1;
49
-		}
42
+    public function execute(InputInterface $input, OutputInterface $output): int {
43
+        $fileInput = $input->getArgument('file');
44
+        $showChildren = $input->getOption('children');
45
+        $node = $this->fileUtils->getNode($fileInput);
46
+        if (!$node) {
47
+            $output->writeln("<error>file $fileInput not found</error>");
48
+            return 1;
49
+        }
50 50
 
51
-		$output->writeln($node->getName());
52
-		$output->writeln("  fileid: " . $node->getId());
53
-		$output->writeln("  mimetype: " . $node->getMimetype());
54
-		$output->writeln("  modified: " . (string)$this->l10n->l("datetime", $node->getMTime()));
55
-		$output->writeln("  " . ($node->isEncrypted() ? "encrypted" : "not encrypted"));
56
-		$output->writeln("  size: " . Util::humanFileSize($node->getSize()));
57
-		if ($node instanceof Folder) {
58
-			$children = $node->getDirectoryListing();
59
-			$childSize = array_sum(array_map(function (Node $node) {
60
-				return $node->getSize();
61
-			}, $children));
62
-			if ($childSize != $node->getSize()) {
63
-				$output->writeln("    <error>warning: folder has a size of " . Util::humanFileSize($node->getSize()) ." but it's children sum up to " . Util::humanFileSize($childSize) . "</error>.");
64
-				$output->writeln("    Run <info>occ files:scan --path " . $node->getPath() . "</info> to attempt to resolve this.");
65
-			}
66
-			if ($showChildren) {
67
-				$output->writeln("  children: " . count($children) . ":");
68
-				foreach ($children as $child) {
69
-					$output->writeln("  - " . $child->getName());
70
-				}
71
-			} else {
72
-				$output->writeln("  children: " . count($children) . " (use <info>--children</info> option to list)");
73
-			}
74
-		}
75
-		$this->outputStorageDetails($node->getMountPoint(), $node, $output);
51
+        $output->writeln($node->getName());
52
+        $output->writeln("  fileid: " . $node->getId());
53
+        $output->writeln("  mimetype: " . $node->getMimetype());
54
+        $output->writeln("  modified: " . (string)$this->l10n->l("datetime", $node->getMTime()));
55
+        $output->writeln("  " . ($node->isEncrypted() ? "encrypted" : "not encrypted"));
56
+        $output->writeln("  size: " . Util::humanFileSize($node->getSize()));
57
+        if ($node instanceof Folder) {
58
+            $children = $node->getDirectoryListing();
59
+            $childSize = array_sum(array_map(function (Node $node) {
60
+                return $node->getSize();
61
+            }, $children));
62
+            if ($childSize != $node->getSize()) {
63
+                $output->writeln("    <error>warning: folder has a size of " . Util::humanFileSize($node->getSize()) ." but it's children sum up to " . Util::humanFileSize($childSize) . "</error>.");
64
+                $output->writeln("    Run <info>occ files:scan --path " . $node->getPath() . "</info> to attempt to resolve this.");
65
+            }
66
+            if ($showChildren) {
67
+                $output->writeln("  children: " . count($children) . ":");
68
+                foreach ($children as $child) {
69
+                    $output->writeln("  - " . $child->getName());
70
+                }
71
+            } else {
72
+                $output->writeln("  children: " . count($children) . " (use <info>--children</info> option to list)");
73
+            }
74
+        }
75
+        $this->outputStorageDetails($node->getMountPoint(), $node, $output);
76 76
 
77
-		$filesPerUser = $this->fileUtils->getFilesByUser($node);
78
-		$output->writeln("");
79
-		$output->writeln("The following users have access to the file");
80
-		$output->writeln("");
81
-		foreach ($filesPerUser as $user => $files) {
82
-			$output->writeln("$user:");
83
-			foreach ($files as $userFile) {
84
-				$output->writeln("  " . $userFile->getPath() . ": " . $this->fileUtils->formatPermissions($userFile->getType(), $userFile->getPermissions()));
85
-				$mount = $userFile->getMountPoint();
86
-				$output->writeln("    " . $this->fileUtils->formatMountType($mount));
87
-			}
88
-		}
77
+        $filesPerUser = $this->fileUtils->getFilesByUser($node);
78
+        $output->writeln("");
79
+        $output->writeln("The following users have access to the file");
80
+        $output->writeln("");
81
+        foreach ($filesPerUser as $user => $files) {
82
+            $output->writeln("$user:");
83
+            foreach ($files as $userFile) {
84
+                $output->writeln("  " . $userFile->getPath() . ": " . $this->fileUtils->formatPermissions($userFile->getType(), $userFile->getPermissions()));
85
+                $mount = $userFile->getMountPoint();
86
+                $output->writeln("    " . $this->fileUtils->formatMountType($mount));
87
+            }
88
+        }
89 89
 
90
-		return 0;
91
-	}
90
+        return 0;
91
+    }
92 92
 
93
-	/**
94
-	 * @psalm-suppress UndefinedClass
95
-	 * @psalm-suppress UndefinedInterfaceMethod
96
-	 */
97
-	private function outputStorageDetails(IMountPoint $mountPoint, Node $node, OutputInterface $output): void {
98
-		$storage = $mountPoint->getStorage();
99
-		if (!$storage) {
100
-			return;
101
-		}
102
-		if (!$storage->instanceOfStorage(IHomeStorage::class)) {
103
-			$output->writeln("  mounted at: " . $mountPoint->getMountPoint());
104
-		}
105
-		if ($storage->instanceOfStorage(ObjectStoreStorage::class)) {
106
-			/** @var ObjectStoreStorage $storage */
107
-			$objectStoreId = $storage->getObjectStore()->getStorageId();
108
-			$parts = explode(':', $objectStoreId);
109
-			/** @var string $bucket */
110
-			$bucket = array_pop($parts);
111
-			$output->writeln("  bucket: " . $bucket);
112
-			if ($node instanceof \OC\Files\Node\File) {
113
-				$output->writeln("  object id: " . $storage->getURN($node->getId()));
114
-				try {
115
-					$fh = $node->fopen('r');
116
-					if (!$fh) {
117
-						throw new NotFoundException();
118
-					}
119
-					$stat = fstat($fh);
120
-					fclose($fh);
121
-					if ($stat['size'] !== $node->getSize()) {
122
-						$output->writeln("  <error>warning: object had a size of " . $stat['size'] . " but cache entry has a size of " . $node->getSize() . "</error>. This should have been automatically repaired");
123
-					}
124
-				} catch (\Exception $e) {
125
-					$output->writeln("  <error>warning: object not found in bucket</error>");
126
-				}
127
-			}
128
-		} else {
129
-			if (!$storage->file_exists($node->getInternalPath())) {
130
-				$output->writeln("  <error>warning: file not found in storage</error>");
131
-			}
132
-		}
133
-		if ($mountPoint instanceof ExternalMountPoint) {
134
-			$storageConfig = $mountPoint->getStorageConfig();
135
-			$output->writeln("  external storage id: " . $storageConfig->getId());
136
-			$output->writeln("  external type: " . $storageConfig->getBackend()->getText());
137
-		} elseif ($mountPoint instanceof GroupMountPoint) {
138
-			$output->writeln("  groupfolder id: " . $mountPoint->getFolderId());
139
-		}
140
-	}
93
+    /**
94
+     * @psalm-suppress UndefinedClass
95
+     * @psalm-suppress UndefinedInterfaceMethod
96
+     */
97
+    private function outputStorageDetails(IMountPoint $mountPoint, Node $node, OutputInterface $output): void {
98
+        $storage = $mountPoint->getStorage();
99
+        if (!$storage) {
100
+            return;
101
+        }
102
+        if (!$storage->instanceOfStorage(IHomeStorage::class)) {
103
+            $output->writeln("  mounted at: " . $mountPoint->getMountPoint());
104
+        }
105
+        if ($storage->instanceOfStorage(ObjectStoreStorage::class)) {
106
+            /** @var ObjectStoreStorage $storage */
107
+            $objectStoreId = $storage->getObjectStore()->getStorageId();
108
+            $parts = explode(':', $objectStoreId);
109
+            /** @var string $bucket */
110
+            $bucket = array_pop($parts);
111
+            $output->writeln("  bucket: " . $bucket);
112
+            if ($node instanceof \OC\Files\Node\File) {
113
+                $output->writeln("  object id: " . $storage->getURN($node->getId()));
114
+                try {
115
+                    $fh = $node->fopen('r');
116
+                    if (!$fh) {
117
+                        throw new NotFoundException();
118
+                    }
119
+                    $stat = fstat($fh);
120
+                    fclose($fh);
121
+                    if ($stat['size'] !== $node->getSize()) {
122
+                        $output->writeln("  <error>warning: object had a size of " . $stat['size'] . " but cache entry has a size of " . $node->getSize() . "</error>. This should have been automatically repaired");
123
+                    }
124
+                } catch (\Exception $e) {
125
+                    $output->writeln("  <error>warning: object not found in bucket</error>");
126
+                }
127
+            }
128
+        } else {
129
+            if (!$storage->file_exists($node->getInternalPath())) {
130
+                $output->writeln("  <error>warning: file not found in storage</error>");
131
+            }
132
+        }
133
+        if ($mountPoint instanceof ExternalMountPoint) {
134
+            $storageConfig = $mountPoint->getStorageConfig();
135
+            $output->writeln("  external storage id: " . $storageConfig->getId());
136
+            $output->writeln("  external type: " . $storageConfig->getBackend()->getText());
137
+        } elseif ($mountPoint instanceof GroupMountPoint) {
138
+            $output->writeln("  groupfolder id: " . $mountPoint->getFolderId());
139
+        }
140
+    }
141 141
 }
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -49,27 +49,27 @@  discard block
 block discarded – undo
49 49
 		}
50 50
 
51 51
 		$output->writeln($node->getName());
52
-		$output->writeln("  fileid: " . $node->getId());
53
-		$output->writeln("  mimetype: " . $node->getMimetype());
54
-		$output->writeln("  modified: " . (string)$this->l10n->l("datetime", $node->getMTime()));
55
-		$output->writeln("  " . ($node->isEncrypted() ? "encrypted" : "not encrypted"));
56
-		$output->writeln("  size: " . Util::humanFileSize($node->getSize()));
52
+		$output->writeln("  fileid: ".$node->getId());
53
+		$output->writeln("  mimetype: ".$node->getMimetype());
54
+		$output->writeln("  modified: ".(string) $this->l10n->l("datetime", $node->getMTime()));
55
+		$output->writeln("  ".($node->isEncrypted() ? "encrypted" : "not encrypted"));
56
+		$output->writeln("  size: ".Util::humanFileSize($node->getSize()));
57 57
 		if ($node instanceof Folder) {
58 58
 			$children = $node->getDirectoryListing();
59
-			$childSize = array_sum(array_map(function (Node $node) {
59
+			$childSize = array_sum(array_map(function(Node $node) {
60 60
 				return $node->getSize();
61 61
 			}, $children));
62 62
 			if ($childSize != $node->getSize()) {
63
-				$output->writeln("    <error>warning: folder has a size of " . Util::humanFileSize($node->getSize()) ." but it's children sum up to " . Util::humanFileSize($childSize) . "</error>.");
64
-				$output->writeln("    Run <info>occ files:scan --path " . $node->getPath() . "</info> to attempt to resolve this.");
63
+				$output->writeln("    <error>warning: folder has a size of ".Util::humanFileSize($node->getSize())." but it's children sum up to ".Util::humanFileSize($childSize)."</error>.");
64
+				$output->writeln("    Run <info>occ files:scan --path ".$node->getPath()."</info> to attempt to resolve this.");
65 65
 			}
66 66
 			if ($showChildren) {
67
-				$output->writeln("  children: " . count($children) . ":");
67
+				$output->writeln("  children: ".count($children).":");
68 68
 				foreach ($children as $child) {
69
-					$output->writeln("  - " . $child->getName());
69
+					$output->writeln("  - ".$child->getName());
70 70
 				}
71 71
 			} else {
72
-				$output->writeln("  children: " . count($children) . " (use <info>--children</info> option to list)");
72
+				$output->writeln("  children: ".count($children)." (use <info>--children</info> option to list)");
73 73
 			}
74 74
 		}
75 75
 		$this->outputStorageDetails($node->getMountPoint(), $node, $output);
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
 		foreach ($filesPerUser as $user => $files) {
82 82
 			$output->writeln("$user:");
83 83
 			foreach ($files as $userFile) {
84
-				$output->writeln("  " . $userFile->getPath() . ": " . $this->fileUtils->formatPermissions($userFile->getType(), $userFile->getPermissions()));
84
+				$output->writeln("  ".$userFile->getPath().": ".$this->fileUtils->formatPermissions($userFile->getType(), $userFile->getPermissions()));
85 85
 				$mount = $userFile->getMountPoint();
86
-				$output->writeln("    " . $this->fileUtils->formatMountType($mount));
86
+				$output->writeln("    ".$this->fileUtils->formatMountType($mount));
87 87
 			}
88 88
 		}
89 89
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 			return;
101 101
 		}
102 102
 		if (!$storage->instanceOfStorage(IHomeStorage::class)) {
103
-			$output->writeln("  mounted at: " . $mountPoint->getMountPoint());
103
+			$output->writeln("  mounted at: ".$mountPoint->getMountPoint());
104 104
 		}
105 105
 		if ($storage->instanceOfStorage(ObjectStoreStorage::class)) {
106 106
 			/** @var ObjectStoreStorage $storage */
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
 			$parts = explode(':', $objectStoreId);
109 109
 			/** @var string $bucket */
110 110
 			$bucket = array_pop($parts);
111
-			$output->writeln("  bucket: " . $bucket);
111
+			$output->writeln("  bucket: ".$bucket);
112 112
 			if ($node instanceof \OC\Files\Node\File) {
113
-				$output->writeln("  object id: " . $storage->getURN($node->getId()));
113
+				$output->writeln("  object id: ".$storage->getURN($node->getId()));
114 114
 				try {
115 115
 					$fh = $node->fopen('r');
116 116
 					if (!$fh) {
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 					$stat = fstat($fh);
120 120
 					fclose($fh);
121 121
 					if ($stat['size'] !== $node->getSize()) {
122
-						$output->writeln("  <error>warning: object had a size of " . $stat['size'] . " but cache entry has a size of " . $node->getSize() . "</error>. This should have been automatically repaired");
122
+						$output->writeln("  <error>warning: object had a size of ".$stat['size']." but cache entry has a size of ".$node->getSize()."</error>. This should have been automatically repaired");
123 123
 					}
124 124
 				} catch (\Exception $e) {
125 125
 					$output->writeln("  <error>warning: object not found in bucket</error>");
@@ -132,10 +132,10 @@  discard block
 block discarded – undo
132 132
 		}
133 133
 		if ($mountPoint instanceof ExternalMountPoint) {
134 134
 			$storageConfig = $mountPoint->getStorageConfig();
135
-			$output->writeln("  external storage id: " . $storageConfig->getId());
136
-			$output->writeln("  external type: " . $storageConfig->getBackend()->getText());
135
+			$output->writeln("  external storage id: ".$storageConfig->getId());
136
+			$output->writeln("  external type: ".$storageConfig->getBackend()->getText());
137 137
 		} elseif ($mountPoint instanceof GroupMountPoint) {
138
-			$output->writeln("  groupfolder id: " . $mountPoint->getFolderId());
138
+			$output->writeln("  groupfolder id: ".$mountPoint->getFolderId());
139 139
 		}
140 140
 	}
141 141
 }
Please login to merge, or discard this patch.
core/Command/Info/FileUtils.php 2 patches
Indentation   +208 added lines, -208 removed lines patch added patch discarded remove patch
@@ -43,212 +43,212 @@
 block discarded – undo
43 43
 use OCP\Files\Folder;
44 44
 
45 45
 class FileUtils {
46
-	private IRootFolder $rootFolder;
47
-	private IUserMountCache $userMountCache;
48
-	private IMountManager $mountManager;
49
-	private SetupManager $setupManager;
50
-
51
-	public function __construct(
52
-		IRootFolder $rootFolder,
53
-		IUserMountCache $userMountCache,
54
-		IMountManager $mountManager,
55
-		SetupManager $setupManager
56
-	) {
57
-		$this->rootFolder = $rootFolder;
58
-		$this->userMountCache = $userMountCache;
59
-		$this->mountManager = $mountManager;
60
-		$this->setupManager = $setupManager;
61
-	}
62
-
63
-	/**
64
-	 * @param FileInfo $file
65
-	 * @return array<string, Node[]>
66
-	 * @throws \OCP\Files\NotPermittedException
67
-	 * @throws \OC\User\NoUserException
68
-	 */
69
-	public function getFilesByUser(FileInfo $file): array {
70
-		$id = $file->getId();
71
-		if (!$id) {
72
-			return [];
73
-		}
74
-
75
-		$mounts = $this->userMountCache->getMountsForFileId($id);
76
-		$result = [];
77
-		foreach ($mounts as $mount) {
78
-			if (isset($result[$mount->getUser()->getUID()])) {
79
-				continue;
80
-			}
81
-
82
-			$userFolder = $this->rootFolder->getUserFolder($mount->getUser()->getUID());
83
-			$result[$mount->getUser()->getUID()] = $userFolder->getById($id);
84
-		}
85
-
86
-		return $result;
87
-	}
88
-
89
-	/**
90
-	 * Get file by either id of path
91
-	 *
92
-	 * @param string $fileInput
93
-	 * @return Node|null
94
-	 */
95
-	public function getNode(string $fileInput): ?Node {
96
-		if (is_numeric($fileInput)) {
97
-			$mounts = $this->userMountCache->getMountsForFileId((int)$fileInput);
98
-			if (!$mounts) {
99
-				return null;
100
-			}
101
-			$mount = $mounts[0];
102
-			$userFolder = $this->rootFolder->getUserFolder($mount->getUser()->getUID());
103
-			$nodes = $userFolder->getById((int)$fileInput);
104
-			if (!$nodes) {
105
-				return null;
106
-			}
107
-			return $nodes[0];
108
-		} else {
109
-			try {
110
-				return $this->rootFolder->get($fileInput);
111
-			} catch (NotFoundException $e) {
112
-				return null;
113
-			}
114
-		}
115
-	}
116
-
117
-	public function formatPermissions(string $type, int $permissions): string {
118
-		if ($permissions == Constants::PERMISSION_ALL || ($type === 'file' && $permissions == (Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE))) {
119
-			return "full permissions";
120
-		}
121
-
122
-		$perms = [];
123
-		$allPerms = [Constants::PERMISSION_READ => "read", Constants::PERMISSION_UPDATE => "update", Constants::PERMISSION_CREATE => "create", Constants::PERMISSION_DELETE => "delete", Constants::PERMISSION_SHARE => "share"];
124
-		foreach ($allPerms as $perm => $name) {
125
-			if (($permissions & $perm) === $perm) {
126
-				$perms[] = $name;
127
-			}
128
-		}
129
-
130
-		return implode(", ", $perms);
131
-	}
132
-
133
-	/**
134
-	 * @psalm-suppress UndefinedClass
135
-	 * @psalm-suppress UndefinedInterfaceMethod
136
-	 */
137
-	public function formatMountType(IMountPoint $mountPoint): string {
138
-		$storage = $mountPoint->getStorage();
139
-		if ($storage && $storage->instanceOfStorage(IHomeStorage::class)) {
140
-			return "home storage";
141
-		} elseif ($mountPoint instanceof SharedMount) {
142
-			$share = $mountPoint->getShare();
143
-			$shares = $mountPoint->getGroupedShares();
144
-			$sharedBy = array_map(function (IShare $share) {
145
-				$shareType = $this->formatShareType($share);
146
-				if ($shareType) {
147
-					return $share->getSharedBy() . " (via " . $shareType . " " . $share->getSharedWith() . ")";
148
-				} else {
149
-					return $share->getSharedBy();
150
-				}
151
-			}, $shares);
152
-			$description = "shared by " . implode(', ', $sharedBy);
153
-			if ($share->getSharedBy() !== $share->getShareOwner()) {
154
-				$description .= " owned by " . $share->getShareOwner();
155
-			}
156
-			return $description;
157
-		} elseif ($mountPoint instanceof GroupMountPoint) {
158
-			return "groupfolder " . $mountPoint->getFolderId();
159
-		} elseif ($mountPoint instanceof ExternalMountPoint) {
160
-			return "external storage " . $mountPoint->getStorageConfig()->getId();
161
-		} elseif ($mountPoint instanceof CircleMount) {
162
-			return "circle";
163
-		}
164
-		return get_class($mountPoint);
165
-	}
166
-
167
-	public function formatShareType(IShare $share): ?string {
168
-		switch ($share->getShareType()) {
169
-			case IShare::TYPE_GROUP:
170
-				return "group";
171
-			case IShare::TYPE_CIRCLE:
172
-				return "circle";
173
-			case IShare::TYPE_DECK:
174
-				return "deck";
175
-			case IShare::TYPE_ROOM:
176
-				return "room";
177
-			case IShare::TYPE_USER:
178
-				return null;
179
-			default:
180
-				return "Unknown (" . $share->getShareType() . ")";
181
-		}
182
-	}
183
-
184
-	/**
185
-	 * Print out the largest count($sizeLimits) files in the directory tree
186
-	 *
187
-	 * @param OutputInterface $output
188
-	 * @param Folder $node
189
-	 * @param string $prefix
190
-	 * @param array $sizeLimits largest items that are still in the queue to be printed, ordered ascending
191
-	 * @return int how many items we've printed
192
-	 */
193
-	public function outputLargeFilesTree(
194
-		OutputInterface $output,
195
-		Folder $node,
196
-		string $prefix,
197
-		array &$sizeLimits,
198
-		bool $all,
199
-	): int {
200
-		/**
201
-		 * Algorithm to print the N largest items in a folder without requiring to query or sort the entire three
202
-		 *
203
-		 * This is done by keeping a list ($sizeLimits) of size N that contain the largest items outside of this
204
-		 * folders that are could be printed if there aren't enough items in this folder that are larger.
205
-		 *
206
-		 * We loop over the items in this folder by size descending until the size of the item falls before the smallest
207
-		 * size in $sizeLimits (at that point there are enough items outside this folder to complete the N items).
208
-		 *
209
-		 * When encountering a folder, we create an updated $sizeLimits with the largest items in the current folder still
210
-		 * remaining which we pass into the recursion. (We don't update the current $sizeLimits because that should only
211
-		 * hold items *outside* of the current folder.)
212
-		 *
213
-		 * For every item printed we remove the first item of $sizeLimits are there is no longer room in the output to print
214
-		 * items that small.
215
-		 */
216
-
217
-		$count = 0;
218
-		$children = $node->getDirectoryListing();
219
-		usort($children, function (Node $a, Node $b) {
220
-			return $b->getSize() <=> $a->getSize();
221
-		});
222
-		foreach ($children as $i => $child) {
223
-			if (!$all) {
224
-				if (count($sizeLimits) === 0 || $child->getSize() < $sizeLimits[0]) {
225
-					return $count;
226
-				}
227
-				array_shift($sizeLimits);
228
-			}
229
-			$count += 1;
230
-
231
-			/** @var Node $child */
232
-			$output->writeln("$prefix- " . $child->getName() . ": <info>" . Util::humanFileSize($child->getSize()) . "</info>");
233
-			if ($child instanceof Folder) {
234
-				$recurseSizeLimits = $sizeLimits;
235
-				if (!$all) {
236
-					for ($j = 0; $j < count($recurseSizeLimits); $j++) {
237
-						if (isset($children[$i + $j + 1])) {
238
-							$nextChildSize = $children[$i + $j + 1]->getSize();
239
-							if ($nextChildSize > $recurseSizeLimits[0]) {
240
-								array_shift($recurseSizeLimits);
241
-								$recurseSizeLimits[] = $nextChildSize;
242
-							}
243
-						}
244
-					}
245
-					sort($recurseSizeLimits);
246
-				}
247
-				$recurseCount = $this->outputLargeFilesTree($output, $child, $prefix . "  ", $recurseSizeLimits, $all);
248
-				$sizeLimits = array_slice($sizeLimits, $recurseCount);
249
-				$count += $recurseCount;
250
-			}
251
-		}
252
-		return $count;
253
-	}
46
+    private IRootFolder $rootFolder;
47
+    private IUserMountCache $userMountCache;
48
+    private IMountManager $mountManager;
49
+    private SetupManager $setupManager;
50
+
51
+    public function __construct(
52
+        IRootFolder $rootFolder,
53
+        IUserMountCache $userMountCache,
54
+        IMountManager $mountManager,
55
+        SetupManager $setupManager
56
+    ) {
57
+        $this->rootFolder = $rootFolder;
58
+        $this->userMountCache = $userMountCache;
59
+        $this->mountManager = $mountManager;
60
+        $this->setupManager = $setupManager;
61
+    }
62
+
63
+    /**
64
+     * @param FileInfo $file
65
+     * @return array<string, Node[]>
66
+     * @throws \OCP\Files\NotPermittedException
67
+     * @throws \OC\User\NoUserException
68
+     */
69
+    public function getFilesByUser(FileInfo $file): array {
70
+        $id = $file->getId();
71
+        if (!$id) {
72
+            return [];
73
+        }
74
+
75
+        $mounts = $this->userMountCache->getMountsForFileId($id);
76
+        $result = [];
77
+        foreach ($mounts as $mount) {
78
+            if (isset($result[$mount->getUser()->getUID()])) {
79
+                continue;
80
+            }
81
+
82
+            $userFolder = $this->rootFolder->getUserFolder($mount->getUser()->getUID());
83
+            $result[$mount->getUser()->getUID()] = $userFolder->getById($id);
84
+        }
85
+
86
+        return $result;
87
+    }
88
+
89
+    /**
90
+     * Get file by either id of path
91
+     *
92
+     * @param string $fileInput
93
+     * @return Node|null
94
+     */
95
+    public function getNode(string $fileInput): ?Node {
96
+        if (is_numeric($fileInput)) {
97
+            $mounts = $this->userMountCache->getMountsForFileId((int)$fileInput);
98
+            if (!$mounts) {
99
+                return null;
100
+            }
101
+            $mount = $mounts[0];
102
+            $userFolder = $this->rootFolder->getUserFolder($mount->getUser()->getUID());
103
+            $nodes = $userFolder->getById((int)$fileInput);
104
+            if (!$nodes) {
105
+                return null;
106
+            }
107
+            return $nodes[0];
108
+        } else {
109
+            try {
110
+                return $this->rootFolder->get($fileInput);
111
+            } catch (NotFoundException $e) {
112
+                return null;
113
+            }
114
+        }
115
+    }
116
+
117
+    public function formatPermissions(string $type, int $permissions): string {
118
+        if ($permissions == Constants::PERMISSION_ALL || ($type === 'file' && $permissions == (Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE))) {
119
+            return "full permissions";
120
+        }
121
+
122
+        $perms = [];
123
+        $allPerms = [Constants::PERMISSION_READ => "read", Constants::PERMISSION_UPDATE => "update", Constants::PERMISSION_CREATE => "create", Constants::PERMISSION_DELETE => "delete", Constants::PERMISSION_SHARE => "share"];
124
+        foreach ($allPerms as $perm => $name) {
125
+            if (($permissions & $perm) === $perm) {
126
+                $perms[] = $name;
127
+            }
128
+        }
129
+
130
+        return implode(", ", $perms);
131
+    }
132
+
133
+    /**
134
+     * @psalm-suppress UndefinedClass
135
+     * @psalm-suppress UndefinedInterfaceMethod
136
+     */
137
+    public function formatMountType(IMountPoint $mountPoint): string {
138
+        $storage = $mountPoint->getStorage();
139
+        if ($storage && $storage->instanceOfStorage(IHomeStorage::class)) {
140
+            return "home storage";
141
+        } elseif ($mountPoint instanceof SharedMount) {
142
+            $share = $mountPoint->getShare();
143
+            $shares = $mountPoint->getGroupedShares();
144
+            $sharedBy = array_map(function (IShare $share) {
145
+                $shareType = $this->formatShareType($share);
146
+                if ($shareType) {
147
+                    return $share->getSharedBy() . " (via " . $shareType . " " . $share->getSharedWith() . ")";
148
+                } else {
149
+                    return $share->getSharedBy();
150
+                }
151
+            }, $shares);
152
+            $description = "shared by " . implode(', ', $sharedBy);
153
+            if ($share->getSharedBy() !== $share->getShareOwner()) {
154
+                $description .= " owned by " . $share->getShareOwner();
155
+            }
156
+            return $description;
157
+        } elseif ($mountPoint instanceof GroupMountPoint) {
158
+            return "groupfolder " . $mountPoint->getFolderId();
159
+        } elseif ($mountPoint instanceof ExternalMountPoint) {
160
+            return "external storage " . $mountPoint->getStorageConfig()->getId();
161
+        } elseif ($mountPoint instanceof CircleMount) {
162
+            return "circle";
163
+        }
164
+        return get_class($mountPoint);
165
+    }
166
+
167
+    public function formatShareType(IShare $share): ?string {
168
+        switch ($share->getShareType()) {
169
+            case IShare::TYPE_GROUP:
170
+                return "group";
171
+            case IShare::TYPE_CIRCLE:
172
+                return "circle";
173
+            case IShare::TYPE_DECK:
174
+                return "deck";
175
+            case IShare::TYPE_ROOM:
176
+                return "room";
177
+            case IShare::TYPE_USER:
178
+                return null;
179
+            default:
180
+                return "Unknown (" . $share->getShareType() . ")";
181
+        }
182
+    }
183
+
184
+    /**
185
+     * Print out the largest count($sizeLimits) files in the directory tree
186
+     *
187
+     * @param OutputInterface $output
188
+     * @param Folder $node
189
+     * @param string $prefix
190
+     * @param array $sizeLimits largest items that are still in the queue to be printed, ordered ascending
191
+     * @return int how many items we've printed
192
+     */
193
+    public function outputLargeFilesTree(
194
+        OutputInterface $output,
195
+        Folder $node,
196
+        string $prefix,
197
+        array &$sizeLimits,
198
+        bool $all,
199
+    ): int {
200
+        /**
201
+         * Algorithm to print the N largest items in a folder without requiring to query or sort the entire three
202
+         *
203
+         * This is done by keeping a list ($sizeLimits) of size N that contain the largest items outside of this
204
+         * folders that are could be printed if there aren't enough items in this folder that are larger.
205
+         *
206
+         * We loop over the items in this folder by size descending until the size of the item falls before the smallest
207
+         * size in $sizeLimits (at that point there are enough items outside this folder to complete the N items).
208
+         *
209
+         * When encountering a folder, we create an updated $sizeLimits with the largest items in the current folder still
210
+         * remaining which we pass into the recursion. (We don't update the current $sizeLimits because that should only
211
+         * hold items *outside* of the current folder.)
212
+         *
213
+         * For every item printed we remove the first item of $sizeLimits are there is no longer room in the output to print
214
+         * items that small.
215
+         */
216
+
217
+        $count = 0;
218
+        $children = $node->getDirectoryListing();
219
+        usort($children, function (Node $a, Node $b) {
220
+            return $b->getSize() <=> $a->getSize();
221
+        });
222
+        foreach ($children as $i => $child) {
223
+            if (!$all) {
224
+                if (count($sizeLimits) === 0 || $child->getSize() < $sizeLimits[0]) {
225
+                    return $count;
226
+                }
227
+                array_shift($sizeLimits);
228
+            }
229
+            $count += 1;
230
+
231
+            /** @var Node $child */
232
+            $output->writeln("$prefix- " . $child->getName() . ": <info>" . Util::humanFileSize($child->getSize()) . "</info>");
233
+            if ($child instanceof Folder) {
234
+                $recurseSizeLimits = $sizeLimits;
235
+                if (!$all) {
236
+                    for ($j = 0; $j < count($recurseSizeLimits); $j++) {
237
+                        if (isset($children[$i + $j + 1])) {
238
+                            $nextChildSize = $children[$i + $j + 1]->getSize();
239
+                            if ($nextChildSize > $recurseSizeLimits[0]) {
240
+                                array_shift($recurseSizeLimits);
241
+                                $recurseSizeLimits[] = $nextChildSize;
242
+                            }
243
+                        }
244
+                    }
245
+                    sort($recurseSizeLimits);
246
+                }
247
+                $recurseCount = $this->outputLargeFilesTree($output, $child, $prefix . "  ", $recurseSizeLimits, $all);
248
+                $sizeLimits = array_slice($sizeLimits, $recurseCount);
249
+                $count += $recurseCount;
250
+            }
251
+        }
252
+        return $count;
253
+    }
254 254
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -94,13 +94,13 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	public function getNode(string $fileInput): ?Node {
96 96
 		if (is_numeric($fileInput)) {
97
-			$mounts = $this->userMountCache->getMountsForFileId((int)$fileInput);
97
+			$mounts = $this->userMountCache->getMountsForFileId((int) $fileInput);
98 98
 			if (!$mounts) {
99 99
 				return null;
100 100
 			}
101 101
 			$mount = $mounts[0];
102 102
 			$userFolder = $this->rootFolder->getUserFolder($mount->getUser()->getUID());
103
-			$nodes = $userFolder->getById((int)$fileInput);
103
+			$nodes = $userFolder->getById((int) $fileInput);
104 104
 			if (!$nodes) {
105 105
 				return null;
106 106
 			}
@@ -141,23 +141,23 @@  discard block
 block discarded – undo
141 141
 		} elseif ($mountPoint instanceof SharedMount) {
142 142
 			$share = $mountPoint->getShare();
143 143
 			$shares = $mountPoint->getGroupedShares();
144
-			$sharedBy = array_map(function (IShare $share) {
144
+			$sharedBy = array_map(function(IShare $share) {
145 145
 				$shareType = $this->formatShareType($share);
146 146
 				if ($shareType) {
147
-					return $share->getSharedBy() . " (via " . $shareType . " " . $share->getSharedWith() . ")";
147
+					return $share->getSharedBy()." (via ".$shareType." ".$share->getSharedWith().")";
148 148
 				} else {
149 149
 					return $share->getSharedBy();
150 150
 				}
151 151
 			}, $shares);
152
-			$description = "shared by " . implode(', ', $sharedBy);
152
+			$description = "shared by ".implode(', ', $sharedBy);
153 153
 			if ($share->getSharedBy() !== $share->getShareOwner()) {
154
-				$description .= " owned by " . $share->getShareOwner();
154
+				$description .= " owned by ".$share->getShareOwner();
155 155
 			}
156 156
 			return $description;
157 157
 		} elseif ($mountPoint instanceof GroupMountPoint) {
158
-			return "groupfolder " . $mountPoint->getFolderId();
158
+			return "groupfolder ".$mountPoint->getFolderId();
159 159
 		} elseif ($mountPoint instanceof ExternalMountPoint) {
160
-			return "external storage " . $mountPoint->getStorageConfig()->getId();
160
+			return "external storage ".$mountPoint->getStorageConfig()->getId();
161 161
 		} elseif ($mountPoint instanceof CircleMount) {
162 162
 			return "circle";
163 163
 		}
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 			case IShare::TYPE_USER:
178 178
 				return null;
179 179
 			default:
180
-				return "Unknown (" . $share->getShareType() . ")";
180
+				return "Unknown (".$share->getShareType().")";
181 181
 		}
182 182
 	}
183 183
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 
217 217
 		$count = 0;
218 218
 		$children = $node->getDirectoryListing();
219
-		usort($children, function (Node $a, Node $b) {
219
+		usort($children, function(Node $a, Node $b) {
220 220
 			return $b->getSize() <=> $a->getSize();
221 221
 		});
222 222
 		foreach ($children as $i => $child) {
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 			$count += 1;
230 230
 
231 231
 			/** @var Node $child */
232
-			$output->writeln("$prefix- " . $child->getName() . ": <info>" . Util::humanFileSize($child->getSize()) . "</info>");
232
+			$output->writeln("$prefix- ".$child->getName().": <info>".Util::humanFileSize($child->getSize())."</info>");
233 233
 			if ($child instanceof Folder) {
234 234
 				$recurseSizeLimits = $sizeLimits;
235 235
 				if (!$all) {
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 					}
245 245
 					sort($recurseSizeLimits);
246 246
 				}
247
-				$recurseCount = $this->outputLargeFilesTree($output, $child, $prefix . "  ", $recurseSizeLimits, $all);
247
+				$recurseCount = $this->outputLargeFilesTree($output, $child, $prefix."  ", $recurseSizeLimits, $all);
248 248
 				$sizeLimits = array_slice($sizeLimits, $recurseCount);
249 249
 				$count += $recurseCount;
250 250
 			}
Please login to merge, or discard this patch.