Completed
Push — master ( 08b58a...0efd05 )
by Daniel
30:08 queued 21s
created
lib/private/IntegrityCheck/Helpers/FileAccessHelper.php 2 patches
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -34,57 +34,57 @@
 block discarded – undo
34 34
  * @package OC\IntegrityCheck\Helpers
35 35
  */
36 36
 class FileAccessHelper {
37
-	/**
38
-	 * Wrapper around file_get_contents($filename, $data)
39
-	 *
40
-	 * @param string $filename
41
-	 * @return string|false
42
-	 */
43
-	public function file_get_contents(string $filename) {
44
-		return file_get_contents($filename);
45
-	}
37
+    /**
38
+     * Wrapper around file_get_contents($filename, $data)
39
+     *
40
+     * @param string $filename
41
+     * @return string|false
42
+     */
43
+    public function file_get_contents(string $filename) {
44
+        return file_get_contents($filename);
45
+    }
46 46
 
47
-	/**
48
-	 * Wrapper around file_exists($filename)
49
-	 *
50
-	 * @param string $filename
51
-	 * @return bool
52
-	 */
53
-	public function file_exists(string $filename): bool {
54
-		return file_exists($filename);
55
-	}
47
+    /**
48
+     * Wrapper around file_exists($filename)
49
+     *
50
+     * @param string $filename
51
+     * @return bool
52
+     */
53
+    public function file_exists(string $filename): bool {
54
+        return file_exists($filename);
55
+    }
56 56
 
57
-	/**
58
-	 * Wrapper around file_put_contents($filename, $data)
59
-	 *
60
-	 * @param string $filename
61
-	 * @param string $data
62
-	 * @return int
63
-	 * @throws \Exception
64
-	 */
65
-	public function file_put_contents(string $filename, string $data): int {
66
-		$bytesWritten = @file_put_contents($filename, $data);
67
-		if ($bytesWritten === false || $bytesWritten !== \strlen($data)) {
68
-			throw new \Exception('Failed to write into ' . $filename);
69
-		}
70
-		return $bytesWritten;
71
-	}
57
+    /**
58
+     * Wrapper around file_put_contents($filename, $data)
59
+     *
60
+     * @param string $filename
61
+     * @param string $data
62
+     * @return int
63
+     * @throws \Exception
64
+     */
65
+    public function file_put_contents(string $filename, string $data): int {
66
+        $bytesWritten = @file_put_contents($filename, $data);
67
+        if ($bytesWritten === false || $bytesWritten !== \strlen($data)) {
68
+            throw new \Exception('Failed to write into ' . $filename);
69
+        }
70
+        return $bytesWritten;
71
+    }
72 72
 
73
-	/**
74
-	 * @param string $path
75
-	 * @return bool
76
-	 */
77
-	public function is_writable(string $path): bool {
78
-		return is_writable($path);
79
-	}
73
+    /**
74
+     * @param string $path
75
+     * @return bool
76
+     */
77
+    public function is_writable(string $path): bool {
78
+        return is_writable($path);
79
+    }
80 80
 
81
-	/**
82
-	 * @param string $path
83
-	 * @throws \Exception
84
-	 */
85
-	public function assertDirectoryExists(string $path) {
86
-		if (!is_dir($path)) {
87
-			throw new \Exception('Directory ' . $path . ' does not exist.');
88
-		}
89
-	}
81
+    /**
82
+     * @param string $path
83
+     * @throws \Exception
84
+     */
85
+    public function assertDirectoryExists(string $path) {
86
+        if (!is_dir($path)) {
87
+            throw new \Exception('Directory ' . $path . ' does not exist.');
88
+        }
89
+    }
90 90
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	public function file_put_contents(string $filename, string $data): int {
66 66
 		$bytesWritten = @file_put_contents($filename, $data);
67 67
 		if ($bytesWritten === false || $bytesWritten !== \strlen($data)) {
68
-			throw new \Exception('Failed to write into ' . $filename);
68
+			throw new \Exception('Failed to write into '.$filename);
69 69
 		}
70 70
 		return $bytesWritten;
71 71
 	}
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public function assertDirectoryExists(string $path) {
86 86
 		if (!is_dir($path)) {
87
-			throw new \Exception('Directory ' . $path . ' does not exist.');
87
+			throw new \Exception('Directory '.$path.' does not exist.');
88 88
 		}
89 89
 	}
90 90
 }
Please login to merge, or discard this patch.
lib/private/Encryption/DecryptAll.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 		$this->output = $output;
88 88
 
89 89
 		if ($user !== '' && $this->userManager->userExists($user) === false) {
90
-			$this->output->writeln('User "' . $user . '" does not exist. Please check the username and try again');
90
+			$this->output->writeln('User "'.$user.'" does not exist. Please check the username and try again');
91 91
 			return false;
92 92
 		}
93 93
 
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 			$this->output->writeln('Files for following users couldn\'t be decrypted, ');
106 106
 			$this->output->writeln('maybe the user is not set up in a way that supports this operation: ');
107 107
 			foreach ($this->failed as $uid => $paths) {
108
-				$this->output->writeln('    ' . $uid);
108
+				$this->output->writeln('    '.$uid);
109 109
 				foreach ($paths as $path) {
110
-					$this->output->writeln('        ' . $path);
110
+					$this->output->writeln('        '.$path);
111 111
 				}
112 112
 			}
113 113
 			$this->output->writeln('');
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
 			/** @var IEncryptionModule $module */
130 130
 			$module = call_user_func($moduleDesc['callback']);
131 131
 			$this->output->writeln('');
132
-			$this->output->writeln('Prepare "' . $module->getDisplayName() . '"');
132
+			$this->output->writeln('Prepare "'.$module->getDisplayName().'"');
133 133
 			$this->output->writeln('');
134 134
 			if ($module->prepareDecryptAll($this->input, $this->output, $user) === false) {
135
-				$this->output->writeln('Module "' . $moduleDesc['displayName'] . '" does not support the functionality to decrypt all files again or the initialization of the module failed!');
135
+				$this->output->writeln('Module "'.$moduleDesc['displayName'].'" does not support the functionality to decrypt all files again or the initialization of the module failed!');
136 136
 				return false;
137 137
 			}
138 138
 		}
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	protected function decryptUsersFiles($uid, ProgressBar $progress, $userCount) {
207 207
 		$this->setupUserFS($uid);
208 208
 		$directories = [];
209
-		$directories[] = '/' . $uid . '/files';
209
+		$directories[] = '/'.$uid.'/files';
210 210
 
211 211
 		while ($root = array_pop($directories)) {
212 212
 			$content = $this->rootView->getDirectoryContent($root);
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 				if ($file->getStorage()->instanceOfStorage('OCA\Files_Sharing\SharedStorage')) {
216 216
 					continue;
217 217
 				}
218
-				$path = $root . '/' . $file['name'];
218
+				$path = $root.'/'.$file['name'];
219 219
 				if ($this->rootView->is_dir($path)) {
220 220
 					$directories[] = $path;
221 221
 					continue;
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 		}
260 260
 
261 261
 		$source = $path;
262
-		$target = $path . '.decrypted.' . $this->getTimestamp();
262
+		$target = $path.'.decrypted.'.$this->getTimestamp();
263 263
 
264 264
 		try {
265 265
 			$this->rootView->copy($source, $target);
Please login to merge, or discard this patch.
Indentation   +209 added lines, -209 removed lines patch added patch discarded remove patch
@@ -17,241 +17,241 @@
 block discarded – undo
17 17
 use Symfony\Component\Console\Output\OutputInterface;
18 18
 
19 19
 class DecryptAll {
20
-	/** @var OutputInterface */
21
-	protected $output;
20
+    /** @var OutputInterface */
21
+    protected $output;
22 22
 
23
-	/** @var InputInterface */
24
-	protected $input;
23
+    /** @var InputInterface */
24
+    protected $input;
25 25
 
26
-	/** @var array files which couldn't be decrypted */
27
-	protected $failed;
26
+    /** @var array files which couldn't be decrypted */
27
+    protected $failed;
28 28
 
29
-	public function __construct(
30
-		protected IManager $encryptionManager,
31
-		protected IUserManager $userManager,
32
-		protected View $rootView,
33
-	) {
34
-		$this->failed = [];
35
-	}
29
+    public function __construct(
30
+        protected IManager $encryptionManager,
31
+        protected IUserManager $userManager,
32
+        protected View $rootView,
33
+    ) {
34
+        $this->failed = [];
35
+    }
36 36
 
37
-	/**
38
-	 * start to decrypt all files
39
-	 *
40
-	 * @param InputInterface $input
41
-	 * @param OutputInterface $output
42
-	 * @param string $user which users data folder should be decrypted, default = all users
43
-	 * @return bool
44
-	 * @throws \Exception
45
-	 */
46
-	public function decryptAll(InputInterface $input, OutputInterface $output, $user = '') {
47
-		$this->input = $input;
48
-		$this->output = $output;
37
+    /**
38
+     * start to decrypt all files
39
+     *
40
+     * @param InputInterface $input
41
+     * @param OutputInterface $output
42
+     * @param string $user which users data folder should be decrypted, default = all users
43
+     * @return bool
44
+     * @throws \Exception
45
+     */
46
+    public function decryptAll(InputInterface $input, OutputInterface $output, $user = '') {
47
+        $this->input = $input;
48
+        $this->output = $output;
49 49
 
50
-		if ($user !== '' && $this->userManager->userExists($user) === false) {
51
-			$this->output->writeln('User "' . $user . '" does not exist. Please check the username and try again');
52
-			return false;
53
-		}
50
+        if ($user !== '' && $this->userManager->userExists($user) === false) {
51
+            $this->output->writeln('User "' . $user . '" does not exist. Please check the username and try again');
52
+            return false;
53
+        }
54 54
 
55
-		$this->output->writeln('prepare encryption modules...');
56
-		if ($this->prepareEncryptionModules($user) === false) {
57
-			return false;
58
-		}
59
-		$this->output->writeln(' done.');
55
+        $this->output->writeln('prepare encryption modules...');
56
+        if ($this->prepareEncryptionModules($user) === false) {
57
+            return false;
58
+        }
59
+        $this->output->writeln(' done.');
60 60
 
61
-		$this->decryptAllUsersFiles($user);
61
+        $this->decryptAllUsersFiles($user);
62 62
 
63
-		if (empty($this->failed)) {
64
-			$this->output->writeln('all files could be decrypted successfully!');
65
-		} else {
66
-			$this->output->writeln('Files for following users couldn\'t be decrypted, ');
67
-			$this->output->writeln('maybe the user is not set up in a way that supports this operation: ');
68
-			foreach ($this->failed as $uid => $paths) {
69
-				$this->output->writeln('    ' . $uid);
70
-				foreach ($paths as $path) {
71
-					$this->output->writeln('        ' . $path);
72
-				}
73
-			}
74
-			$this->output->writeln('');
75
-		}
63
+        if (empty($this->failed)) {
64
+            $this->output->writeln('all files could be decrypted successfully!');
65
+        } else {
66
+            $this->output->writeln('Files for following users couldn\'t be decrypted, ');
67
+            $this->output->writeln('maybe the user is not set up in a way that supports this operation: ');
68
+            foreach ($this->failed as $uid => $paths) {
69
+                $this->output->writeln('    ' . $uid);
70
+                foreach ($paths as $path) {
71
+                    $this->output->writeln('        ' . $path);
72
+                }
73
+            }
74
+            $this->output->writeln('');
75
+        }
76 76
 
77
-		return true;
78
-	}
77
+        return true;
78
+    }
79 79
 
80
-	/**
81
-	 * prepare encryption modules to perform the decrypt all function
82
-	 *
83
-	 * @param $user
84
-	 * @return bool
85
-	 */
86
-	protected function prepareEncryptionModules($user) {
87
-		// prepare all encryption modules for decrypt all
88
-		$encryptionModules = $this->encryptionManager->getEncryptionModules();
89
-		foreach ($encryptionModules as $moduleDesc) {
90
-			/** @var IEncryptionModule $module */
91
-			$module = call_user_func($moduleDesc['callback']);
92
-			$this->output->writeln('');
93
-			$this->output->writeln('Prepare "' . $module->getDisplayName() . '"');
94
-			$this->output->writeln('');
95
-			if ($module->prepareDecryptAll($this->input, $this->output, $user) === false) {
96
-				$this->output->writeln('Module "' . $moduleDesc['displayName'] . '" does not support the functionality to decrypt all files again or the initialization of the module failed!');
97
-				return false;
98
-			}
99
-		}
80
+    /**
81
+     * prepare encryption modules to perform the decrypt all function
82
+     *
83
+     * @param $user
84
+     * @return bool
85
+     */
86
+    protected function prepareEncryptionModules($user) {
87
+        // prepare all encryption modules for decrypt all
88
+        $encryptionModules = $this->encryptionManager->getEncryptionModules();
89
+        foreach ($encryptionModules as $moduleDesc) {
90
+            /** @var IEncryptionModule $module */
91
+            $module = call_user_func($moduleDesc['callback']);
92
+            $this->output->writeln('');
93
+            $this->output->writeln('Prepare "' . $module->getDisplayName() . '"');
94
+            $this->output->writeln('');
95
+            if ($module->prepareDecryptAll($this->input, $this->output, $user) === false) {
96
+                $this->output->writeln('Module "' . $moduleDesc['displayName'] . '" does not support the functionality to decrypt all files again or the initialization of the module failed!');
97
+                return false;
98
+            }
99
+        }
100 100
 
101
-		return true;
102
-	}
101
+        return true;
102
+    }
103 103
 
104
-	/**
105
-	 * iterate over all user and encrypt their files
106
-	 *
107
-	 * @param string $user which users files should be decrypted, default = all users
108
-	 */
109
-	protected function decryptAllUsersFiles($user = '') {
110
-		$this->output->writeln("\n");
104
+    /**
105
+     * iterate over all user and encrypt their files
106
+     *
107
+     * @param string $user which users files should be decrypted, default = all users
108
+     */
109
+    protected function decryptAllUsersFiles($user = '') {
110
+        $this->output->writeln("\n");
111 111
 
112
-		$userList = [];
113
-		if ($user === '') {
114
-			$fetchUsersProgress = new ProgressBar($this->output);
115
-			$fetchUsersProgress->setFormat(" %message% \n [%bar%]");
116
-			$fetchUsersProgress->start();
117
-			$fetchUsersProgress->setMessage('Fetch list of users...');
118
-			$fetchUsersProgress->advance();
112
+        $userList = [];
113
+        if ($user === '') {
114
+            $fetchUsersProgress = new ProgressBar($this->output);
115
+            $fetchUsersProgress->setFormat(" %message% \n [%bar%]");
116
+            $fetchUsersProgress->start();
117
+            $fetchUsersProgress->setMessage('Fetch list of users...');
118
+            $fetchUsersProgress->advance();
119 119
 
120
-			foreach ($this->userManager->getBackends() as $backend) {
121
-				$limit = 500;
122
-				$offset = 0;
123
-				do {
124
-					$users = $backend->getUsers('', $limit, $offset);
125
-					foreach ($users as $user) {
126
-						$userList[] = $user;
127
-					}
128
-					$offset += $limit;
129
-					$fetchUsersProgress->advance();
130
-				} while (count($users) >= $limit);
131
-				$fetchUsersProgress->setMessage('Fetch list of users... finished');
132
-				$fetchUsersProgress->finish();
133
-			}
134
-		} else {
135
-			$userList[] = $user;
136
-		}
120
+            foreach ($this->userManager->getBackends() as $backend) {
121
+                $limit = 500;
122
+                $offset = 0;
123
+                do {
124
+                    $users = $backend->getUsers('', $limit, $offset);
125
+                    foreach ($users as $user) {
126
+                        $userList[] = $user;
127
+                    }
128
+                    $offset += $limit;
129
+                    $fetchUsersProgress->advance();
130
+                } while (count($users) >= $limit);
131
+                $fetchUsersProgress->setMessage('Fetch list of users... finished');
132
+                $fetchUsersProgress->finish();
133
+            }
134
+        } else {
135
+            $userList[] = $user;
136
+        }
137 137
 
138
-		$this->output->writeln("\n\n");
138
+        $this->output->writeln("\n\n");
139 139
 
140
-		$progress = new ProgressBar($this->output);
141
-		$progress->setFormat(" %message% \n [%bar%]");
142
-		$progress->start();
143
-		$progress->setMessage('starting to decrypt files...');
144
-		$progress->advance();
140
+        $progress = new ProgressBar($this->output);
141
+        $progress->setFormat(" %message% \n [%bar%]");
142
+        $progress->start();
143
+        $progress->setMessage('starting to decrypt files...');
144
+        $progress->advance();
145 145
 
146
-		$numberOfUsers = count($userList);
147
-		$userNo = 1;
148
-		foreach ($userList as $uid) {
149
-			$userCount = "$uid ($userNo of $numberOfUsers)";
150
-			$this->decryptUsersFiles($uid, $progress, $userCount);
151
-			$userNo++;
152
-		}
146
+        $numberOfUsers = count($userList);
147
+        $userNo = 1;
148
+        foreach ($userList as $uid) {
149
+            $userCount = "$uid ($userNo of $numberOfUsers)";
150
+            $this->decryptUsersFiles($uid, $progress, $userCount);
151
+            $userNo++;
152
+        }
153 153
 
154
-		$progress->setMessage('starting to decrypt files... finished');
155
-		$progress->finish();
154
+        $progress->setMessage('starting to decrypt files... finished');
155
+        $progress->finish();
156 156
 
157
-		$this->output->writeln("\n\n");
158
-	}
157
+        $this->output->writeln("\n\n");
158
+    }
159 159
 
160
-	/**
161
-	 * encrypt files from the given user
162
-	 *
163
-	 * @param string $uid
164
-	 * @param ProgressBar $progress
165
-	 * @param string $userCount
166
-	 */
167
-	protected function decryptUsersFiles($uid, ProgressBar $progress, $userCount) {
168
-		$this->setupUserFS($uid);
169
-		$directories = [];
170
-		$directories[] = '/' . $uid . '/files';
160
+    /**
161
+     * encrypt files from the given user
162
+     *
163
+     * @param string $uid
164
+     * @param ProgressBar $progress
165
+     * @param string $userCount
166
+     */
167
+    protected function decryptUsersFiles($uid, ProgressBar $progress, $userCount) {
168
+        $this->setupUserFS($uid);
169
+        $directories = [];
170
+        $directories[] = '/' . $uid . '/files';
171 171
 
172
-		while ($root = array_pop($directories)) {
173
-			$content = $this->rootView->getDirectoryContent($root);
174
-			foreach ($content as $file) {
175
-				// only decrypt files owned by the user
176
-				if ($file->getStorage()->instanceOfStorage('OCA\Files_Sharing\SharedStorage')) {
177
-					continue;
178
-				}
179
-				$path = $root . '/' . $file['name'];
180
-				if ($this->rootView->is_dir($path)) {
181
-					$directories[] = $path;
182
-					continue;
183
-				} else {
184
-					try {
185
-						$progress->setMessage("decrypt files for user $userCount: $path");
186
-						$progress->advance();
187
-						if ($file->isEncrypted() === false) {
188
-							$progress->setMessage("decrypt files for user $userCount: $path (already decrypted)");
189
-							$progress->advance();
190
-						} else {
191
-							if ($this->decryptFile($path) === false) {
192
-								$progress->setMessage("decrypt files for user $userCount: $path (already decrypted)");
193
-								$progress->advance();
194
-							}
195
-						}
196
-					} catch (\Exception $e) {
197
-						if (isset($this->failed[$uid])) {
198
-							$this->failed[$uid][] = $path;
199
-						} else {
200
-							$this->failed[$uid] = [$path];
201
-						}
202
-					}
203
-				}
204
-			}
205
-		}
206
-	}
172
+        while ($root = array_pop($directories)) {
173
+            $content = $this->rootView->getDirectoryContent($root);
174
+            foreach ($content as $file) {
175
+                // only decrypt files owned by the user
176
+                if ($file->getStorage()->instanceOfStorage('OCA\Files_Sharing\SharedStorage')) {
177
+                    continue;
178
+                }
179
+                $path = $root . '/' . $file['name'];
180
+                if ($this->rootView->is_dir($path)) {
181
+                    $directories[] = $path;
182
+                    continue;
183
+                } else {
184
+                    try {
185
+                        $progress->setMessage("decrypt files for user $userCount: $path");
186
+                        $progress->advance();
187
+                        if ($file->isEncrypted() === false) {
188
+                            $progress->setMessage("decrypt files for user $userCount: $path (already decrypted)");
189
+                            $progress->advance();
190
+                        } else {
191
+                            if ($this->decryptFile($path) === false) {
192
+                                $progress->setMessage("decrypt files for user $userCount: $path (already decrypted)");
193
+                                $progress->advance();
194
+                            }
195
+                        }
196
+                    } catch (\Exception $e) {
197
+                        if (isset($this->failed[$uid])) {
198
+                            $this->failed[$uid][] = $path;
199
+                        } else {
200
+                            $this->failed[$uid] = [$path];
201
+                        }
202
+                    }
203
+                }
204
+            }
205
+        }
206
+    }
207 207
 
208
-	/**
209
-	 * encrypt file
210
-	 *
211
-	 * @param string $path
212
-	 * @return bool
213
-	 */
214
-	protected function decryptFile($path) {
215
-		// skip already decrypted files
216
-		$fileInfo = $this->rootView->getFileInfo($path);
217
-		if ($fileInfo !== false && !$fileInfo->isEncrypted()) {
218
-			return true;
219
-		}
208
+    /**
209
+     * encrypt file
210
+     *
211
+     * @param string $path
212
+     * @return bool
213
+     */
214
+    protected function decryptFile($path) {
215
+        // skip already decrypted files
216
+        $fileInfo = $this->rootView->getFileInfo($path);
217
+        if ($fileInfo !== false && !$fileInfo->isEncrypted()) {
218
+            return true;
219
+        }
220 220
 
221
-		$source = $path;
222
-		$target = $path . '.decrypted.' . $this->getTimestamp();
221
+        $source = $path;
222
+        $target = $path . '.decrypted.' . $this->getTimestamp();
223 223
 
224
-		try {
225
-			$this->rootView->copy($source, $target);
226
-			$this->rootView->touch($target, $fileInfo->getMTime());
227
-			$this->rootView->rename($target, $source);
228
-		} catch (DecryptionFailedException $e) {
229
-			if ($this->rootView->file_exists($target)) {
230
-				$this->rootView->unlink($target);
231
-			}
232
-			return false;
233
-		}
224
+        try {
225
+            $this->rootView->copy($source, $target);
226
+            $this->rootView->touch($target, $fileInfo->getMTime());
227
+            $this->rootView->rename($target, $source);
228
+        } catch (DecryptionFailedException $e) {
229
+            if ($this->rootView->file_exists($target)) {
230
+                $this->rootView->unlink($target);
231
+            }
232
+            return false;
233
+        }
234 234
 
235
-		return true;
236
-	}
235
+        return true;
236
+    }
237 237
 
238
-	/**
239
-	 * get current timestamp
240
-	 *
241
-	 * @return int
242
-	 */
243
-	protected function getTimestamp() {
244
-		return time();
245
-	}
238
+    /**
239
+     * get current timestamp
240
+     *
241
+     * @return int
242
+     */
243
+    protected function getTimestamp() {
244
+        return time();
245
+    }
246 246
 
247 247
 
248
-	/**
249
-	 * setup user file system
250
-	 *
251
-	 * @param string $uid
252
-	 */
253
-	protected function setupUserFS($uid) {
254
-		\OC_Util::tearDownFS();
255
-		\OC_Util::setupFS($uid);
256
-	}
248
+    /**
249
+     * setup user file system
250
+     *
251
+     * @param string $uid
252
+     */
253
+    protected function setupUserFS($uid) {
254
+        \OC_Util::tearDownFS();
255
+        \OC_Util::setupFS($uid);
256
+    }
257 257
 }
Please login to merge, or discard this patch.
lib/private/Federation/CloudFederationNotification.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -33,35 +33,35 @@
 block discarded – undo
33 33
  * @since 14.0.0
34 34
  */
35 35
 class CloudFederationNotification implements ICloudFederationNotification {
36
-	private $message = [];
36
+    private $message = [];
37 37
 
38
-	/**
39
-	 * add a message to the notification
40
-	 *
41
-	 * @param string $notificationType (e.g. SHARE_ACCEPTED)
42
-	 * @param string $resourceType (e.g. file, calendar, contact,...)
43
-	 * @param string $providerId id of the share
44
-	 * @param array $notification payload of the notification
45
-	 *
46
-	 * @since 14.0.0
47
-	 */
48
-	public function setMessage($notificationType, $resourceType, $providerId, array $notification) {
49
-		$this->message = [
50
-			'notificationType' => $notificationType,
51
-			'resourceType' => $resourceType,
52
-			'providerId' => $providerId,
53
-			'notification' => $notification,
54
-		];
55
-	}
38
+    /**
39
+     * add a message to the notification
40
+     *
41
+     * @param string $notificationType (e.g. SHARE_ACCEPTED)
42
+     * @param string $resourceType (e.g. file, calendar, contact,...)
43
+     * @param string $providerId id of the share
44
+     * @param array $notification payload of the notification
45
+     *
46
+     * @since 14.0.0
47
+     */
48
+    public function setMessage($notificationType, $resourceType, $providerId, array $notification) {
49
+        $this->message = [
50
+            'notificationType' => $notificationType,
51
+            'resourceType' => $resourceType,
52
+            'providerId' => $providerId,
53
+            'notification' => $notification,
54
+        ];
55
+    }
56 56
 
57
-	/**
58
-	 * get message, ready to send out
59
-	 *
60
-	 * @return array
61
-	 *
62
-	 * @since 14.0.0
63
-	 */
64
-	public function getMessage() {
65
-		return $this->message;
66
-	}
57
+    /**
58
+     * get message, ready to send out
59
+     *
60
+     * @return array
61
+     *
62
+     * @since 14.0.0
63
+     */
64
+    public function getMessage() {
65
+        return $this->message;
66
+    }
67 67
 }
Please login to merge, or discard this patch.
lib/private/Security/FeaturePolicy/FeaturePolicy.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -27,51 +27,51 @@
 block discarded – undo
27 27
 namespace OC\Security\FeaturePolicy;
28 28
 
29 29
 class FeaturePolicy extends \OCP\AppFramework\Http\FeaturePolicy {
30
-	public function getAutoplayDomains(): array {
31
-		return $this->autoplayDomains;
32
-	}
30
+    public function getAutoplayDomains(): array {
31
+        return $this->autoplayDomains;
32
+    }
33 33
 
34
-	public function setAutoplayDomains(array $autoplayDomains): void {
35
-		$this->autoplayDomains = $autoplayDomains;
36
-	}
34
+    public function setAutoplayDomains(array $autoplayDomains): void {
35
+        $this->autoplayDomains = $autoplayDomains;
36
+    }
37 37
 
38
-	public function getCameraDomains(): array {
39
-		return $this->cameraDomains;
40
-	}
38
+    public function getCameraDomains(): array {
39
+        return $this->cameraDomains;
40
+    }
41 41
 
42
-	public function setCameraDomains(array $cameraDomains): void {
43
-		$this->cameraDomains = $cameraDomains;
44
-	}
42
+    public function setCameraDomains(array $cameraDomains): void {
43
+        $this->cameraDomains = $cameraDomains;
44
+    }
45 45
 
46
-	public function getFullscreenDomains(): array {
47
-		return $this->fullscreenDomains;
48
-	}
46
+    public function getFullscreenDomains(): array {
47
+        return $this->fullscreenDomains;
48
+    }
49 49
 
50
-	public function setFullscreenDomains(array $fullscreenDomains): void {
51
-		$this->fullscreenDomains = $fullscreenDomains;
52
-	}
50
+    public function setFullscreenDomains(array $fullscreenDomains): void {
51
+        $this->fullscreenDomains = $fullscreenDomains;
52
+    }
53 53
 
54
-	public function getGeolocationDomains(): array {
55
-		return $this->geolocationDomains;
56
-	}
54
+    public function getGeolocationDomains(): array {
55
+        return $this->geolocationDomains;
56
+    }
57 57
 
58
-	public function setGeolocationDomains(array $geolocationDomains): void {
59
-		$this->geolocationDomains = $geolocationDomains;
60
-	}
58
+    public function setGeolocationDomains(array $geolocationDomains): void {
59
+        $this->geolocationDomains = $geolocationDomains;
60
+    }
61 61
 
62
-	public function getMicrophoneDomains(): array {
63
-		return $this->microphoneDomains;
64
-	}
62
+    public function getMicrophoneDomains(): array {
63
+        return $this->microphoneDomains;
64
+    }
65 65
 
66
-	public function setMicrophoneDomains(array $microphoneDomains): void {
67
-		$this->microphoneDomains = $microphoneDomains;
68
-	}
66
+    public function setMicrophoneDomains(array $microphoneDomains): void {
67
+        $this->microphoneDomains = $microphoneDomains;
68
+    }
69 69
 
70
-	public function getPaymentDomains(): array {
71
-		return $this->paymentDomains;
72
-	}
70
+    public function getPaymentDomains(): array {
71
+        return $this->paymentDomains;
72
+    }
73 73
 
74
-	public function setPaymentDomains(array $paymentDomains): void {
75
-		$this->paymentDomains = $paymentDomains;
76
-	}
74
+    public function setPaymentDomains(array $paymentDomains): void {
75
+        $this->paymentDomains = $paymentDomains;
76
+    }
77 77
 }
Please login to merge, or discard this patch.
lib/private/Security/CSRF/CsrfToken.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
 	public function getEncryptedValue(): string {
58 58
 		if ($this->encryptedValue === '') {
59 59
 			$sharedSecret = random_bytes(\strlen($this->value));
60
-			$this->encryptedValue = base64_encode($this->value ^ $sharedSecret) . ':' . base64_encode($sharedSecret);
60
+			$this->encryptedValue = base64_encode($this->value ^ $sharedSecret).':'.base64_encode($sharedSecret);
61 61
 		}
62 62
 
63 63
 		return $this->encryptedValue;
Please login to merge, or discard this patch.
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -17,40 +17,40 @@
 block discarded – undo
17 17
  * @package OC\Security\CSRF
18 18
  */
19 19
 class CsrfToken {
20
-	private string $encryptedValue = '';
20
+    private string $encryptedValue = '';
21 21
 
22
-	/**
23
-	 * @param string $value Value of the token. Can be encrypted or not encrypted.
24
-	 */
25
-	public function __construct(
26
-		private string $value,
27
-	) {
28
-	}
22
+    /**
23
+     * @param string $value Value of the token. Can be encrypted or not encrypted.
24
+     */
25
+    public function __construct(
26
+        private string $value,
27
+    ) {
28
+    }
29 29
 
30
-	/**
31
-	 * Encrypted value of the token. This is used to mitigate BREACH alike
32
-	 * vulnerabilities. For display measures do use this functionality.
33
-	 */
34
-	public function getEncryptedValue(): string {
35
-		if ($this->encryptedValue === '') {
36
-			$sharedSecret = random_bytes(\strlen($this->value));
37
-			$this->encryptedValue = base64_encode($this->value ^ $sharedSecret) . ':' . base64_encode($sharedSecret);
38
-		}
30
+    /**
31
+     * Encrypted value of the token. This is used to mitigate BREACH alike
32
+     * vulnerabilities. For display measures do use this functionality.
33
+     */
34
+    public function getEncryptedValue(): string {
35
+        if ($this->encryptedValue === '') {
36
+            $sharedSecret = random_bytes(\strlen($this->value));
37
+            $this->encryptedValue = base64_encode($this->value ^ $sharedSecret) . ':' . base64_encode($sharedSecret);
38
+        }
39 39
 
40
-		return $this->encryptedValue;
41
-	}
40
+        return $this->encryptedValue;
41
+    }
42 42
 
43
-	/**
44
-	 * The unencrypted value of the token. Used for decrypting an already
45
-	 * encrypted token.
46
-	 */
47
-	public function getDecryptedValue(): string {
48
-		$token = explode(':', $this->value);
49
-		if (\count($token) !== 2) {
50
-			return '';
51
-		}
52
-		$obfuscatedToken = $token[0];
53
-		$secret = $token[1];
54
-		return base64_decode($obfuscatedToken) ^ base64_decode($secret);
55
-	}
43
+    /**
44
+     * The unencrypted value of the token. Used for decrypting an already
45
+     * encrypted token.
46
+     */
47
+    public function getDecryptedValue(): string {
48
+        $token = explode(':', $this->value);
49
+        if (\count($token) !== 2) {
50
+            return '';
51
+        }
52
+        $obfuscatedToken = $token[0];
53
+        $secret = $token[1];
54
+        return base64_decode($obfuscatedToken) ^ base64_decode($secret);
55
+    }
56 56
 }
Please login to merge, or discard this patch.
lib/private/Command/QueueBus.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -27,48 +27,48 @@
 block discarded – undo
27 27
 use OCP\Command\ICommand;
28 28
 
29 29
 class QueueBus implements IBus {
30
-	/**
31
-	 * @var ICommand[]|callable[]
32
-	 */
33
-	private $queue = [];
30
+    /**
31
+     * @var ICommand[]|callable[]
32
+     */
33
+    private $queue = [];
34 34
 
35
-	/**
36
-	 * Schedule a command to be fired
37
-	 *
38
-	 * @param \OCP\Command\ICommand | callable $command
39
-	 */
40
-	public function push($command) {
41
-		$this->queue[] = $command;
42
-	}
35
+    /**
36
+     * Schedule a command to be fired
37
+     *
38
+     * @param \OCP\Command\ICommand | callable $command
39
+     */
40
+    public function push($command) {
41
+        $this->queue[] = $command;
42
+    }
43 43
 
44
-	/**
45
-	 * Require all commands using a trait to be run synchronous
46
-	 *
47
-	 * @param string $trait
48
-	 */
49
-	public function requireSync($trait) {
50
-	}
44
+    /**
45
+     * Require all commands using a trait to be run synchronous
46
+     *
47
+     * @param string $trait
48
+     */
49
+    public function requireSync($trait) {
50
+    }
51 51
 
52
-	/**
53
-	 * @param \OCP\Command\ICommand | callable $command
54
-	 */
55
-	private function runCommand($command) {
56
-		if ($command instanceof ICommand) {
57
-			// ensure the command can be serialized
58
-			$serialized = serialize($command);
59
-			if (strlen($serialized) > 4000) {
60
-				throw new \InvalidArgumentException('Trying to push a command which serialized form can not be stored in the database (>4000 character)');
61
-			}
62
-			$unserialized = unserialize($serialized);
63
-			$unserialized->handle();
64
-		} else {
65
-			$command();
66
-		}
67
-	}
52
+    /**
53
+     * @param \OCP\Command\ICommand | callable $command
54
+     */
55
+    private function runCommand($command) {
56
+        if ($command instanceof ICommand) {
57
+            // ensure the command can be serialized
58
+            $serialized = serialize($command);
59
+            if (strlen($serialized) > 4000) {
60
+                throw new \InvalidArgumentException('Trying to push a command which serialized form can not be stored in the database (>4000 character)');
61
+            }
62
+            $unserialized = unserialize($serialized);
63
+            $unserialized->handle();
64
+        } else {
65
+            $command();
66
+        }
67
+    }
68 68
 
69
-	public function run() {
70
-		while ($command = array_shift($this->queue)) {
71
-			$this->runCommand($command);
72
-		}
73
-	}
69
+    public function run() {
70
+        while ($command = array_shift($this->queue)) {
71
+            $this->runCommand($command);
72
+        }
73
+    }
74 74
 }
Please login to merge, or discard this patch.
apps/user_ldap/lib/WizardResult.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -30,50 +30,50 @@
 block discarded – undo
30 30
 namespace OCA\User_LDAP;
31 31
 
32 32
 class WizardResult {
33
-	protected $changes = [];
34
-	protected $options = [];
35
-	protected $markedChange = false;
33
+    protected $changes = [];
34
+    protected $options = [];
35
+    protected $markedChange = false;
36 36
 
37
-	/**
38
-	 * @param string $key
39
-	 * @param mixed $value
40
-	 */
41
-	public function addChange($key, $value) {
42
-		$this->changes[$key] = $value;
43
-	}
37
+    /**
38
+     * @param string $key
39
+     * @param mixed $value
40
+     */
41
+    public function addChange($key, $value) {
42
+        $this->changes[$key] = $value;
43
+    }
44 44
 
45 45
 	
46
-	public function markChange() {
47
-		$this->markedChange = true;
48
-	}
46
+    public function markChange() {
47
+        $this->markedChange = true;
48
+    }
49 49
 
50
-	/**
51
-	 * @param string $key
52
-	 * @param array|string $values
53
-	 */
54
-	public function addOptions($key, $values) {
55
-		if (!is_array($values)) {
56
-			$values = [$values];
57
-		}
58
-		$this->options[$key] = $values;
59
-	}
50
+    /**
51
+     * @param string $key
52
+     * @param array|string $values
53
+     */
54
+    public function addOptions($key, $values) {
55
+        if (!is_array($values)) {
56
+            $values = [$values];
57
+        }
58
+        $this->options[$key] = $values;
59
+    }
60 60
 
61
-	/**
62
-	 * @return bool
63
-	 */
64
-	public function hasChanges() {
65
-		return (count($this->changes) > 0 || $this->markedChange);
66
-	}
61
+    /**
62
+     * @return bool
63
+     */
64
+    public function hasChanges() {
65
+        return (count($this->changes) > 0 || $this->markedChange);
66
+    }
67 67
 
68
-	/**
69
-	 * @return array
70
-	 */
71
-	public function getResultArray() {
72
-		$result = [];
73
-		$result['changes'] = $this->changes;
74
-		if (count($this->options) > 0) {
75
-			$result['options'] = $this->options;
76
-		}
77
-		return $result;
78
-	}
68
+    /**
69
+     * @return array
70
+     */
71
+    public function getResultArray() {
72
+        $result = [];
73
+        $result['changes'] = $this->changes;
74
+        if (count($this->options) > 0) {
75
+            $result['options'] = $this->options;
76
+        }
77
+        return $result;
78
+    }
79 79
 }
Please login to merge, or discard this patch.
apps/user_ldap/ajax/setConfiguration.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
 \OC_JSON::checkAppEnabled('user_ldap');
31 31
 \OC_JSON::callCheck();
32 32
 
33
-$prefix = (string)$_POST['ldap_serverconfig_chooser'];
33
+$prefix = (string) $_POST['ldap_serverconfig_chooser'];
34 34
 
35 35
 // Checkboxes are not submitted, when they are unchecked. Set them manually.
36 36
 // only legacy checkboxes (Advanced and Expert tab) need to be handled here,
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@
 block discarded – undo
18 18
 // only legacy checkboxes (Advanced and Expert tab) need to be handled here,
19 19
 // the Wizard-like tabs handle it on their own
20 20
 $chkboxes = ['ldap_configuration_active', 'ldap_override_main_server',
21
-	'ldap_turn_off_cert_check'];
21
+    'ldap_turn_off_cert_check'];
22 22
 foreach ($chkboxes as $boxid) {
23
-	if (!isset($_POST[$boxid])) {
24
-		$_POST[$boxid] = 0;
25
-	}
23
+    if (!isset($_POST[$boxid])) {
24
+        $_POST[$boxid] = 0;
25
+    }
26 26
 }
27 27
 
28 28
 $ldapWrapper = new LDAP();
Please login to merge, or discard this patch.
apps/dav/lib/Command/ListCalendars.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 			}
78 78
 
79 79
 			$readOnly = false;
80
-			$readOnlyIndex = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only';
80
+			$readOnlyIndex = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only';
81 81
 			if (isset($calendar[$readOnlyIndex])) {
82 82
 				$readOnly = $calendar[$readOnlyIndex];
83 83
 			}
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 			$calendarTableData[] = [
86 86
 				$calendar['uri'],
87 87
 				$calendar['{DAV:}displayname'],
88
-				$calendar['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'],
89
-				$calendar['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'],
88
+				$calendar['{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal'],
89
+				$calendar['{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname'],
90 90
 				$readOnly ? ' x ' : ' ✓ ',
91 91
 			];
92 92
 		}
Please login to merge, or discard this patch.
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -15,61 +15,61 @@
 block discarded – undo
15 15
 use Symfony\Component\Console\Output\OutputInterface;
16 16
 
17 17
 class ListCalendars extends Command {
18
-	public function __construct(
19
-		protected IUserManager $userManager,
20
-		private CalDavBackend $caldav,
21
-	) {
22
-		parent::__construct();
23
-	}
18
+    public function __construct(
19
+        protected IUserManager $userManager,
20
+        private CalDavBackend $caldav,
21
+    ) {
22
+        parent::__construct();
23
+    }
24 24
 
25
-	protected function configure(): void {
26
-		$this
27
-			->setName('dav:list-calendars')
28
-			->setDescription('List all calendars of a user')
29
-			->addArgument('uid',
30
-				InputArgument::REQUIRED,
31
-				'User for whom all calendars will be listed');
32
-	}
25
+    protected function configure(): void {
26
+        $this
27
+            ->setName('dav:list-calendars')
28
+            ->setDescription('List all calendars of a user')
29
+            ->addArgument('uid',
30
+                InputArgument::REQUIRED,
31
+                'User for whom all calendars will be listed');
32
+    }
33 33
 
34
-	protected function execute(InputInterface $input, OutputInterface $output): int {
35
-		$user = $input->getArgument('uid');
36
-		if (!$this->userManager->userExists($user)) {
37
-			throw new \InvalidArgumentException("User <$user> is unknown.");
38
-		}
34
+    protected function execute(InputInterface $input, OutputInterface $output): int {
35
+        $user = $input->getArgument('uid');
36
+        if (!$this->userManager->userExists($user)) {
37
+            throw new \InvalidArgumentException("User <$user> is unknown.");
38
+        }
39 39
 
40
-		$calendars = $this->caldav->getCalendarsForUser("principals/users/$user");
40
+        $calendars = $this->caldav->getCalendarsForUser("principals/users/$user");
41 41
 
42
-		$calendarTableData = [];
43
-		foreach ($calendars as $calendar) {
44
-			// skip birthday calendar
45
-			if ($calendar['uri'] === BirthdayService::BIRTHDAY_CALENDAR_URI) {
46
-				continue;
47
-			}
42
+        $calendarTableData = [];
43
+        foreach ($calendars as $calendar) {
44
+            // skip birthday calendar
45
+            if ($calendar['uri'] === BirthdayService::BIRTHDAY_CALENDAR_URI) {
46
+                continue;
47
+            }
48 48
 
49
-			$readOnly = false;
50
-			$readOnlyIndex = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only';
51
-			if (isset($calendar[$readOnlyIndex])) {
52
-				$readOnly = $calendar[$readOnlyIndex];
53
-			}
49
+            $readOnly = false;
50
+            $readOnlyIndex = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only';
51
+            if (isset($calendar[$readOnlyIndex])) {
52
+                $readOnly = $calendar[$readOnlyIndex];
53
+            }
54 54
 
55
-			$calendarTableData[] = [
56
-				$calendar['uri'],
57
-				$calendar['{DAV:}displayname'],
58
-				$calendar['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'],
59
-				$calendar['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'],
60
-				$readOnly ? ' x ' : ' ✓ ',
61
-			];
62
-		}
55
+            $calendarTableData[] = [
56
+                $calendar['uri'],
57
+                $calendar['{DAV:}displayname'],
58
+                $calendar['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'],
59
+                $calendar['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'],
60
+                $readOnly ? ' x ' : ' ✓ ',
61
+            ];
62
+        }
63 63
 
64
-		if (count($calendarTableData) > 0) {
65
-			$table = new Table($output);
66
-			$table->setHeaders(['URI', 'Displayname', 'Owner principal', 'Owner displayname', 'Writable'])
67
-				->setRows($calendarTableData);
64
+        if (count($calendarTableData) > 0) {
65
+            $table = new Table($output);
66
+            $table->setHeaders(['URI', 'Displayname', 'Owner principal', 'Owner displayname', 'Writable'])
67
+                ->setRows($calendarTableData);
68 68
 
69
-			$table->render();
70
-		} else {
71
-			$output->writeln("<info>User <$user> has no calendars</info>");
72
-		}
73
-		return self::SUCCESS;
74
-	}
69
+            $table->render();
70
+        } else {
71
+            $output->writeln("<info>User <$user> has no calendars</info>");
72
+        }
73
+        return self::SUCCESS;
74
+    }
75 75
 }
Please login to merge, or discard this patch.