Passed
Push — master ( a761e5...06eb23 )
by Morris
28:30 queued 11:17
created
lib/private/Preview/Storage/Root.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -32,51 +32,51 @@
 block discarded – undo
32 32
 use OCP\Files\SimpleFS\ISimpleFolder;
33 33
 
34 34
 class Root extends AppData {
35
-	private $isMultibucketPreviewDistributionEnabled = false;
36
-	public function __construct(IRootFolder $rootFolder, SystemConfig $systemConfig) {
37
-		parent::__construct($rootFolder, $systemConfig, 'preview');
35
+    private $isMultibucketPreviewDistributionEnabled = false;
36
+    public function __construct(IRootFolder $rootFolder, SystemConfig $systemConfig) {
37
+        parent::__construct($rootFolder, $systemConfig, 'preview');
38 38
 
39
-		$this->isMultibucketPreviewDistributionEnabled = $systemConfig->getValue('objectstore.multibucket.preview-distribution', false) === true;
40
-	}
39
+        $this->isMultibucketPreviewDistributionEnabled = $systemConfig->getValue('objectstore.multibucket.preview-distribution', false) === true;
40
+    }
41 41
 
42 42
 
43
-	public function getFolder(string $name): ISimpleFolder {
44
-		$internalFolder = self::getInternalFolder($name);
43
+    public function getFolder(string $name): ISimpleFolder {
44
+        $internalFolder = self::getInternalFolder($name);
45 45
 
46
-		if ($this->isMultibucketPreviewDistributionEnabled) {
47
-			try {
48
-				return parent::getFolder('old-multibucket/' . $internalFolder);
49
-			} catch (NotFoundException $e) {
50
-				// not in multibucket fallback
51
-			}
52
-		}
46
+        if ($this->isMultibucketPreviewDistributionEnabled) {
47
+            try {
48
+                return parent::getFolder('old-multibucket/' . $internalFolder);
49
+            } catch (NotFoundException $e) {
50
+                // not in multibucket fallback
51
+            }
52
+        }
53 53
 
54
-		try {
55
-			return parent::getFolder($internalFolder);
56
-		} catch (NotFoundException $e) {
57
-			/*
54
+        try {
55
+            return parent::getFolder($internalFolder);
56
+        } catch (NotFoundException $e) {
57
+            /*
58 58
 			 * The new folder structure is not found.
59 59
 			 * Lets try the old one
60 60
 			 */
61
-		}
61
+        }
62 62
 
63
-		return parent::getFolder($name);
64
-	}
63
+        return parent::getFolder($name);
64
+    }
65 65
 
66
-	public function newFolder(string $name): ISimpleFolder {
67
-		$internalFolder = self::getInternalFolder($name);
68
-		return parent::newFolder($internalFolder);
69
-	}
66
+    public function newFolder(string $name): ISimpleFolder {
67
+        $internalFolder = self::getInternalFolder($name);
68
+        return parent::newFolder($internalFolder);
69
+    }
70 70
 
71
-	/*
71
+    /*
72 72
 	 * Do not allow directory listing on this special root
73 73
 	 * since it gets to big and time consuming
74 74
 	 */
75
-	public function getDirectoryListing(): array {
76
-		return [];
77
-	}
75
+    public function getDirectoryListing(): array {
76
+        return [];
77
+    }
78 78
 
79
-	public static function getInternalFolder(string $name): string {
80
-		return implode('/', str_split(substr(md5($name), 0, 7))) . '/' . $name;
81
-	}
79
+    public static function getInternalFolder(string $name): string {
80
+        return implode('/', str_split(substr(md5($name), 0, 7))) . '/' . $name;
81
+    }
82 82
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
 		if ($this->isMultibucketPreviewDistributionEnabled) {
47 47
 			try {
48
-				return parent::getFolder('old-multibucket/' . $internalFolder);
48
+				return parent::getFolder('old-multibucket/'.$internalFolder);
49 49
 			} catch (NotFoundException $e) {
50 50
 				// not in multibucket fallback
51 51
 			}
@@ -77,6 +77,6 @@  discard block
 block discarded – undo
77 77
 	}
78 78
 
79 79
 	public static function getInternalFolder(string $name): string {
80
-		return implode('/', str_split(substr(md5($name), 0, 7))) . '/' . $name;
80
+		return implode('/', str_split(substr(md5($name), 0, 7))).'/'.$name;
81 81
 	}
82 82
 }
Please login to merge, or discard this patch.
core/register_command.php 1 patch
Indentation   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -49,135 +49,135 @@
 block discarded – undo
49 49
 $application->add(new OC\Core\Command\App\CheckCode());
50 50
 $application->add(new OC\Core\Command\L10n\CreateJs());
51 51
 $application->add(new \OC\Core\Command\Integrity\SignApp(
52
-		\OC::$server->getIntegrityCodeChecker(),
53
-		new \OC\IntegrityCheck\Helpers\FileAccessHelper(),
54
-		\OC::$server->getURLGenerator()
52
+        \OC::$server->getIntegrityCodeChecker(),
53
+        new \OC\IntegrityCheck\Helpers\FileAccessHelper(),
54
+        \OC::$server->getURLGenerator()
55 55
 ));
56 56
 $application->add(new \OC\Core\Command\Integrity\SignCore(
57
-		\OC::$server->getIntegrityCodeChecker(),
58
-		new \OC\IntegrityCheck\Helpers\FileAccessHelper()
57
+        \OC::$server->getIntegrityCodeChecker(),
58
+        new \OC\IntegrityCheck\Helpers\FileAccessHelper()
59 59
 ));
60 60
 $application->add(new \OC\Core\Command\Integrity\CheckApp(
61
-		\OC::$server->getIntegrityCodeChecker()
61
+        \OC::$server->getIntegrityCodeChecker()
62 62
 ));
63 63
 $application->add(new \OC\Core\Command\Integrity\CheckCore(
64
-		\OC::$server->getIntegrityCodeChecker()
64
+        \OC::$server->getIntegrityCodeChecker()
65 65
 ));
66 66
 
67 67
 
68 68
 if (\OC::$server->getConfig()->getSystemValue('installed', false)) {
69
-	$application->add(new OC\Core\Command\App\Disable(\OC::$server->getAppManager()));
70
-	$application->add(new OC\Core\Command\App\Enable(\OC::$server->getAppManager(), \OC::$server->getGroupManager()));
71
-	$application->add(new OC\Core\Command\App\Install());
72
-	$application->add(new OC\Core\Command\App\GetPath());
73
-	$application->add(new OC\Core\Command\App\ListApps(\OC::$server->getAppManager()));
74
-	$application->add(new OC\Core\Command\App\Remove(\OC::$server->getAppManager(), \OC::$server->query(\OC\Installer::class), \OC::$server->getLogger()));
75
-	$application->add(\OC::$server->query(\OC\Core\Command\App\Update::class));
76
-
77
-	$application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Cleanup::class));
78
-	$application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Enforce::class));
79
-	$application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Enable::class));
80
-	$application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Disable::class));
81
-	$application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\State::class));
82
-
83
-	$application->add(new OC\Core\Command\Background\Cron(\OC::$server->getConfig()));
84
-	$application->add(new OC\Core\Command\Background\WebCron(\OC::$server->getConfig()));
85
-	$application->add(new OC\Core\Command\Background\Ajax(\OC::$server->getConfig()));
86
-
87
-	$application->add(\OC::$server->query(\OC\Core\Command\Broadcast\Test::class));
88
-
89
-	$application->add(new OC\Core\Command\Config\App\DeleteConfig(\OC::$server->getConfig()));
90
-	$application->add(new OC\Core\Command\Config\App\GetConfig(\OC::$server->getConfig()));
91
-	$application->add(new OC\Core\Command\Config\App\SetConfig(\OC::$server->getConfig()));
92
-	$application->add(new OC\Core\Command\Config\Import(\OC::$server->getConfig()));
93
-	$application->add(new OC\Core\Command\Config\ListConfigs(\OC::$server->getSystemConfig(), \OC::$server->getAppConfig()));
94
-	$application->add(new OC\Core\Command\Config\System\DeleteConfig(\OC::$server->getSystemConfig()));
95
-	$application->add(new OC\Core\Command\Config\System\GetConfig(\OC::$server->getSystemConfig()));
96
-	$application->add(new OC\Core\Command\Config\System\SetConfig(\OC::$server->getSystemConfig()));
97
-
98
-	$application->add(new OC\Core\Command\Db\ConvertType(\OC::$server->getConfig(), new \OC\DB\ConnectionFactory(\OC::$server->getSystemConfig())));
99
-	$application->add(new OC\Core\Command\Db\ConvertMysqlToMB4(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection(), \OC::$server->getURLGenerator(), \OC::$server->getLogger()));
100
-	$application->add(new OC\Core\Command\Db\ConvertFilecacheBigInt(\OC::$server->getDatabaseConnection()));
101
-	$application->add(new OC\Core\Command\Db\AddMissingIndices(\OC::$server->getDatabaseConnection(), \OC::$server->getEventDispatcher()));
102
-	$application->add(new OC\Core\Command\Db\AddMissingColumns(\OC::$server->getDatabaseConnection(), \OC::$server->getEventDispatcher()));
103
-	$application->add(new OC\Core\Command\Db\Migrations\StatusCommand(\OC::$server->getDatabaseConnection()));
104
-	$application->add(new OC\Core\Command\Db\Migrations\MigrateCommand(\OC::$server->getDatabaseConnection()));
105
-	$application->add(new OC\Core\Command\Db\Migrations\GenerateCommand(\OC::$server->getDatabaseConnection(), \OC::$server->getAppManager()));
106
-	$application->add(new OC\Core\Command\Db\Migrations\GenerateFromSchemaFileCommand(\OC::$server->getConfig(), \OC::$server->getAppManager(), \OC::$server->getDatabaseConnection()));
107
-	$application->add(new OC\Core\Command\Db\Migrations\ExecuteCommand(\OC::$server->getDatabaseConnection(), \OC::$server->getAppManager(), \OC::$server->getConfig()));
108
-
109
-	$application->add(new OC\Core\Command\Encryption\Disable(\OC::$server->getConfig()));
110
-	$application->add(new OC\Core\Command\Encryption\Enable(\OC::$server->getConfig(), \OC::$server->getEncryptionManager()));
111
-	$application->add(new OC\Core\Command\Encryption\ListModules(\OC::$server->getEncryptionManager(), \OC::$server->getConfig()));
112
-	$application->add(new OC\Core\Command\Encryption\SetDefaultModule(\OC::$server->getEncryptionManager(), \OC::$server->getConfig()));
113
-	$application->add(new OC\Core\Command\Encryption\Status(\OC::$server->getEncryptionManager()));
114
-	$application->add(new OC\Core\Command\Encryption\EncryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getAppManager(), \OC::$server->getConfig(), new \Symfony\Component\Console\Helper\QuestionHelper()));
115
-	$application->add(new OC\Core\Command\Encryption\DecryptAll(
116
-		\OC::$server->getEncryptionManager(),
117
-		\OC::$server->getAppManager(),
118
-		\OC::$server->getConfig(),
119
-		new \OC\Encryption\DecryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getUserManager(), new \OC\Files\View()),
120
-		new \Symfony\Component\Console\Helper\QuestionHelper())
121
-	);
122
-
123
-	$application->add(new OC\Core\Command\Log\Manage(\OC::$server->getConfig()));
124
-	$application->add(new OC\Core\Command\Log\File(\OC::$server->getConfig()));
125
-
126
-	$view = new \OC\Files\View();
127
-	$util = new \OC\Encryption\Util(
128
-		$view,
129
-		\OC::$server->getUserManager(),
130
-		\OC::$server->getGroupManager(),
131
-		\OC::$server->getConfig()
132
-	);
133
-	$application->add(new OC\Core\Command\Encryption\ChangeKeyStorageRoot(
134
-			$view,
135
-			\OC::$server->getUserManager(),
136
-			\OC::$server->getConfig(),
137
-			$util,
138
-			new \Symfony\Component\Console\Helper\QuestionHelper()
139
-		)
140
-	);
141
-	$application->add(new OC\Core\Command\Encryption\ShowKeyStorageRoot($util));
142
-
143
-	$application->add(new OC\Core\Command\Maintenance\DataFingerprint(\OC::$server->getConfig(), new \OC\AppFramework\Utility\TimeFactory()));
144
-	$application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateDB(\OC::$server->getMimeTypeDetector(), \OC::$server->getMimeTypeLoader()));
145
-	$application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateJS(\OC::$server->getMimeTypeDetector()));
146
-	$application->add(new OC\Core\Command\Maintenance\Mode(\OC::$server->getConfig()));
147
-	$application->add(new OC\Core\Command\Maintenance\UpdateHtaccess());
148
-	$application->add(new OC\Core\Command\Maintenance\UpdateTheme(\OC::$server->getMimeTypeDetector(), \OC::$server->getMemCacheFactory()));
149
-
150
-	$application->add(new OC\Core\Command\Upgrade(\OC::$server->getConfig(), \OC::$server->getLogger(), \OC::$server->query(\OC\Installer::class)));
151
-	$application->add(new OC\Core\Command\Maintenance\Repair(
152
-		new \OC\Repair([], \OC::$server->getEventDispatcher()),
153
-		\OC::$server->getConfig(),
154
-		\OC::$server->getEventDispatcher(),
155
-		\OC::$server->getAppManager()
156
-	));
157
-
158
-	$application->add(\OC::$server->query(\OC\Core\Command\Preview\Repair::class));
159
-
160
-	$application->add(new OC\Core\Command\User\Add(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
161
-	$application->add(new OC\Core\Command\User\Delete(\OC::$server->getUserManager()));
162
-	$application->add(new OC\Core\Command\User\Disable(\OC::$server->getUserManager()));
163
-	$application->add(new OC\Core\Command\User\Enable(\OC::$server->getUserManager()));
164
-	$application->add(new OC\Core\Command\User\LastSeen(\OC::$server->getUserManager()));
165
-	$application->add(new OC\Core\Command\User\Report(\OC::$server->getUserManager()));
166
-	$application->add(new OC\Core\Command\User\ResetPassword(\OC::$server->getUserManager()));
167
-	$application->add(new OC\Core\Command\User\Setting(\OC::$server->getUserManager(), \OC::$server->getConfig(), \OC::$server->getDatabaseConnection()));
168
-	$application->add(new OC\Core\Command\User\ListCommand(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
169
-	$application->add(new OC\Core\Command\User\Info(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
170
-
171
-	$application->add(new OC\Core\Command\Group\Add(\OC::$server->getGroupManager()));
172
-	$application->add(new OC\Core\Command\Group\Delete(\OC::$server->getGroupManager()));
173
-	$application->add(new OC\Core\Command\Group\ListCommand(\OC::$server->getGroupManager()));
174
-	$application->add(new OC\Core\Command\Group\AddUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
175
-	$application->add(new OC\Core\Command\Group\RemoveUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
176
-
177
-	$application->add(new OC\Core\Command\Security\ListCertificates(\OC::$server->getCertificateManager(null), \OC::$server->getL10N('core')));
178
-	$application->add(new OC\Core\Command\Security\ImportCertificate(\OC::$server->getCertificateManager(null)));
179
-	$application->add(new OC\Core\Command\Security\RemoveCertificate(\OC::$server->getCertificateManager(null)));
180
-	$application->add(new OC\Core\Command\Security\ResetBruteforceAttempts(\OC::$server->getBruteForceThrottler()));
69
+    $application->add(new OC\Core\Command\App\Disable(\OC::$server->getAppManager()));
70
+    $application->add(new OC\Core\Command\App\Enable(\OC::$server->getAppManager(), \OC::$server->getGroupManager()));
71
+    $application->add(new OC\Core\Command\App\Install());
72
+    $application->add(new OC\Core\Command\App\GetPath());
73
+    $application->add(new OC\Core\Command\App\ListApps(\OC::$server->getAppManager()));
74
+    $application->add(new OC\Core\Command\App\Remove(\OC::$server->getAppManager(), \OC::$server->query(\OC\Installer::class), \OC::$server->getLogger()));
75
+    $application->add(\OC::$server->query(\OC\Core\Command\App\Update::class));
76
+
77
+    $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Cleanup::class));
78
+    $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Enforce::class));
79
+    $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Enable::class));
80
+    $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Disable::class));
81
+    $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\State::class));
82
+
83
+    $application->add(new OC\Core\Command\Background\Cron(\OC::$server->getConfig()));
84
+    $application->add(new OC\Core\Command\Background\WebCron(\OC::$server->getConfig()));
85
+    $application->add(new OC\Core\Command\Background\Ajax(\OC::$server->getConfig()));
86
+
87
+    $application->add(\OC::$server->query(\OC\Core\Command\Broadcast\Test::class));
88
+
89
+    $application->add(new OC\Core\Command\Config\App\DeleteConfig(\OC::$server->getConfig()));
90
+    $application->add(new OC\Core\Command\Config\App\GetConfig(\OC::$server->getConfig()));
91
+    $application->add(new OC\Core\Command\Config\App\SetConfig(\OC::$server->getConfig()));
92
+    $application->add(new OC\Core\Command\Config\Import(\OC::$server->getConfig()));
93
+    $application->add(new OC\Core\Command\Config\ListConfigs(\OC::$server->getSystemConfig(), \OC::$server->getAppConfig()));
94
+    $application->add(new OC\Core\Command\Config\System\DeleteConfig(\OC::$server->getSystemConfig()));
95
+    $application->add(new OC\Core\Command\Config\System\GetConfig(\OC::$server->getSystemConfig()));
96
+    $application->add(new OC\Core\Command\Config\System\SetConfig(\OC::$server->getSystemConfig()));
97
+
98
+    $application->add(new OC\Core\Command\Db\ConvertType(\OC::$server->getConfig(), new \OC\DB\ConnectionFactory(\OC::$server->getSystemConfig())));
99
+    $application->add(new OC\Core\Command\Db\ConvertMysqlToMB4(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection(), \OC::$server->getURLGenerator(), \OC::$server->getLogger()));
100
+    $application->add(new OC\Core\Command\Db\ConvertFilecacheBigInt(\OC::$server->getDatabaseConnection()));
101
+    $application->add(new OC\Core\Command\Db\AddMissingIndices(\OC::$server->getDatabaseConnection(), \OC::$server->getEventDispatcher()));
102
+    $application->add(new OC\Core\Command\Db\AddMissingColumns(\OC::$server->getDatabaseConnection(), \OC::$server->getEventDispatcher()));
103
+    $application->add(new OC\Core\Command\Db\Migrations\StatusCommand(\OC::$server->getDatabaseConnection()));
104
+    $application->add(new OC\Core\Command\Db\Migrations\MigrateCommand(\OC::$server->getDatabaseConnection()));
105
+    $application->add(new OC\Core\Command\Db\Migrations\GenerateCommand(\OC::$server->getDatabaseConnection(), \OC::$server->getAppManager()));
106
+    $application->add(new OC\Core\Command\Db\Migrations\GenerateFromSchemaFileCommand(\OC::$server->getConfig(), \OC::$server->getAppManager(), \OC::$server->getDatabaseConnection()));
107
+    $application->add(new OC\Core\Command\Db\Migrations\ExecuteCommand(\OC::$server->getDatabaseConnection(), \OC::$server->getAppManager(), \OC::$server->getConfig()));
108
+
109
+    $application->add(new OC\Core\Command\Encryption\Disable(\OC::$server->getConfig()));
110
+    $application->add(new OC\Core\Command\Encryption\Enable(\OC::$server->getConfig(), \OC::$server->getEncryptionManager()));
111
+    $application->add(new OC\Core\Command\Encryption\ListModules(\OC::$server->getEncryptionManager(), \OC::$server->getConfig()));
112
+    $application->add(new OC\Core\Command\Encryption\SetDefaultModule(\OC::$server->getEncryptionManager(), \OC::$server->getConfig()));
113
+    $application->add(new OC\Core\Command\Encryption\Status(\OC::$server->getEncryptionManager()));
114
+    $application->add(new OC\Core\Command\Encryption\EncryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getAppManager(), \OC::$server->getConfig(), new \Symfony\Component\Console\Helper\QuestionHelper()));
115
+    $application->add(new OC\Core\Command\Encryption\DecryptAll(
116
+        \OC::$server->getEncryptionManager(),
117
+        \OC::$server->getAppManager(),
118
+        \OC::$server->getConfig(),
119
+        new \OC\Encryption\DecryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getUserManager(), new \OC\Files\View()),
120
+        new \Symfony\Component\Console\Helper\QuestionHelper())
121
+    );
122
+
123
+    $application->add(new OC\Core\Command\Log\Manage(\OC::$server->getConfig()));
124
+    $application->add(new OC\Core\Command\Log\File(\OC::$server->getConfig()));
125
+
126
+    $view = new \OC\Files\View();
127
+    $util = new \OC\Encryption\Util(
128
+        $view,
129
+        \OC::$server->getUserManager(),
130
+        \OC::$server->getGroupManager(),
131
+        \OC::$server->getConfig()
132
+    );
133
+    $application->add(new OC\Core\Command\Encryption\ChangeKeyStorageRoot(
134
+            $view,
135
+            \OC::$server->getUserManager(),
136
+            \OC::$server->getConfig(),
137
+            $util,
138
+            new \Symfony\Component\Console\Helper\QuestionHelper()
139
+        )
140
+    );
141
+    $application->add(new OC\Core\Command\Encryption\ShowKeyStorageRoot($util));
142
+
143
+    $application->add(new OC\Core\Command\Maintenance\DataFingerprint(\OC::$server->getConfig(), new \OC\AppFramework\Utility\TimeFactory()));
144
+    $application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateDB(\OC::$server->getMimeTypeDetector(), \OC::$server->getMimeTypeLoader()));
145
+    $application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateJS(\OC::$server->getMimeTypeDetector()));
146
+    $application->add(new OC\Core\Command\Maintenance\Mode(\OC::$server->getConfig()));
147
+    $application->add(new OC\Core\Command\Maintenance\UpdateHtaccess());
148
+    $application->add(new OC\Core\Command\Maintenance\UpdateTheme(\OC::$server->getMimeTypeDetector(), \OC::$server->getMemCacheFactory()));
149
+
150
+    $application->add(new OC\Core\Command\Upgrade(\OC::$server->getConfig(), \OC::$server->getLogger(), \OC::$server->query(\OC\Installer::class)));
151
+    $application->add(new OC\Core\Command\Maintenance\Repair(
152
+        new \OC\Repair([], \OC::$server->getEventDispatcher()),
153
+        \OC::$server->getConfig(),
154
+        \OC::$server->getEventDispatcher(),
155
+        \OC::$server->getAppManager()
156
+    ));
157
+
158
+    $application->add(\OC::$server->query(\OC\Core\Command\Preview\Repair::class));
159
+
160
+    $application->add(new OC\Core\Command\User\Add(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
161
+    $application->add(new OC\Core\Command\User\Delete(\OC::$server->getUserManager()));
162
+    $application->add(new OC\Core\Command\User\Disable(\OC::$server->getUserManager()));
163
+    $application->add(new OC\Core\Command\User\Enable(\OC::$server->getUserManager()));
164
+    $application->add(new OC\Core\Command\User\LastSeen(\OC::$server->getUserManager()));
165
+    $application->add(new OC\Core\Command\User\Report(\OC::$server->getUserManager()));
166
+    $application->add(new OC\Core\Command\User\ResetPassword(\OC::$server->getUserManager()));
167
+    $application->add(new OC\Core\Command\User\Setting(\OC::$server->getUserManager(), \OC::$server->getConfig(), \OC::$server->getDatabaseConnection()));
168
+    $application->add(new OC\Core\Command\User\ListCommand(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
169
+    $application->add(new OC\Core\Command\User\Info(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
170
+
171
+    $application->add(new OC\Core\Command\Group\Add(\OC::$server->getGroupManager()));
172
+    $application->add(new OC\Core\Command\Group\Delete(\OC::$server->getGroupManager()));
173
+    $application->add(new OC\Core\Command\Group\ListCommand(\OC::$server->getGroupManager()));
174
+    $application->add(new OC\Core\Command\Group\AddUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
175
+    $application->add(new OC\Core\Command\Group\RemoveUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
176
+
177
+    $application->add(new OC\Core\Command\Security\ListCertificates(\OC::$server->getCertificateManager(null), \OC::$server->getL10N('core')));
178
+    $application->add(new OC\Core\Command\Security\ImportCertificate(\OC::$server->getCertificateManager(null)));
179
+    $application->add(new OC\Core\Command\Security\RemoveCertificate(\OC::$server->getCertificateManager(null)));
180
+    $application->add(new OC\Core\Command\Security\ResetBruteforceAttempts(\OC::$server->getBruteForceThrottler()));
181 181
 } else {
182
-	$application->add(new OC\Core\Command\Maintenance\Install(\OC::$server->getSystemConfig()));
182
+    $application->add(new OC\Core\Command\Maintenance\Install(\OC::$server->getSystemConfig()));
183 183
 }
Please login to merge, or discard this patch.
core/Command/Preview/Repair.php 2 patches
Indentation   +236 added lines, -236 removed lines patch added patch discarded remove patch
@@ -40,240 +40,240 @@
 block discarded – undo
40 40
 use Symfony\Component\Console\Question\ConfirmationQuestion;
41 41
 
42 42
 class Repair extends Command {
43
-	/** @var IConfig */
44
-	protected $config;
45
-	/** @var IRootFolder */
46
-	private $rootFolder;
47
-	/** @var ILogger */
48
-	private $logger;
49
-
50
-	/** @var bool */
51
-	private $stopSignalReceived = false;
52
-	/** @var int */
53
-	private $memoryLimit;
54
-	/** @var int */
55
-	private $memoryTreshold;
56
-
57
-	public function __construct(IConfig $config, IRootFolder $rootFolder, ILogger $logger, IniGetWrapper $phpIni) {
58
-		$this->config = $config;
59
-		$this->rootFolder = $rootFolder;
60
-		$this->logger = $logger;
61
-
62
-		$this->memoryLimit = $phpIni->getBytes('memory_limit');
63
-		$this->memoryTreshold = $this->memoryLimit - 25 * 1024 * 1024;
64
-
65
-		parent::__construct();
66
-	}
67
-
68
-	protected function configure() {
69
-		$this
70
-			->setName('preview:repair')
71
-			->setDescription('distributes the existing previews into subfolders')
72
-			->addOption('batch', 'b', InputOption::VALUE_NONE, 'Batch mode - will not ask to start the migration and start it right away.')
73
-			->addOption('dry', 'd', InputOption::VALUE_NONE, 'Dry mode - will not create, move or delete any files - in combination with the verbose mode one could check the operations.');
74
-	}
75
-
76
-	protected function execute(InputInterface $input, OutputInterface $output): int {
77
-		if ($this->memoryLimit !== -1) {
78
-			$limitInMiB = round($this->memoryLimit / 1024 /1024, 1);
79
-			$thresholdInMiB = round($this->memoryTreshold / 1024 /1024, 1);
80
-			$output->writeln("Memory limit is $limitInMiB MiB");
81
-			$output->writeln("Memory threshold is $thresholdInMiB MiB");
82
-			$output->writeln("");
83
-			$memoryCheckEnabled = true;
84
-		} else {
85
-			$output->writeln("No memory limit in place - disabled memory check. Set a PHP memory limit to automatically stop the execution of this migration script once memory consumption is close to this limit.");
86
-			$output->writeln("");
87
-			$memoryCheckEnabled = false;
88
-		}
89
-
90
-		$dryMode = $input->getOption('dry');
91
-
92
-		if ($dryMode) {
93
-			$output->writeln("INFO: The migration is run in dry mode and will not modify anything.");
94
-			$output->writeln("");
95
-		}
96
-
97
-		$verbose = $output->isVerbose();
98
-
99
-		$instanceId = $this->config->getSystemValueString('instanceid');
100
-
101
-		$output->writeln("This will migrate all previews from the old preview location to the new one.");
102
-		$output->writeln('');
103
-
104
-		$output->writeln('Fetching previews that need to be migrated …');
105
-		/** @var \OCP\Files\Folder $currentPreviewFolder */
106
-		$currentPreviewFolder = $this->rootFolder->get("appdata_$instanceId/preview");
107
-
108
-		$directoryListing = $currentPreviewFolder->getDirectoryListing();
109
-
110
-		$total = count($directoryListing);
111
-		/**
112
-		 * by default there could be 0-9 a-f and the old-multibucket folder which are all fine
113
-		 */
114
-		if ($total < 18) {
115
-			$directoryListing = array_filter($directoryListing, function ($dir) {
116
-				if ($dir->getName() === 'old-multibucket') {
117
-					return false;
118
-				}
119
-
120
-				// a-f can't be a file ID -> removing from migration
121
-				if (preg_match('!^[a-f]$!', $dir->getName())) {
122
-					return false;
123
-				}
124
-
125
-				if (preg_match('!^[0-9]$!', $dir->getName())) {
126
-					// ignore folders that only has folders in them
127
-					if ($dir instanceof Folder) {
128
-						foreach ($dir->getDirectoryListing() as $entry) {
129
-							if (!$entry instanceof Folder) {
130
-								return true;
131
-							}
132
-						}
133
-						return false;
134
-					}
135
-				}
136
-				return true;
137
-			});
138
-			$total = count($directoryListing);
139
-		}
140
-
141
-		if ($total === 0) {
142
-			$output->writeln("All previews are already migrated.");
143
-			return 0;
144
-		}
145
-
146
-		$output->writeln("A total of $total preview files need to be migrated.");
147
-		$output->writeln("");
148
-		$output->writeln("The migration will always migrate all previews of a single file in a batch. After each batch the process can be canceled by pressing CTRL-C. This fill finish the current batch and then stop the migration. This migration can then just be started and it will continue.");
149
-
150
-		if ($input->getOption('batch')) {
151
-			$output->writeln('Batch mode active: migration is started right away.');
152
-		} else {
153
-			$helper = $this->getHelper('question');
154
-			$question = new ConfirmationQuestion('<info>Should the migration be started? (y/[n]) </info>', false);
155
-
156
-			if (!$helper->ask($input, $output, $question)) {
157
-				return 0;
158
-			}
159
-		}
160
-
161
-		// register the SIGINT listener late in here to be able to exit in the early process of this command
162
-		pcntl_signal(SIGINT, [$this, 'sigIntHandler']);
163
-
164
-		$output->writeln("");
165
-		$output->writeln("");
166
-		$section1 = $output->section();
167
-		$section2 = $output->section();
168
-		$progressBar = new ProgressBar($section2, $total);
169
-		$progressBar->setFormat("%current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% Used Memory: %memory:6s%");
170
-		$time = (new \DateTime())->format('H:i:s');
171
-		$progressBar->setMessage("$time Starting …");
172
-		$progressBar->maxSecondsBetweenRedraws(0.2);
173
-		$progressBar->start();
174
-
175
-		foreach ($directoryListing as $oldPreviewFolder) {
176
-			pcntl_signal_dispatch();
177
-			$name = $oldPreviewFolder->getName();
178
-			$time = (new \DateTime())->format('H:i:s');
179
-			$section1->writeln("$time Migrating previews of file with fileId $name …");
180
-			$progressBar->display();
181
-
182
-			if ($this->stopSignalReceived) {
183
-				$section1->writeln("$time Stopping migration …");
184
-				return 0;
185
-			}
186
-			if (!$oldPreviewFolder instanceof Folder) {
187
-				$section1->writeln("         Skipping non-folder $name …");
188
-				$progressBar->advance();
189
-				continue;
190
-			}
191
-			if ($name === 'old-multibucket') {
192
-				$section1->writeln("         Skipping fallback mount point $name …");
193
-				$progressBar->advance();
194
-				continue;
195
-			}
196
-			if (in_array($name, ['a', 'b', 'c', 'd', 'e', 'f'])) {
197
-				$section1->writeln("         Skipping hex-digit folder $name …");
198
-				$progressBar->advance();
199
-				continue;
200
-			}
201
-			if (!preg_match('!^\d+$!', $name)) {
202
-				$section1->writeln("         Skipping non-numeric folder $name …");
203
-				$progressBar->advance();
204
-				continue;
205
-			}
206
-
207
-			$newFoldername = Root::getInternalFolder($name);
208
-
209
-			$memoryUsage = memory_get_usage();
210
-			if ($memoryCheckEnabled && $memoryUsage > $this->memoryTreshold) {
211
-				$section1->writeln("");
212
-				$section1->writeln("");
213
-				$section1->writeln("");
214
-				$section1->writeln("         Stopped process 25 MB before reaching the memory limit to avoid a hard crash.");
215
-				$time = (new \DateTime())->format('H:i:s');
216
-				$section1->writeln("$time Reached memory limit and stopped to avoid hard crash.");
217
-				return 1;
218
-			}
219
-
220
-			$previews = $oldPreviewFolder->getDirectoryListing();
221
-			if ($previews !== []) {
222
-				try {
223
-					$this->rootFolder->get("appdata_$instanceId/preview/$newFoldername");
224
-				} catch (NotFoundException $e) {
225
-					if ($verbose) {
226
-						$section1->writeln("         Create folder preview/$newFoldername");
227
-					}
228
-					if (!$dryMode) {
229
-						$this->rootFolder->newFolder("appdata_$instanceId/preview/$newFoldername");
230
-					}
231
-				}
232
-
233
-				foreach ($previews as $preview) {
234
-					pcntl_signal_dispatch();
235
-					$previewName = $preview->getName();
236
-
237
-					if ($preview instanceof Folder) {
238
-						$section1->writeln("         Skipping folder $name/$previewName …");
239
-						$progressBar->advance();
240
-						continue;
241
-					}
242
-					if ($verbose) {
243
-						$section1->writeln("         Move preview/$name/$previewName to preview/$newFoldername");
244
-					}
245
-					if (!$dryMode) {
246
-						try {
247
-							$preview->move("appdata_$instanceId/preview/$newFoldername/$previewName");
248
-						} catch (\Exception $e) {
249
-							$this->logger->logException($e, ['app' => 'core', 'message' => "Failed to move preview from preview/$name/$previewName to preview/$newFoldername"]);
250
-						}
251
-					}
252
-				}
253
-			}
254
-			if ($oldPreviewFolder->getDirectoryListing() === []) {
255
-				if ($verbose) {
256
-					$section1->writeln("         Delete empty folder preview/$name");
257
-				}
258
-				if (!$dryMode) {
259
-					try {
260
-						$oldPreviewFolder->delete();
261
-					} catch (\Exception $e) {
262
-						$this->logger->logException($e, ['app' => 'core', 'message' => "Failed to delete empty folder preview/$name"]);
263
-					}
264
-				}
265
-			}
266
-			$section1->writeln("         Finished migrating previews of file with fileId $name …");
267
-			$progressBar->advance();
268
-		}
269
-
270
-		$progressBar->finish();
271
-		$output->writeln("");
272
-		return 0;
273
-	}
274
-
275
-	protected function sigIntHandler() {
276
-		echo "\nSignal received - will finish the step and then stop the migration.\n\n\n";
277
-		$this->stopSignalReceived = true;
278
-	}
43
+    /** @var IConfig */
44
+    protected $config;
45
+    /** @var IRootFolder */
46
+    private $rootFolder;
47
+    /** @var ILogger */
48
+    private $logger;
49
+
50
+    /** @var bool */
51
+    private $stopSignalReceived = false;
52
+    /** @var int */
53
+    private $memoryLimit;
54
+    /** @var int */
55
+    private $memoryTreshold;
56
+
57
+    public function __construct(IConfig $config, IRootFolder $rootFolder, ILogger $logger, IniGetWrapper $phpIni) {
58
+        $this->config = $config;
59
+        $this->rootFolder = $rootFolder;
60
+        $this->logger = $logger;
61
+
62
+        $this->memoryLimit = $phpIni->getBytes('memory_limit');
63
+        $this->memoryTreshold = $this->memoryLimit - 25 * 1024 * 1024;
64
+
65
+        parent::__construct();
66
+    }
67
+
68
+    protected function configure() {
69
+        $this
70
+            ->setName('preview:repair')
71
+            ->setDescription('distributes the existing previews into subfolders')
72
+            ->addOption('batch', 'b', InputOption::VALUE_NONE, 'Batch mode - will not ask to start the migration and start it right away.')
73
+            ->addOption('dry', 'd', InputOption::VALUE_NONE, 'Dry mode - will not create, move or delete any files - in combination with the verbose mode one could check the operations.');
74
+    }
75
+
76
+    protected function execute(InputInterface $input, OutputInterface $output): int {
77
+        if ($this->memoryLimit !== -1) {
78
+            $limitInMiB = round($this->memoryLimit / 1024 /1024, 1);
79
+            $thresholdInMiB = round($this->memoryTreshold / 1024 /1024, 1);
80
+            $output->writeln("Memory limit is $limitInMiB MiB");
81
+            $output->writeln("Memory threshold is $thresholdInMiB MiB");
82
+            $output->writeln("");
83
+            $memoryCheckEnabled = true;
84
+        } else {
85
+            $output->writeln("No memory limit in place - disabled memory check. Set a PHP memory limit to automatically stop the execution of this migration script once memory consumption is close to this limit.");
86
+            $output->writeln("");
87
+            $memoryCheckEnabled = false;
88
+        }
89
+
90
+        $dryMode = $input->getOption('dry');
91
+
92
+        if ($dryMode) {
93
+            $output->writeln("INFO: The migration is run in dry mode and will not modify anything.");
94
+            $output->writeln("");
95
+        }
96
+
97
+        $verbose = $output->isVerbose();
98
+
99
+        $instanceId = $this->config->getSystemValueString('instanceid');
100
+
101
+        $output->writeln("This will migrate all previews from the old preview location to the new one.");
102
+        $output->writeln('');
103
+
104
+        $output->writeln('Fetching previews that need to be migrated …');
105
+        /** @var \OCP\Files\Folder $currentPreviewFolder */
106
+        $currentPreviewFolder = $this->rootFolder->get("appdata_$instanceId/preview");
107
+
108
+        $directoryListing = $currentPreviewFolder->getDirectoryListing();
109
+
110
+        $total = count($directoryListing);
111
+        /**
112
+         * by default there could be 0-9 a-f and the old-multibucket folder which are all fine
113
+         */
114
+        if ($total < 18) {
115
+            $directoryListing = array_filter($directoryListing, function ($dir) {
116
+                if ($dir->getName() === 'old-multibucket') {
117
+                    return false;
118
+                }
119
+
120
+                // a-f can't be a file ID -> removing from migration
121
+                if (preg_match('!^[a-f]$!', $dir->getName())) {
122
+                    return false;
123
+                }
124
+
125
+                if (preg_match('!^[0-9]$!', $dir->getName())) {
126
+                    // ignore folders that only has folders in them
127
+                    if ($dir instanceof Folder) {
128
+                        foreach ($dir->getDirectoryListing() as $entry) {
129
+                            if (!$entry instanceof Folder) {
130
+                                return true;
131
+                            }
132
+                        }
133
+                        return false;
134
+                    }
135
+                }
136
+                return true;
137
+            });
138
+            $total = count($directoryListing);
139
+        }
140
+
141
+        if ($total === 0) {
142
+            $output->writeln("All previews are already migrated.");
143
+            return 0;
144
+        }
145
+
146
+        $output->writeln("A total of $total preview files need to be migrated.");
147
+        $output->writeln("");
148
+        $output->writeln("The migration will always migrate all previews of a single file in a batch. After each batch the process can be canceled by pressing CTRL-C. This fill finish the current batch and then stop the migration. This migration can then just be started and it will continue.");
149
+
150
+        if ($input->getOption('batch')) {
151
+            $output->writeln('Batch mode active: migration is started right away.');
152
+        } else {
153
+            $helper = $this->getHelper('question');
154
+            $question = new ConfirmationQuestion('<info>Should the migration be started? (y/[n]) </info>', false);
155
+
156
+            if (!$helper->ask($input, $output, $question)) {
157
+                return 0;
158
+            }
159
+        }
160
+
161
+        // register the SIGINT listener late in here to be able to exit in the early process of this command
162
+        pcntl_signal(SIGINT, [$this, 'sigIntHandler']);
163
+
164
+        $output->writeln("");
165
+        $output->writeln("");
166
+        $section1 = $output->section();
167
+        $section2 = $output->section();
168
+        $progressBar = new ProgressBar($section2, $total);
169
+        $progressBar->setFormat("%current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% Used Memory: %memory:6s%");
170
+        $time = (new \DateTime())->format('H:i:s');
171
+        $progressBar->setMessage("$time Starting …");
172
+        $progressBar->maxSecondsBetweenRedraws(0.2);
173
+        $progressBar->start();
174
+
175
+        foreach ($directoryListing as $oldPreviewFolder) {
176
+            pcntl_signal_dispatch();
177
+            $name = $oldPreviewFolder->getName();
178
+            $time = (new \DateTime())->format('H:i:s');
179
+            $section1->writeln("$time Migrating previews of file with fileId $name …");
180
+            $progressBar->display();
181
+
182
+            if ($this->stopSignalReceived) {
183
+                $section1->writeln("$time Stopping migration …");
184
+                return 0;
185
+            }
186
+            if (!$oldPreviewFolder instanceof Folder) {
187
+                $section1->writeln("         Skipping non-folder $name …");
188
+                $progressBar->advance();
189
+                continue;
190
+            }
191
+            if ($name === 'old-multibucket') {
192
+                $section1->writeln("         Skipping fallback mount point $name …");
193
+                $progressBar->advance();
194
+                continue;
195
+            }
196
+            if (in_array($name, ['a', 'b', 'c', 'd', 'e', 'f'])) {
197
+                $section1->writeln("         Skipping hex-digit folder $name …");
198
+                $progressBar->advance();
199
+                continue;
200
+            }
201
+            if (!preg_match('!^\d+$!', $name)) {
202
+                $section1->writeln("         Skipping non-numeric folder $name …");
203
+                $progressBar->advance();
204
+                continue;
205
+            }
206
+
207
+            $newFoldername = Root::getInternalFolder($name);
208
+
209
+            $memoryUsage = memory_get_usage();
210
+            if ($memoryCheckEnabled && $memoryUsage > $this->memoryTreshold) {
211
+                $section1->writeln("");
212
+                $section1->writeln("");
213
+                $section1->writeln("");
214
+                $section1->writeln("         Stopped process 25 MB before reaching the memory limit to avoid a hard crash.");
215
+                $time = (new \DateTime())->format('H:i:s');
216
+                $section1->writeln("$time Reached memory limit and stopped to avoid hard crash.");
217
+                return 1;
218
+            }
219
+
220
+            $previews = $oldPreviewFolder->getDirectoryListing();
221
+            if ($previews !== []) {
222
+                try {
223
+                    $this->rootFolder->get("appdata_$instanceId/preview/$newFoldername");
224
+                } catch (NotFoundException $e) {
225
+                    if ($verbose) {
226
+                        $section1->writeln("         Create folder preview/$newFoldername");
227
+                    }
228
+                    if (!$dryMode) {
229
+                        $this->rootFolder->newFolder("appdata_$instanceId/preview/$newFoldername");
230
+                    }
231
+                }
232
+
233
+                foreach ($previews as $preview) {
234
+                    pcntl_signal_dispatch();
235
+                    $previewName = $preview->getName();
236
+
237
+                    if ($preview instanceof Folder) {
238
+                        $section1->writeln("         Skipping folder $name/$previewName …");
239
+                        $progressBar->advance();
240
+                        continue;
241
+                    }
242
+                    if ($verbose) {
243
+                        $section1->writeln("         Move preview/$name/$previewName to preview/$newFoldername");
244
+                    }
245
+                    if (!$dryMode) {
246
+                        try {
247
+                            $preview->move("appdata_$instanceId/preview/$newFoldername/$previewName");
248
+                        } catch (\Exception $e) {
249
+                            $this->logger->logException($e, ['app' => 'core', 'message' => "Failed to move preview from preview/$name/$previewName to preview/$newFoldername"]);
250
+                        }
251
+                    }
252
+                }
253
+            }
254
+            if ($oldPreviewFolder->getDirectoryListing() === []) {
255
+                if ($verbose) {
256
+                    $section1->writeln("         Delete empty folder preview/$name");
257
+                }
258
+                if (!$dryMode) {
259
+                    try {
260
+                        $oldPreviewFolder->delete();
261
+                    } catch (\Exception $e) {
262
+                        $this->logger->logException($e, ['app' => 'core', 'message' => "Failed to delete empty folder preview/$name"]);
263
+                    }
264
+                }
265
+            }
266
+            $section1->writeln("         Finished migrating previews of file with fileId $name …");
267
+            $progressBar->advance();
268
+        }
269
+
270
+        $progressBar->finish();
271
+        $output->writeln("");
272
+        return 0;
273
+    }
274
+
275
+    protected function sigIntHandler() {
276
+        echo "\nSignal received - will finish the step and then stop the migration.\n\n\n";
277
+        $this->stopSignalReceived = true;
278
+    }
279 279
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 
76 76
 	protected function execute(InputInterface $input, OutputInterface $output): int {
77 77
 		if ($this->memoryLimit !== -1) {
78
-			$limitInMiB = round($this->memoryLimit / 1024 /1024, 1);
79
-			$thresholdInMiB = round($this->memoryTreshold / 1024 /1024, 1);
78
+			$limitInMiB = round($this->memoryLimit / 1024 / 1024, 1);
79
+			$thresholdInMiB = round($this->memoryTreshold / 1024 / 1024, 1);
80 80
 			$output->writeln("Memory limit is $limitInMiB MiB");
81 81
 			$output->writeln("Memory threshold is $thresholdInMiB MiB");
82 82
 			$output->writeln("");
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 		 * by default there could be 0-9 a-f and the old-multibucket folder which are all fine
113 113
 		 */
114 114
 		if ($total < 18) {
115
-			$directoryListing = array_filter($directoryListing, function ($dir) {
115
+			$directoryListing = array_filter($directoryListing, function($dir) {
116 116
 				if ($dir->getName() === 'old-multibucket') {
117 117
 					return false;
118 118
 				}
Please login to merge, or discard this patch.