Passed
Push — master ( 4908d8...fbbdc6 )
by Joas
16:12 queued 12s
created
lib/public/AppFramework/Services/IAppConfig.php 1 patch
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -31,81 +31,81 @@
 block discarded – undo
31 31
  * @since 20.0.0
32 32
  */
33 33
 interface IAppConfig {
34
-	/**
35
-	 * Get all keys stored for this app
36
-	 *
37
-	 * @return string[] the keys stored for the app
38
-	 * @since 20.0.0
39
-	 */
40
-	public function getAppKeys(): array ;
34
+    /**
35
+     * Get all keys stored for this app
36
+     *
37
+     * @return string[] the keys stored for the app
38
+     * @since 20.0.0
39
+     */
40
+    public function getAppKeys(): array ;
41 41
 
42
-	/**
43
-	 * Writes a new app wide value
44
-	 *
45
-	 * @param string $key the key of the value, under which will be saved
46
-	 * @param string $value the value that should be stored
47
-	 * @return void
48
-	 * @since 20.0.0
49
-	 */
50
-	public function setAppValue(string $key, string $value): void;
42
+    /**
43
+     * Writes a new app wide value
44
+     *
45
+     * @param string $key the key of the value, under which will be saved
46
+     * @param string $value the value that should be stored
47
+     * @return void
48
+     * @since 20.0.0
49
+     */
50
+    public function setAppValue(string $key, string $value): void;
51 51
 
52
-	/**
53
-	 * Looks up an app wide defined value
54
-	 *
55
-	 * @param string $key the key of the value, under which it was saved
56
-	 * @param string $default the default value to be returned if the value isn't set
57
-	 * @return string the saved value
58
-	 * @since 20.0.0
59
-	 */
60
-	public function getAppValue(string $key, string $default = ''): string;
52
+    /**
53
+     * Looks up an app wide defined value
54
+     *
55
+     * @param string $key the key of the value, under which it was saved
56
+     * @param string $default the default value to be returned if the value isn't set
57
+     * @return string the saved value
58
+     * @since 20.0.0
59
+     */
60
+    public function getAppValue(string $key, string $default = ''): string;
61 61
 
62
-	/**
63
-	 * Delete an app wide defined value
64
-	 *
65
-	 * @param string $key the key of the value, under which it was saved
66
-	 * @return void
67
-	 * @since 20.0.0
68
-	 */
69
-	public function deleteAppValue(string $key): void;
62
+    /**
63
+     * Delete an app wide defined value
64
+     *
65
+     * @param string $key the key of the value, under which it was saved
66
+     * @return void
67
+     * @since 20.0.0
68
+     */
69
+    public function deleteAppValue(string $key): void;
70 70
 
71
-	/**
72
-	 * Removes all keys in appconfig belonging to the app
73
-	 *
74
-	 * @return void
75
-	 * @since 20.0.0
76
-	 */
77
-	public function deleteAppValues(): void;
71
+    /**
72
+     * Removes all keys in appconfig belonging to the app
73
+     *
74
+     * @return void
75
+     * @since 20.0.0
76
+     */
77
+    public function deleteAppValues(): void;
78 78
 
79
-	/**
80
-	 * Set a user defined value
81
-	 *
82
-	 * @param string $userId the userId of the user that we want to store the value under
83
-	 * @param string $key the key under which the value is being stored
84
-	 * @param string $value the value that you want to store
85
-	 * @param string $preCondition only update if the config value was previously the value passed as $preCondition
86
-	 * @throws \OCP\PreConditionNotMetException if a precondition is specified and is not met
87
-	 * @throws \UnexpectedValueException when trying to store an unexpected value
88
-	 * @since 20.0.0
89
-	 */
90
-	public function setUserValue(string $userId, string $key, string $value, ?string $preCondition = null): void;
79
+    /**
80
+     * Set a user defined value
81
+     *
82
+     * @param string $userId the userId of the user that we want to store the value under
83
+     * @param string $key the key under which the value is being stored
84
+     * @param string $value the value that you want to store
85
+     * @param string $preCondition only update if the config value was previously the value passed as $preCondition
86
+     * @throws \OCP\PreConditionNotMetException if a precondition is specified and is not met
87
+     * @throws \UnexpectedValueException when trying to store an unexpected value
88
+     * @since 20.0.0
89
+     */
90
+    public function setUserValue(string $userId, string $key, string $value, ?string $preCondition = null): void;
91 91
 
92
-	/**
93
-	 * Shortcut for getting a user defined value
94
-	 *
95
-	 * @param string $userId the userId of the user that we want to store the value under
96
-	 * @param string $key the key under which the value is being stored
97
-	 * @param mixed $default the default value to be returned if the value isn't set
98
-	 * @return string
99
-	 * @since 20.0.0
100
-	 */
101
-	public function getUserValue(string $userId, string $key, string $default = ''): string;
92
+    /**
93
+     * Shortcut for getting a user defined value
94
+     *
95
+     * @param string $userId the userId of the user that we want to store the value under
96
+     * @param string $key the key under which the value is being stored
97
+     * @param mixed $default the default value to be returned if the value isn't set
98
+     * @return string
99
+     * @since 20.0.0
100
+     */
101
+    public function getUserValue(string $userId, string $key, string $default = ''): string;
102 102
 
103
-	/**
104
-	 * Delete a user value
105
-	 *
106
-	 * @param string $userId the userId of the user that we want to store the value under
107
-	 * @param string $key the key under which the value is being stored
108
-	 * @since 20.0.0
109
-	 */
110
-	public function deleteUserValue(string $userId, string $key): void;
103
+    /**
104
+     * Delete a user value
105
+     *
106
+     * @param string $userId the userId of the user that we want to store the value under
107
+     * @param string $key the key under which the value is being stored
108
+     * @since 20.0.0
109
+     */
110
+    public function deleteUserValue(string $userId, string $key): void;
111 111
 }
Please login to merge, or discard this patch.
lib/private/AppFramework/Services/InitialState.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -29,22 +29,22 @@
 block discarded – undo
29 29
 use OCP\IInitialStateService;
30 30
 
31 31
 class InitialState implements IInitialState {
32
-	/** @var IInitialStateService */
33
-	private $state;
32
+    /** @var IInitialStateService */
33
+    private $state;
34 34
 
35
-	/** @var string */
36
-	private $appName;
35
+    /** @var string */
36
+    private $appName;
37 37
 
38
-	public function __construct(IInitialStateService $state, string $appName) {
39
-		$this->state = $state;
40
-		$this->appName = $appName;
41
-	}
38
+    public function __construct(IInitialStateService $state, string $appName) {
39
+        $this->state = $state;
40
+        $this->appName = $appName;
41
+    }
42 42
 
43
-	public function provideInitialState(string $key, $data): void {
44
-		$this->state->provideInitialState($this->appName, $key, $data);
45
-	}
43
+    public function provideInitialState(string $key, $data): void {
44
+        $this->state->provideInitialState($this->appName, $key, $data);
45
+    }
46 46
 
47
-	public function provideLazyInitialState(string $key, \Closure $closure): void {
48
-		$this->state->provideLazyInitialState($this->appName, $key, $closure);
49
-	}
47
+    public function provideLazyInitialState(string $key, \Closure $closure): void {
48
+        $this->state->provideLazyInitialState($this->appName, $key, $closure);
49
+    }
50 50
 }
Please login to merge, or discard this patch.
resources/update-locales.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -25,28 +25,28 @@
 block discarded – undo
25 25
  */
26 26
 
27 27
 if (!extension_loaded('intl')) {
28
-	echo 'Intl extension is required to run this script.';
29
-	exit(1);
28
+    echo 'Intl extension is required to run this script.';
29
+    exit(1);
30 30
 }
31 31
 
32 32
 require '../3rdparty/autoload.php';
33 33
 
34 34
 $locales = array_map(static function (string $localeCode) {
35
-	return [
36
-		'code' => $localeCode,
37
-		'name' => Locale::getDisplayName($localeCode, 'en')
38
-	];
35
+    return [
36
+        'code' => $localeCode,
37
+        'name' => Locale::getDisplayName($localeCode, 'en')
38
+    ];
39 39
 }, ResourceBundle::getLocales(''));
40 40
 
41 41
 $locales = array_filter($locales, static function (array $locale) {
42
-	return is_array(Punic\Data::explodeLocale($locale['code']));
42
+    return is_array(Punic\Data::explodeLocale($locale['code']));
43 43
 });
44 44
 
45 45
 $locales = array_values($locales);
46 46
 
47 47
 if (file_put_contents(__DIR__ . '/locales.json', json_encode($locales, JSON_PRETTY_PRINT)) === false) {
48
-	echo 'Failed to update locales.json';
49
-	exit(1);
48
+    echo 'Failed to update locales.json';
49
+    exit(1);
50 50
 }
51 51
 
52 52
 echo 'Updated locales.json. Don\'t forget to commit the result.';
Please login to merge, or discard this patch.
apps/comments/lib/Capabilities.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@
 block discarded – undo
26 26
 use OCP\Capabilities\ICapability;
27 27
 
28 28
 class Capabilities implements ICapability {
29
-	public function getCapabilities(): array {
30
-		return [
31
-			'files' => [
32
-				'comments' => true,
33
-			]
34
-		];
35
-	}
29
+    public function getCapabilities(): array {
30
+        return [
31
+            'files' => [
32
+                'comments' => true,
33
+            ]
34
+        ];
35
+    }
36 36
 }
Please login to merge, or discard this patch.
lib/private/Files/Node/HookConnector.php 1 patch
Indentation   +198 added lines, -198 removed lines patch added patch discarded remove patch
@@ -47,202 +47,202 @@
 block discarded – undo
47 47
 use Symfony\Component\EventDispatcher\EventDispatcherInterface;
48 48
 
49 49
 class HookConnector {
50
-	/** @var IRootFolder */
51
-	private $root;
52
-
53
-	/** @var View */
54
-	private $view;
55
-
56
-	/** @var FileInfo[] */
57
-	private $deleteMetaCache = [];
58
-
59
-	/** @var EventDispatcherInterface */
60
-	private $legacyDispatcher;
61
-
62
-	/** @var IEventDispatcher */
63
-	private $dispatcher;
64
-
65
-	/**
66
-	 * HookConnector constructor.
67
-	 *
68
-	 * @param Root $root
69
-	 * @param View $view
70
-	 */
71
-	public function __construct(
72
-		IRootFolder $root,
73
-		View $view,
74
-		EventDispatcherInterface $legacyDispatcher,
75
-		IEventDispatcher $dispatcher) {
76
-		$this->root = $root;
77
-		$this->view = $view;
78
-		$this->legacyDispatcher = $legacyDispatcher;
79
-		$this->dispatcher = $dispatcher;
80
-	}
81
-
82
-	public function viewToNode() {
83
-		Util::connectHook('OC_Filesystem', 'write', $this, 'write');
84
-		Util::connectHook('OC_Filesystem', 'post_write', $this, 'postWrite');
85
-
86
-		Util::connectHook('OC_Filesystem', 'create', $this, 'create');
87
-		Util::connectHook('OC_Filesystem', 'post_create', $this, 'postCreate');
88
-
89
-		Util::connectHook('OC_Filesystem', 'delete', $this, 'delete');
90
-		Util::connectHook('OC_Filesystem', 'post_delete', $this, 'postDelete');
91
-
92
-		Util::connectHook('OC_Filesystem', 'rename', $this, 'rename');
93
-		Util::connectHook('OC_Filesystem', 'post_rename', $this, 'postRename');
94
-
95
-		Util::connectHook('OC_Filesystem', 'copy', $this, 'copy');
96
-		Util::connectHook('OC_Filesystem', 'post_copy', $this, 'postCopy');
97
-
98
-		Util::connectHook('OC_Filesystem', 'touch', $this, 'touch');
99
-		Util::connectHook('OC_Filesystem', 'post_touch', $this, 'postTouch');
100
-
101
-		Util::connectHook('OC_Filesystem', 'read', $this, 'read');
102
-	}
103
-
104
-	public function write($arguments) {
105
-		$node = $this->getNodeForPath($arguments['path']);
106
-		$this->root->emit('\OC\Files', 'preWrite', [$node]);
107
-		$this->legacyDispatcher->dispatch('\OCP\Files::preWrite', new GenericEvent($node));
108
-
109
-		$event = new BeforeNodeWrittenEvent($node);
110
-		$this->dispatcher->dispatchTyped($event);
111
-	}
112
-
113
-	public function postWrite($arguments) {
114
-		$node = $this->getNodeForPath($arguments['path']);
115
-		$this->root->emit('\OC\Files', 'postWrite', [$node]);
116
-		$this->legacyDispatcher->dispatch('\OCP\Files::postWrite', new GenericEvent($node));
117
-
118
-		$event = new NodeWrittenEvent($node);
119
-		$this->dispatcher->dispatchTyped($event);
120
-	}
121
-
122
-	public function create($arguments) {
123
-		$node = $this->getNodeForPath($arguments['path']);
124
-		$this->root->emit('\OC\Files', 'preCreate', [$node]);
125
-		$this->legacyDispatcher->dispatch('\OCP\Files::preCreate', new GenericEvent($node));
126
-
127
-		$event = new BeforeNodeCreatedEvent($node);
128
-		$this->dispatcher->dispatchTyped($event);
129
-	}
130
-
131
-	public function postCreate($arguments) {
132
-		$node = $this->getNodeForPath($arguments['path']);
133
-		$this->root->emit('\OC\Files', 'postCreate', [$node]);
134
-		$this->legacyDispatcher->dispatch('\OCP\Files::postCreate', new GenericEvent($node));
135
-
136
-		$event = new NodeCreatedEvent($node);
137
-		$this->dispatcher->dispatchTyped($event);
138
-	}
139
-
140
-	public function delete($arguments) {
141
-		$node = $this->getNodeForPath($arguments['path']);
142
-		$this->deleteMetaCache[$node->getPath()] = $node->getFileInfo();
143
-		$this->root->emit('\OC\Files', 'preDelete', [$node]);
144
-		$this->legacyDispatcher->dispatch('\OCP\Files::preDelete', new GenericEvent($node));
145
-
146
-		$event = new BeforeNodeDeletedEvent($node);
147
-		$this->dispatcher->dispatchTyped($event);
148
-	}
149
-
150
-	public function postDelete($arguments) {
151
-		$node = $this->getNodeForPath($arguments['path']);
152
-		unset($this->deleteMetaCache[$node->getPath()]);
153
-		$this->root->emit('\OC\Files', 'postDelete', [$node]);
154
-		$this->legacyDispatcher->dispatch('\OCP\Files::postDelete', new GenericEvent($node));
155
-
156
-		$event = new NodeDeletedEvent($node);
157
-		$this->dispatcher->dispatchTyped($event);
158
-	}
159
-
160
-	public function touch($arguments) {
161
-		$node = $this->getNodeForPath($arguments['path']);
162
-		$this->root->emit('\OC\Files', 'preTouch', [$node]);
163
-		$this->legacyDispatcher->dispatch('\OCP\Files::preTouch', new GenericEvent($node));
164
-
165
-		$event = new BeforeNodeTouchedEvent($node);
166
-		$this->dispatcher->dispatchTyped($event);
167
-	}
168
-
169
-	public function postTouch($arguments) {
170
-		$node = $this->getNodeForPath($arguments['path']);
171
-		$this->root->emit('\OC\Files', 'postTouch', [$node]);
172
-		$this->legacyDispatcher->dispatch('\OCP\Files::postTouch', new GenericEvent($node));
173
-
174
-		$event = new NodeTouchedEvent($node);
175
-		$this->dispatcher->dispatchTyped($event);
176
-	}
177
-
178
-	public function rename($arguments) {
179
-		$source = $this->getNodeForPath($arguments['oldpath']);
180
-		$target = $this->getNodeForPath($arguments['newpath']);
181
-		$this->root->emit('\OC\Files', 'preRename', [$source, $target]);
182
-		$this->legacyDispatcher->dispatch('\OCP\Files::preRename', new GenericEvent([$source, $target]));
183
-
184
-		$event = new BeforeNodeRenamedEvent($source, $target);
185
-		$this->dispatcher->dispatchTyped($event);
186
-	}
187
-
188
-	public function postRename($arguments) {
189
-		$source = $this->getNodeForPath($arguments['oldpath']);
190
-		$target = $this->getNodeForPath($arguments['newpath']);
191
-		$this->root->emit('\OC\Files', 'postRename', [$source, $target]);
192
-		$this->legacyDispatcher->dispatch('\OCP\Files::postRename', new GenericEvent([$source, $target]));
193
-
194
-		$event = new NodeRenamedEvent($source, $target);
195
-		$this->dispatcher->dispatchTyped($event);
196
-	}
197
-
198
-	public function copy($arguments) {
199
-		$source = $this->getNodeForPath($arguments['oldpath']);
200
-		$target = $this->getNodeForPath($arguments['newpath']);
201
-		$this->root->emit('\OC\Files', 'preCopy', [$source, $target]);
202
-		$this->legacyDispatcher->dispatch('\OCP\Files::preCopy', new GenericEvent([$source, $target]));
203
-
204
-		$event = new BeforeNodeCopiedEvent($source, $target);
205
-		$this->dispatcher->dispatchTyped($event);
206
-	}
207
-
208
-	public function postCopy($arguments) {
209
-		$source = $this->getNodeForPath($arguments['oldpath']);
210
-		$target = $this->getNodeForPath($arguments['newpath']);
211
-		$this->root->emit('\OC\Files', 'postCopy', [$source, $target]);
212
-		$this->legacyDispatcher->dispatch('\OCP\Files::postCopy', new GenericEvent([$source, $target]));
213
-
214
-		$event = new NodeCopiedEvent($source, $target);
215
-		$this->dispatcher->dispatchTyped($event);
216
-	}
217
-
218
-	public function read($arguments) {
219
-		$node = $this->getNodeForPath($arguments['path']);
220
-		$this->root->emit('\OC\Files', 'read', [$node]);
221
-		$this->legacyDispatcher->dispatch('\OCP\Files::read', new GenericEvent([$node]));
222
-
223
-		$event = new BeforeNodeReadEvent($node);
224
-		$this->dispatcher->dispatchTyped($event);
225
-	}
226
-
227
-	private function getNodeForPath($path) {
228
-		$info = Filesystem::getView()->getFileInfo($path);
229
-		if (!$info) {
230
-			$fullPath = Filesystem::getView()->getAbsolutePath($path);
231
-			if (isset($this->deleteMetaCache[$fullPath])) {
232
-				$info = $this->deleteMetaCache[$fullPath];
233
-			} else {
234
-				$info = null;
235
-			}
236
-			if (Filesystem::is_dir($path)) {
237
-				return new NonExistingFolder($this->root, $this->view, $fullPath, $info);
238
-			} else {
239
-				return new NonExistingFile($this->root, $this->view, $fullPath, $info);
240
-			}
241
-		}
242
-		if ($info->getType() === FileInfo::TYPE_FILE) {
243
-			return new File($this->root, $this->view, $info->getPath(), $info);
244
-		} else {
245
-			return new Folder($this->root, $this->view, $info->getPath(), $info);
246
-		}
247
-	}
50
+    /** @var IRootFolder */
51
+    private $root;
52
+
53
+    /** @var View */
54
+    private $view;
55
+
56
+    /** @var FileInfo[] */
57
+    private $deleteMetaCache = [];
58
+
59
+    /** @var EventDispatcherInterface */
60
+    private $legacyDispatcher;
61
+
62
+    /** @var IEventDispatcher */
63
+    private $dispatcher;
64
+
65
+    /**
66
+     * HookConnector constructor.
67
+     *
68
+     * @param Root $root
69
+     * @param View $view
70
+     */
71
+    public function __construct(
72
+        IRootFolder $root,
73
+        View $view,
74
+        EventDispatcherInterface $legacyDispatcher,
75
+        IEventDispatcher $dispatcher) {
76
+        $this->root = $root;
77
+        $this->view = $view;
78
+        $this->legacyDispatcher = $legacyDispatcher;
79
+        $this->dispatcher = $dispatcher;
80
+    }
81
+
82
+    public function viewToNode() {
83
+        Util::connectHook('OC_Filesystem', 'write', $this, 'write');
84
+        Util::connectHook('OC_Filesystem', 'post_write', $this, 'postWrite');
85
+
86
+        Util::connectHook('OC_Filesystem', 'create', $this, 'create');
87
+        Util::connectHook('OC_Filesystem', 'post_create', $this, 'postCreate');
88
+
89
+        Util::connectHook('OC_Filesystem', 'delete', $this, 'delete');
90
+        Util::connectHook('OC_Filesystem', 'post_delete', $this, 'postDelete');
91
+
92
+        Util::connectHook('OC_Filesystem', 'rename', $this, 'rename');
93
+        Util::connectHook('OC_Filesystem', 'post_rename', $this, 'postRename');
94
+
95
+        Util::connectHook('OC_Filesystem', 'copy', $this, 'copy');
96
+        Util::connectHook('OC_Filesystem', 'post_copy', $this, 'postCopy');
97
+
98
+        Util::connectHook('OC_Filesystem', 'touch', $this, 'touch');
99
+        Util::connectHook('OC_Filesystem', 'post_touch', $this, 'postTouch');
100
+
101
+        Util::connectHook('OC_Filesystem', 'read', $this, 'read');
102
+    }
103
+
104
+    public function write($arguments) {
105
+        $node = $this->getNodeForPath($arguments['path']);
106
+        $this->root->emit('\OC\Files', 'preWrite', [$node]);
107
+        $this->legacyDispatcher->dispatch('\OCP\Files::preWrite', new GenericEvent($node));
108
+
109
+        $event = new BeforeNodeWrittenEvent($node);
110
+        $this->dispatcher->dispatchTyped($event);
111
+    }
112
+
113
+    public function postWrite($arguments) {
114
+        $node = $this->getNodeForPath($arguments['path']);
115
+        $this->root->emit('\OC\Files', 'postWrite', [$node]);
116
+        $this->legacyDispatcher->dispatch('\OCP\Files::postWrite', new GenericEvent($node));
117
+
118
+        $event = new NodeWrittenEvent($node);
119
+        $this->dispatcher->dispatchTyped($event);
120
+    }
121
+
122
+    public function create($arguments) {
123
+        $node = $this->getNodeForPath($arguments['path']);
124
+        $this->root->emit('\OC\Files', 'preCreate', [$node]);
125
+        $this->legacyDispatcher->dispatch('\OCP\Files::preCreate', new GenericEvent($node));
126
+
127
+        $event = new BeforeNodeCreatedEvent($node);
128
+        $this->dispatcher->dispatchTyped($event);
129
+    }
130
+
131
+    public function postCreate($arguments) {
132
+        $node = $this->getNodeForPath($arguments['path']);
133
+        $this->root->emit('\OC\Files', 'postCreate', [$node]);
134
+        $this->legacyDispatcher->dispatch('\OCP\Files::postCreate', new GenericEvent($node));
135
+
136
+        $event = new NodeCreatedEvent($node);
137
+        $this->dispatcher->dispatchTyped($event);
138
+    }
139
+
140
+    public function delete($arguments) {
141
+        $node = $this->getNodeForPath($arguments['path']);
142
+        $this->deleteMetaCache[$node->getPath()] = $node->getFileInfo();
143
+        $this->root->emit('\OC\Files', 'preDelete', [$node]);
144
+        $this->legacyDispatcher->dispatch('\OCP\Files::preDelete', new GenericEvent($node));
145
+
146
+        $event = new BeforeNodeDeletedEvent($node);
147
+        $this->dispatcher->dispatchTyped($event);
148
+    }
149
+
150
+    public function postDelete($arguments) {
151
+        $node = $this->getNodeForPath($arguments['path']);
152
+        unset($this->deleteMetaCache[$node->getPath()]);
153
+        $this->root->emit('\OC\Files', 'postDelete', [$node]);
154
+        $this->legacyDispatcher->dispatch('\OCP\Files::postDelete', new GenericEvent($node));
155
+
156
+        $event = new NodeDeletedEvent($node);
157
+        $this->dispatcher->dispatchTyped($event);
158
+    }
159
+
160
+    public function touch($arguments) {
161
+        $node = $this->getNodeForPath($arguments['path']);
162
+        $this->root->emit('\OC\Files', 'preTouch', [$node]);
163
+        $this->legacyDispatcher->dispatch('\OCP\Files::preTouch', new GenericEvent($node));
164
+
165
+        $event = new BeforeNodeTouchedEvent($node);
166
+        $this->dispatcher->dispatchTyped($event);
167
+    }
168
+
169
+    public function postTouch($arguments) {
170
+        $node = $this->getNodeForPath($arguments['path']);
171
+        $this->root->emit('\OC\Files', 'postTouch', [$node]);
172
+        $this->legacyDispatcher->dispatch('\OCP\Files::postTouch', new GenericEvent($node));
173
+
174
+        $event = new NodeTouchedEvent($node);
175
+        $this->dispatcher->dispatchTyped($event);
176
+    }
177
+
178
+    public function rename($arguments) {
179
+        $source = $this->getNodeForPath($arguments['oldpath']);
180
+        $target = $this->getNodeForPath($arguments['newpath']);
181
+        $this->root->emit('\OC\Files', 'preRename', [$source, $target]);
182
+        $this->legacyDispatcher->dispatch('\OCP\Files::preRename', new GenericEvent([$source, $target]));
183
+
184
+        $event = new BeforeNodeRenamedEvent($source, $target);
185
+        $this->dispatcher->dispatchTyped($event);
186
+    }
187
+
188
+    public function postRename($arguments) {
189
+        $source = $this->getNodeForPath($arguments['oldpath']);
190
+        $target = $this->getNodeForPath($arguments['newpath']);
191
+        $this->root->emit('\OC\Files', 'postRename', [$source, $target]);
192
+        $this->legacyDispatcher->dispatch('\OCP\Files::postRename', new GenericEvent([$source, $target]));
193
+
194
+        $event = new NodeRenamedEvent($source, $target);
195
+        $this->dispatcher->dispatchTyped($event);
196
+    }
197
+
198
+    public function copy($arguments) {
199
+        $source = $this->getNodeForPath($arguments['oldpath']);
200
+        $target = $this->getNodeForPath($arguments['newpath']);
201
+        $this->root->emit('\OC\Files', 'preCopy', [$source, $target]);
202
+        $this->legacyDispatcher->dispatch('\OCP\Files::preCopy', new GenericEvent([$source, $target]));
203
+
204
+        $event = new BeforeNodeCopiedEvent($source, $target);
205
+        $this->dispatcher->dispatchTyped($event);
206
+    }
207
+
208
+    public function postCopy($arguments) {
209
+        $source = $this->getNodeForPath($arguments['oldpath']);
210
+        $target = $this->getNodeForPath($arguments['newpath']);
211
+        $this->root->emit('\OC\Files', 'postCopy', [$source, $target]);
212
+        $this->legacyDispatcher->dispatch('\OCP\Files::postCopy', new GenericEvent([$source, $target]));
213
+
214
+        $event = new NodeCopiedEvent($source, $target);
215
+        $this->dispatcher->dispatchTyped($event);
216
+    }
217
+
218
+    public function read($arguments) {
219
+        $node = $this->getNodeForPath($arguments['path']);
220
+        $this->root->emit('\OC\Files', 'read', [$node]);
221
+        $this->legacyDispatcher->dispatch('\OCP\Files::read', new GenericEvent([$node]));
222
+
223
+        $event = new BeforeNodeReadEvent($node);
224
+        $this->dispatcher->dispatchTyped($event);
225
+    }
226
+
227
+    private function getNodeForPath($path) {
228
+        $info = Filesystem::getView()->getFileInfo($path);
229
+        if (!$info) {
230
+            $fullPath = Filesystem::getView()->getAbsolutePath($path);
231
+            if (isset($this->deleteMetaCache[$fullPath])) {
232
+                $info = $this->deleteMetaCache[$fullPath];
233
+            } else {
234
+                $info = null;
235
+            }
236
+            if (Filesystem::is_dir($path)) {
237
+                return new NonExistingFolder($this->root, $this->view, $fullPath, $info);
238
+            } else {
239
+                return new NonExistingFile($this->root, $this->view, $fullPath, $info);
240
+            }
241
+        }
242
+        if ($info->getType() === FileInfo::TYPE_FILE) {
243
+            return new File($this->root, $this->view, $info->getPath(), $info);
244
+        } else {
245
+            return new Folder($this->root, $this->view, $info->getPath(), $info);
246
+        }
247
+    }
248 248
 }
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/PropfindCompressionPlugin.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -31,44 +31,44 @@
 block discarded – undo
31 31
 
32 32
 class PropfindCompressionPlugin extends ServerPlugin {
33 33
 
34
-	/**
35
-	 * Reference to main server object
36
-	 *
37
-	 * @var Server
38
-	 */
39
-	private $server;
34
+    /**
35
+     * Reference to main server object
36
+     *
37
+     * @var Server
38
+     */
39
+    private $server;
40 40
 
41
-	/**
42
-	 * This initializes the plugin.
43
-	 *
44
-	 * This function is called by \Sabre\DAV\Server, after
45
-	 * addPlugin is called.
46
-	 *
47
-	 * This method should set up the required event subscriptions.
48
-	 *
49
-	 * @param \Sabre\DAV\Server $server
50
-	 * @return void
51
-	 */
52
-	public function initialize(\Sabre\DAV\Server $server) {
53
-		$this->server = $server;
54
-		$this->server->on('afterMethod:PROPFIND', [$this, 'compressResponse'], 100);
55
-	}
41
+    /**
42
+     * This initializes the plugin.
43
+     *
44
+     * This function is called by \Sabre\DAV\Server, after
45
+     * addPlugin is called.
46
+     *
47
+     * This method should set up the required event subscriptions.
48
+     *
49
+     * @param \Sabre\DAV\Server $server
50
+     * @return void
51
+     */
52
+    public function initialize(\Sabre\DAV\Server $server) {
53
+        $this->server = $server;
54
+        $this->server->on('afterMethod:PROPFIND', [$this, 'compressResponse'], 100);
55
+    }
56 56
 
57
-	public function compressResponse(Request $request, Response $response) {
58
-		$header = $request->getHeader('Accept-Encoding');
57
+    public function compressResponse(Request $request, Response $response) {
58
+        $header = $request->getHeader('Accept-Encoding');
59 59
 
60
-		if ($header === null) {
61
-			return $response;
62
-		}
60
+        if ($header === null) {
61
+            return $response;
62
+        }
63 63
 
64
-		if (strpos($header, 'gzip') !== false) {
65
-			$body = $response->getBody();
66
-			if (is_string($body)) {
67
-				$response->setHeader('Content-Encoding', 'gzip');
68
-				$response->setBody(gzencode($body));
69
-			}
70
-		}
64
+        if (strpos($header, 'gzip') !== false) {
65
+            $body = $response->getBody();
66
+            if (is_string($body)) {
67
+                $response->setHeader('Content-Encoding', 'gzip');
68
+                $response->setBody(gzencode($body));
69
+            }
70
+        }
71 71
 
72
-		return $response;
73
-	}
72
+        return $response;
73
+    }
74 74
 }
Please login to merge, or discard this patch.
apps/comments/lib/Listener/CommentsEntityEventListener.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -30,15 +30,15 @@
 block discarded – undo
30 30
 use OCP\EventDispatcher\IEventListener;
31 31
 
32 32
 class CommentsEntityEventListener implements IEventListener {
33
-	public function handle(Event $event): void {
34
-		if (!($event instanceof CommentsEntityEvent)) {
35
-			// Unrelated
36
-			return;
37
-		}
33
+    public function handle(Event $event): void {
34
+        if (!($event instanceof CommentsEntityEvent)) {
35
+            // Unrelated
36
+            return;
37
+        }
38 38
 
39
-		$event->addEntityCollection('files', function ($name) {
40
-			$nodes = \OC::$server->getUserFolder()->getById((int)$name);
41
-			return !empty($nodes);
42
-		});
43
-	}
39
+        $event->addEntityCollection('files', function ($name) {
40
+            $nodes = \OC::$server->getUserFolder()->getById((int)$name);
41
+            return !empty($nodes);
42
+        });
43
+    }
44 44
 }
Please login to merge, or discard this patch.
apps/settings/lib/Controller/WebAuthnController.php 1 patch
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -38,81 +38,81 @@
 block discarded – undo
38 38
 use Webauthn\PublicKeyCredentialCreationOptions;
39 39
 
40 40
 class WebAuthnController extends Controller {
41
-	private const WEBAUTHN_REGISTRATION = 'webauthn_registration';
42
-
43
-	/** @var Manager */
44
-	private $manager;
45
-
46
-	/** @var IUserSession */
47
-	private $userSession;
48
-	/**
49
-	 * @var ISession
50
-	 */
51
-	private $session;
52
-	/**
53
-	 * @var ILogger
54
-	 */
55
-	private $logger;
56
-
57
-	public function __construct(IRequest $request, ILogger $logger, Manager $webAuthnManager, IUserSession $userSession, ISession $session) {
58
-		parent::__construct(Application::APP_ID, $request);
59
-
60
-		$this->manager = $webAuthnManager;
61
-		$this->userSession = $userSession;
62
-		$this->session = $session;
63
-		$this->logger = $logger;
64
-	}
65
-
66
-	/**
67
-	 * @NoAdminRequired
68
-	 * @NoSubAdminRequired
69
-	 * @PasswordConfirmationRequired
70
-	 * @UseSession
71
-	 * @NoCSRFRequired
72
-	 */
73
-	public function startRegistration(): JSONResponse {
74
-		$this->logger->debug('Starting WebAuthn registration');
75
-
76
-		$credentialOptions = $this->manager->startRegistration($this->userSession->getUser(), $this->request->getServerHost());
77
-
78
-		// Set this in the session since we need it on finish
79
-		$this->session->set(self::WEBAUTHN_REGISTRATION, $credentialOptions);
80
-
81
-		return new JSONResponse($credentialOptions);
82
-	}
83
-
84
-	/**
85
-	 * @NoAdminRequired
86
-	 * @NoSubAdminRequired
87
-	 * @PasswordConfirmationRequired
88
-	 * @UseSession
89
-	 */
90
-	public function finishRegistration(string $name, string $data): JSONResponse {
91
-		$this->logger->debug('Finishing WebAuthn registration');
92
-
93
-		if (!$this->session->exists(self::WEBAUTHN_REGISTRATION)) {
94
-			$this->logger->debug('Trying to finish WebAuthn registration without session data');
95
-			return new JSONResponse([], Http::STATUS_BAD_REQUEST);
96
-		}
97
-
98
-		// Obtain the publicKeyCredentialOptions from when we started the registration
99
-		$publicKeyCredentialCreationOptions = PublicKeyCredentialCreationOptions::createFromArray($this->session->get(self::WEBAUTHN_REGISTRATION));
100
-
101
-		$this->session->remove(self::WEBAUTHN_REGISTRATION);
102
-
103
-		return new JSONResponse($this->manager->finishRegister($publicKeyCredentialCreationOptions, $name, $data));
104
-	}
105
-
106
-	/**
107
-	 * @NoAdminRequired
108
-	 * @NoSubAdminRequired
109
-	 * @PasswordConfirmationRequired
110
-	 */
111
-	public function deleteRegistration(int $id): JSONResponse {
112
-		$this->logger->debug('Finishing WebAuthn registration');
113
-
114
-		$this->manager->deleteRegistration($this->userSession->getUser(), $id);
115
-
116
-		return new JSONResponse([]);
117
-	}
41
+    private const WEBAUTHN_REGISTRATION = 'webauthn_registration';
42
+
43
+    /** @var Manager */
44
+    private $manager;
45
+
46
+    /** @var IUserSession */
47
+    private $userSession;
48
+    /**
49
+     * @var ISession
50
+     */
51
+    private $session;
52
+    /**
53
+     * @var ILogger
54
+     */
55
+    private $logger;
56
+
57
+    public function __construct(IRequest $request, ILogger $logger, Manager $webAuthnManager, IUserSession $userSession, ISession $session) {
58
+        parent::__construct(Application::APP_ID, $request);
59
+
60
+        $this->manager = $webAuthnManager;
61
+        $this->userSession = $userSession;
62
+        $this->session = $session;
63
+        $this->logger = $logger;
64
+    }
65
+
66
+    /**
67
+     * @NoAdminRequired
68
+     * @NoSubAdminRequired
69
+     * @PasswordConfirmationRequired
70
+     * @UseSession
71
+     * @NoCSRFRequired
72
+     */
73
+    public function startRegistration(): JSONResponse {
74
+        $this->logger->debug('Starting WebAuthn registration');
75
+
76
+        $credentialOptions = $this->manager->startRegistration($this->userSession->getUser(), $this->request->getServerHost());
77
+
78
+        // Set this in the session since we need it on finish
79
+        $this->session->set(self::WEBAUTHN_REGISTRATION, $credentialOptions);
80
+
81
+        return new JSONResponse($credentialOptions);
82
+    }
83
+
84
+    /**
85
+     * @NoAdminRequired
86
+     * @NoSubAdminRequired
87
+     * @PasswordConfirmationRequired
88
+     * @UseSession
89
+     */
90
+    public function finishRegistration(string $name, string $data): JSONResponse {
91
+        $this->logger->debug('Finishing WebAuthn registration');
92
+
93
+        if (!$this->session->exists(self::WEBAUTHN_REGISTRATION)) {
94
+            $this->logger->debug('Trying to finish WebAuthn registration without session data');
95
+            return new JSONResponse([], Http::STATUS_BAD_REQUEST);
96
+        }
97
+
98
+        // Obtain the publicKeyCredentialOptions from when we started the registration
99
+        $publicKeyCredentialCreationOptions = PublicKeyCredentialCreationOptions::createFromArray($this->session->get(self::WEBAUTHN_REGISTRATION));
100
+
101
+        $this->session->remove(self::WEBAUTHN_REGISTRATION);
102
+
103
+        return new JSONResponse($this->manager->finishRegister($publicKeyCredentialCreationOptions, $name, $data));
104
+    }
105
+
106
+    /**
107
+     * @NoAdminRequired
108
+     * @NoSubAdminRequired
109
+     * @PasswordConfirmationRequired
110
+     */
111
+    public function deleteRegistration(int $id): JSONResponse {
112
+        $this->logger->debug('Finishing WebAuthn registration');
113
+
114
+        $this->manager->deleteRegistration($this->userSession->getUser(), $id);
115
+
116
+        return new JSONResponse([]);
117
+    }
118 118
 }
Please login to merge, or discard this patch.
apps/comments/lib/Search/Result.php 1 patch
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -32,101 +32,101 @@
 block discarded – undo
32 32
  * @deprecated 20.0.0
33 33
  */
34 34
 class Result extends BaseResult {
35
-	/**
36
-	 * @deprecated 20.0.0
37
-	 */
38
-	public $type = 'comment';
39
-	/**
40
-	 * @deprecated 20.0.0
41
-	 */
42
-	public $comment;
43
-	/**
44
-	 * @deprecated 20.0.0
45
-	 */
46
-	public $authorId;
47
-	/**
48
-	 * @deprecated 20.0.0
49
-	 */
50
-	public $authorName;
51
-	/**
52
-	 * @deprecated 20.0.0
53
-	 */
54
-	public $path;
55
-	/**
56
-	 * @deprecated 20.0.0
57
-	 */
58
-	public $fileName;
35
+    /**
36
+     * @deprecated 20.0.0
37
+     */
38
+    public $type = 'comment';
39
+    /**
40
+     * @deprecated 20.0.0
41
+     */
42
+    public $comment;
43
+    /**
44
+     * @deprecated 20.0.0
45
+     */
46
+    public $authorId;
47
+    /**
48
+     * @deprecated 20.0.0
49
+     */
50
+    public $authorName;
51
+    /**
52
+     * @deprecated 20.0.0
53
+     */
54
+    public $path;
55
+    /**
56
+     * @deprecated 20.0.0
57
+     */
58
+    public $fileName;
59 59
 
60
-	/**
61
-	 * @param string $search
62
-	 * @param IComment $comment
63
-	 * @param string $authorName
64
-	 * @param string $path
65
-	 * @throws NotFoundException
66
-	 * @deprecated 20.0.0
67
-	 */
68
-	public function __construct(string $search,
69
-								IComment $comment,
70
-								string $authorName,
71
-								string $path) {
72
-		parent::__construct(
73
-			(int) $comment->getId(),
74
-			$comment->getMessage()
75
-		/* @todo , [link to file] */
76
-		);
60
+    /**
61
+     * @param string $search
62
+     * @param IComment $comment
63
+     * @param string $authorName
64
+     * @param string $path
65
+     * @throws NotFoundException
66
+     * @deprecated 20.0.0
67
+     */
68
+    public function __construct(string $search,
69
+                                IComment $comment,
70
+                                string $authorName,
71
+                                string $path) {
72
+        parent::__construct(
73
+            (int) $comment->getId(),
74
+            $comment->getMessage()
75
+        /* @todo , [link to file] */
76
+        );
77 77
 
78
-		$this->comment = $this->getRelevantMessagePart($comment->getMessage(), $search);
79
-		$this->authorId = $comment->getActorId();
80
-		$this->authorName = $authorName;
81
-		$this->fileName = basename($path);
82
-		$this->path = $this->getVisiblePath($path);
83
-	}
78
+        $this->comment = $this->getRelevantMessagePart($comment->getMessage(), $search);
79
+        $this->authorId = $comment->getActorId();
80
+        $this->authorName = $authorName;
81
+        $this->fileName = basename($path);
82
+        $this->path = $this->getVisiblePath($path);
83
+    }
84 84
 
85
-	/**
86
-	 * @param string $path
87
-	 * @return string
88
-	 * @throws NotFoundException
89
-	 */
90
-	protected function getVisiblePath(string $path): string {
91
-		$segments = explode('/', trim($path, '/'), 3);
85
+    /**
86
+     * @param string $path
87
+     * @return string
88
+     * @throws NotFoundException
89
+     */
90
+    protected function getVisiblePath(string $path): string {
91
+        $segments = explode('/', trim($path, '/'), 3);
92 92
 
93
-		if (!isset($segments[2])) {
94
-			throw new NotFoundException('Path not inside visible section');
95
-		}
93
+        if (!isset($segments[2])) {
94
+            throw new NotFoundException('Path not inside visible section');
95
+        }
96 96
 
97
-		return $segments[2];
98
-	}
97
+        return $segments[2];
98
+    }
99 99
 
100
-	/**
101
-	 * @param string $message
102
-	 * @param string $search
103
-	 * @return string
104
-	 * @throws NotFoundException
105
-	 */
106
-	protected function getRelevantMessagePart(string $message, string $search): string {
107
-		$start = mb_stripos($message, $search);
108
-		if ($start === false) {
109
-			throw new NotFoundException('Comment section not found');
110
-		}
100
+    /**
101
+     * @param string $message
102
+     * @param string $search
103
+     * @return string
104
+     * @throws NotFoundException
105
+     */
106
+    protected function getRelevantMessagePart(string $message, string $search): string {
107
+        $start = mb_stripos($message, $search);
108
+        if ($start === false) {
109
+            throw new NotFoundException('Comment section not found');
110
+        }
111 111
 
112
-		$end = $start + mb_strlen($search);
112
+        $end = $start + mb_strlen($search);
113 113
 
114
-		if ($start <= 25) {
115
-			$start = 0;
116
-			$prefix = '';
117
-		} else {
118
-			$start -= 25;
119
-			$prefix = '…';
120
-		}
114
+        if ($start <= 25) {
115
+            $start = 0;
116
+            $prefix = '';
117
+        } else {
118
+            $start -= 25;
119
+            $prefix = '…';
120
+        }
121 121
 
122
-		if ((mb_strlen($message) - $end) <= 25) {
123
-			$end = mb_strlen($message);
124
-			$suffix = '';
125
-		} else {
126
-			$end += 25;
127
-			$suffix = '…';
128
-		}
122
+        if ((mb_strlen($message) - $end) <= 25) {
123
+            $end = mb_strlen($message);
124
+            $suffix = '';
125
+        } else {
126
+            $end += 25;
127
+            $suffix = '…';
128
+        }
129 129
 
130
-		return $prefix . mb_substr($message, $start, $end - $start) . $suffix;
131
-	}
130
+        return $prefix . mb_substr($message, $start, $end - $start) . $suffix;
131
+    }
132 132
 }
Please login to merge, or discard this patch.