Completed
Push — master ( 08b58a...0efd05 )
by Daniel
30:08 queued 21s
created
AppFramework/Middleware/Security/Exceptions/NotLoggedInException.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
  * @package OC\AppFramework\Middleware\Security\Exceptions
35 35
  */
36 36
 class NotLoggedInException extends SecurityException {
37
-	public function __construct() {
38
-		parent::__construct('Current user is not logged in', Http::STATUS_UNAUTHORIZED);
39
-	}
37
+    public function __construct() {
38
+        parent::__construct('Current user is not logged in', Http::STATUS_UNAUTHORIZED);
39
+    }
40 40
 }
Please login to merge, or discard this patch.
lib/private/DB/AdapterOCI8.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 		}
34 34
 		if ($table !== null) {
35 35
 			$suffix = '_SEQ';
36
-			$table = '"' . $table . $suffix . '"';
36
+			$table = '"'.$table.$suffix.'"';
37 37
 		}
38 38
 		return $this->conn->realLastInsertId($table);
39 39
 	}
Please login to merge, or discard this patch.
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -26,24 +26,24 @@
 block discarded – undo
26 26
 namespace OC\DB;
27 27
 
28 28
 class AdapterOCI8 extends Adapter {
29
-	public function lastInsertId($table) {
30
-		if (is_null($table)) {
31
-			throw new \InvalidArgumentException('Oracle requires a table name to be passed into lastInsertId()');
32
-		}
33
-		if ($table !== null) {
34
-			$suffix = '_SEQ';
35
-			$table = '"' . $table . $suffix . '"';
36
-		}
37
-		return $this->conn->realLastInsertId($table);
38
-	}
29
+    public function lastInsertId($table) {
30
+        if (is_null($table)) {
31
+            throw new \InvalidArgumentException('Oracle requires a table name to be passed into lastInsertId()');
32
+        }
33
+        if ($table !== null) {
34
+            $suffix = '_SEQ';
35
+            $table = '"' . $table . $suffix . '"';
36
+        }
37
+        return $this->conn->realLastInsertId($table);
38
+    }
39 39
 
40
-	public const UNIX_TIMESTAMP_REPLACEMENT = "(cast(sys_extract_utc(systimestamp) as date) - date'1970-01-01') * 86400";
40
+    public const UNIX_TIMESTAMP_REPLACEMENT = "(cast(sys_extract_utc(systimestamp) as date) - date'1970-01-01') * 86400";
41 41
 
42
-	public function fixupStatement($statement) {
43
-		$statement = preg_replace('/`(\w+)` ILIKE \?/', 'REGEXP_LIKE(`$1`, \'^\' || REPLACE(?, \'%\', \'.*\') || \'$\', \'i\')', $statement);
44
-		$statement = str_replace('`', '"', $statement);
45
-		$statement = str_ireplace('NOW()', 'CURRENT_TIMESTAMP', $statement);
46
-		$statement = str_ireplace('UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement);
47
-		return $statement;
48
-	}
42
+    public function fixupStatement($statement) {
43
+        $statement = preg_replace('/`(\w+)` ILIKE \?/', 'REGEXP_LIKE(`$1`, \'^\' || REPLACE(?, \'%\', \'.*\') || \'$\', \'i\')', $statement);
44
+        $statement = str_replace('`', '"', $statement);
45
+        $statement = str_ireplace('NOW()', 'CURRENT_TIMESTAMP', $statement);
46
+        $statement = str_ireplace('UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement);
47
+        return $statement;
48
+    }
49 49
 }
Please login to merge, or discard this patch.
lib/private/Preview/Provider.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -28,41 +28,41 @@
 block discarded – undo
28 28
 use OCP\Preview\IProvider;
29 29
 
30 30
 abstract class Provider implements IProvider {
31
-	private $options;
31
+    private $options;
32 32
 
33
-	/**
34
-	 * Constructor
35
-	 *
36
-	 * @param array $options
37
-	 */
38
-	public function __construct(array $options = []) {
39
-		$this->options = $options;
40
-	}
33
+    /**
34
+     * Constructor
35
+     *
36
+     * @param array $options
37
+     */
38
+    public function __construct(array $options = []) {
39
+        $this->options = $options;
40
+    }
41 41
 
42
-	/**
43
-	 * @return string Regex with the mimetypes that are supported by this provider
44
-	 */
45
-	abstract public function getMimeType();
42
+    /**
43
+     * @return string Regex with the mimetypes that are supported by this provider
44
+     */
45
+    abstract public function getMimeType();
46 46
 
47
-	/**
48
-	 * Check if a preview can be generated for $path
49
-	 *
50
-	 * @param \OCP\Files\FileInfo $file
51
-	 * @return bool
52
-	 */
53
-	public function isAvailable(\OCP\Files\FileInfo $file) {
54
-		return true;
55
-	}
47
+    /**
48
+     * Check if a preview can be generated for $path
49
+     *
50
+     * @param \OCP\Files\FileInfo $file
51
+     * @return bool
52
+     */
53
+    public function isAvailable(\OCP\Files\FileInfo $file) {
54
+        return true;
55
+    }
56 56
 
57
-	/**
58
-	 * Generates thumbnail which fits in $maxX and $maxY and keeps the aspect ratio, for file at path $path
59
-	 *
60
-	 * @param string $path Path of file
61
-	 * @param int $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image
62
-	 * @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image
63
-	 * @param bool $scalingup Disable/Enable upscaling of previews
64
-	 * @param \OC\Files\View $fileview fileview object of user folder
65
-	 * @return bool|\OCP\IImage false if no preview was generated
66
-	 */
67
-	abstract public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview);
57
+    /**
58
+     * Generates thumbnail which fits in $maxX and $maxY and keeps the aspect ratio, for file at path $path
59
+     *
60
+     * @param string $path Path of file
61
+     * @param int $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image
62
+     * @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image
63
+     * @param bool $scalingup Disable/Enable upscaling of previews
64
+     * @param \OC\Files\View $fileview fileview object of user folder
65
+     * @return bool|\OCP\IImage false if no preview was generated
66
+     */
67
+    abstract public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview);
68 68
 }
Please login to merge, or discard this patch.
lib/private/Encryption/Exceptions/ModuleAlreadyExistsException.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
 	 * @param string $name
33 33
 	 */
34 34
 	public function __construct($id, $name) {
35
-		parent::__construct('Id "' . $id . '" already used by encryption module "' . $name . '"');
35
+		parent::__construct('Id "'.$id.'" already used by encryption module "'.$name.'"');
36 36
 	}
37 37
 
38 38
 }
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -25,11 +25,11 @@
 block discarded – undo
25 25
 use OCP\Encryption\Exceptions\GenericEncryptionException;
26 26
 
27 27
 class ModuleAlreadyExistsException extends GenericEncryptionException {
28
-	/**
29
-	 * @param string $id
30
-	 * @param string $name
31
-	 */
32
-	public function __construct($id, $name) {
33
-		parent::__construct('Id "' . $id . '" already used by encryption module "' . $name . '"');
34
-	}
28
+    /**
29
+     * @param string $id
30
+     * @param string $name
31
+     */
32
+    public function __construct($id, $name) {
33
+        parent::__construct('Id "' . $id . '" already used by encryption module "' . $name . '"');
34
+    }
35 35
 }
Please login to merge, or discard this patch.
lib/private/Encryption/Manager.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -274,7 +274,7 @@
 block discarded – undo
274 274
 		}
275 275
 
276 276
 		// check if key storage is mounted correctly
277
-		if ($this->rootView->file_exists($rootDir . '/' . Storage::KEY_STORAGE_MARKER)) {
277
+		if ($this->rootView->file_exists($rootDir.'/'.Storage::KEY_STORAGE_MARKER)) {
278 278
 			return true;
279 279
 		}
280 280
 
Please login to merge, or discard this patch.
Indentation   +206 added lines, -206 removed lines patch added patch discarded remove patch
@@ -21,210 +21,210 @@
 block discarded – undo
21 21
 use Psr\Log\LoggerInterface;
22 22
 
23 23
 class Manager implements IManager {
24
-	protected array $encryptionModules;
25
-
26
-	public function __construct(
27
-		protected IConfig $config,
28
-		protected LoggerInterface $logger,
29
-		protected IL10N $l,
30
-		protected View $rootView,
31
-		protected Util $util,
32
-		protected ArrayCache $arrayCache,
33
-	) {
34
-		$this->encryptionModules = [];
35
-	}
36
-
37
-	/**
38
-	 * Check if encryption is enabled
39
-	 *
40
-	 * @return bool true if enabled, false if not
41
-	 */
42
-	public function isEnabled() {
43
-		$installed = $this->config->getSystemValueBool('installed', false);
44
-		if (!$installed) {
45
-			return false;
46
-		}
47
-
48
-		$enabled = $this->config->getAppValue('core', 'encryption_enabled', 'no');
49
-		return $enabled === 'yes';
50
-	}
51
-
52
-	/**
53
-	 * check if new encryption is ready
54
-	 *
55
-	 * @return bool
56
-	 * @throws ServiceUnavailableException
57
-	 */
58
-	public function isReady() {
59
-		if ($this->isKeyStorageReady() === false) {
60
-			throw new ServiceUnavailableException('Key Storage is not ready');
61
-		}
62
-
63
-		return true;
64
-	}
65
-
66
-	/**
67
-	 * @param string $user
68
-	 */
69
-	public function isReadyForUser($user) {
70
-		if (!$this->isReady()) {
71
-			return false;
72
-		}
73
-
74
-		foreach ($this->getEncryptionModules() as $module) {
75
-			/** @var IEncryptionModule $m */
76
-			$m = call_user_func($module['callback']);
77
-			if (!$m->isReadyForUser($user)) {
78
-				return false;
79
-			}
80
-		}
81
-
82
-		return true;
83
-	}
84
-
85
-	/**
86
-	 * Registers an callback function which must return an encryption module instance
87
-	 *
88
-	 * @param string $id
89
-	 * @param string $displayName
90
-	 * @param callable $callback
91
-	 * @throws Exceptions\ModuleAlreadyExistsException
92
-	 */
93
-	public function registerEncryptionModule($id, $displayName, callable $callback) {
94
-		if (isset($this->encryptionModules[$id])) {
95
-			throw new Exceptions\ModuleAlreadyExistsException($id, $displayName);
96
-		}
97
-
98
-		$this->encryptionModules[$id] = [
99
-			'id' => $id,
100
-			'displayName' => $displayName,
101
-			'callback' => $callback,
102
-		];
103
-
104
-		$defaultEncryptionModuleId = $this->getDefaultEncryptionModuleId();
105
-
106
-		if (empty($defaultEncryptionModuleId)) {
107
-			$this->setDefaultEncryptionModule($id);
108
-		}
109
-	}
110
-
111
-	/**
112
-	 * Unregisters an encryption module
113
-	 *
114
-	 * @param string $moduleId
115
-	 */
116
-	public function unregisterEncryptionModule($moduleId) {
117
-		unset($this->encryptionModules[$moduleId]);
118
-	}
119
-
120
-	/**
121
-	 * get a list of all encryption modules
122
-	 *
123
-	 * @return array [id => ['id' => $id, 'displayName' => $displayName, 'callback' => callback]]
124
-	 */
125
-	public function getEncryptionModules() {
126
-		return $this->encryptionModules;
127
-	}
128
-
129
-	/**
130
-	 * get a specific encryption module
131
-	 *
132
-	 * @param string $moduleId
133
-	 * @return IEncryptionModule
134
-	 * @throws Exceptions\ModuleDoesNotExistsException
135
-	 */
136
-	public function getEncryptionModule($moduleId = '') {
137
-		if (empty($moduleId)) {
138
-			return $this->getDefaultEncryptionModule();
139
-		}
140
-		if (isset($this->encryptionModules[$moduleId])) {
141
-			return call_user_func($this->encryptionModules[$moduleId]['callback']);
142
-		}
143
-		$message = "Module with ID: $moduleId does not exist.";
144
-		$hint = $this->l->t('Module with ID: %s does not exist. Please enable it in your apps settings or contact your administrator.', [$moduleId]);
145
-		throw new Exceptions\ModuleDoesNotExistsException($message, $hint);
146
-	}
147
-
148
-	/**
149
-	 * get default encryption module
150
-	 *
151
-	 * @return \OCP\Encryption\IEncryptionModule
152
-	 * @throws Exceptions\ModuleDoesNotExistsException
153
-	 */
154
-	protected function getDefaultEncryptionModule() {
155
-		$defaultModuleId = $this->getDefaultEncryptionModuleId();
156
-		if (empty($defaultModuleId)) {
157
-			$message = 'No default encryption module defined';
158
-			throw new Exceptions\ModuleDoesNotExistsException($message);
159
-		}
160
-		if (isset($this->encryptionModules[$defaultModuleId])) {
161
-			return call_user_func($this->encryptionModules[$defaultModuleId]['callback']);
162
-		}
163
-		$message = 'Default encryption module not loaded';
164
-		throw new Exceptions\ModuleDoesNotExistsException($message);
165
-	}
166
-
167
-	/**
168
-	 * set default encryption module Id
169
-	 *
170
-	 * @param string $moduleId
171
-	 * @return bool
172
-	 */
173
-	public function setDefaultEncryptionModule($moduleId) {
174
-		try {
175
-			$this->getEncryptionModule($moduleId);
176
-		} catch (\Exception $e) {
177
-			return false;
178
-		}
179
-
180
-		$this->config->setAppValue('core', 'default_encryption_module', $moduleId);
181
-		return true;
182
-	}
183
-
184
-	/**
185
-	 * get default encryption module Id
186
-	 *
187
-	 * @return string
188
-	 */
189
-	public function getDefaultEncryptionModuleId() {
190
-		return $this->config->getAppValue('core', 'default_encryption_module');
191
-	}
192
-
193
-	/**
194
-	 * Add storage wrapper
195
-	 */
196
-	public function setupStorage() {
197
-		// If encryption is disabled and there are no loaded modules it makes no sense to load the wrapper
198
-		if (!empty($this->encryptionModules) || $this->isEnabled()) {
199
-			$encryptionWrapper = new EncryptionWrapper($this->arrayCache, $this, $this->logger);
200
-			Filesystem::addStorageWrapper('oc_encryption', [$encryptionWrapper, 'wrapStorage'], 2);
201
-		}
202
-	}
203
-
204
-	public function forceWrapStorage(IMountPoint $mountPoint, IStorage $storage) {
205
-		$encryptionWrapper = new EncryptionWrapper($this->arrayCache, $this, $this->logger);
206
-		return $encryptionWrapper->wrapStorage($mountPoint->getMountPoint(), $storage, $mountPoint, true);
207
-	}
208
-
209
-
210
-	/**
211
-	 * check if key storage is ready
212
-	 *
213
-	 * @return bool
214
-	 */
215
-	protected function isKeyStorageReady() {
216
-		$rootDir = $this->util->getKeyStorageRoot();
217
-
218
-		// the default root is always valid
219
-		if ($rootDir === '') {
220
-			return true;
221
-		}
222
-
223
-		// check if key storage is mounted correctly
224
-		if ($this->rootView->file_exists($rootDir . '/' . Storage::KEY_STORAGE_MARKER)) {
225
-			return true;
226
-		}
227
-
228
-		return false;
229
-	}
24
+    protected array $encryptionModules;
25
+
26
+    public function __construct(
27
+        protected IConfig $config,
28
+        protected LoggerInterface $logger,
29
+        protected IL10N $l,
30
+        protected View $rootView,
31
+        protected Util $util,
32
+        protected ArrayCache $arrayCache,
33
+    ) {
34
+        $this->encryptionModules = [];
35
+    }
36
+
37
+    /**
38
+     * Check if encryption is enabled
39
+     *
40
+     * @return bool true if enabled, false if not
41
+     */
42
+    public function isEnabled() {
43
+        $installed = $this->config->getSystemValueBool('installed', false);
44
+        if (!$installed) {
45
+            return false;
46
+        }
47
+
48
+        $enabled = $this->config->getAppValue('core', 'encryption_enabled', 'no');
49
+        return $enabled === 'yes';
50
+    }
51
+
52
+    /**
53
+     * check if new encryption is ready
54
+     *
55
+     * @return bool
56
+     * @throws ServiceUnavailableException
57
+     */
58
+    public function isReady() {
59
+        if ($this->isKeyStorageReady() === false) {
60
+            throw new ServiceUnavailableException('Key Storage is not ready');
61
+        }
62
+
63
+        return true;
64
+    }
65
+
66
+    /**
67
+     * @param string $user
68
+     */
69
+    public function isReadyForUser($user) {
70
+        if (!$this->isReady()) {
71
+            return false;
72
+        }
73
+
74
+        foreach ($this->getEncryptionModules() as $module) {
75
+            /** @var IEncryptionModule $m */
76
+            $m = call_user_func($module['callback']);
77
+            if (!$m->isReadyForUser($user)) {
78
+                return false;
79
+            }
80
+        }
81
+
82
+        return true;
83
+    }
84
+
85
+    /**
86
+     * Registers an callback function which must return an encryption module instance
87
+     *
88
+     * @param string $id
89
+     * @param string $displayName
90
+     * @param callable $callback
91
+     * @throws Exceptions\ModuleAlreadyExistsException
92
+     */
93
+    public function registerEncryptionModule($id, $displayName, callable $callback) {
94
+        if (isset($this->encryptionModules[$id])) {
95
+            throw new Exceptions\ModuleAlreadyExistsException($id, $displayName);
96
+        }
97
+
98
+        $this->encryptionModules[$id] = [
99
+            'id' => $id,
100
+            'displayName' => $displayName,
101
+            'callback' => $callback,
102
+        ];
103
+
104
+        $defaultEncryptionModuleId = $this->getDefaultEncryptionModuleId();
105
+
106
+        if (empty($defaultEncryptionModuleId)) {
107
+            $this->setDefaultEncryptionModule($id);
108
+        }
109
+    }
110
+
111
+    /**
112
+     * Unregisters an encryption module
113
+     *
114
+     * @param string $moduleId
115
+     */
116
+    public function unregisterEncryptionModule($moduleId) {
117
+        unset($this->encryptionModules[$moduleId]);
118
+    }
119
+
120
+    /**
121
+     * get a list of all encryption modules
122
+     *
123
+     * @return array [id => ['id' => $id, 'displayName' => $displayName, 'callback' => callback]]
124
+     */
125
+    public function getEncryptionModules() {
126
+        return $this->encryptionModules;
127
+    }
128
+
129
+    /**
130
+     * get a specific encryption module
131
+     *
132
+     * @param string $moduleId
133
+     * @return IEncryptionModule
134
+     * @throws Exceptions\ModuleDoesNotExistsException
135
+     */
136
+    public function getEncryptionModule($moduleId = '') {
137
+        if (empty($moduleId)) {
138
+            return $this->getDefaultEncryptionModule();
139
+        }
140
+        if (isset($this->encryptionModules[$moduleId])) {
141
+            return call_user_func($this->encryptionModules[$moduleId]['callback']);
142
+        }
143
+        $message = "Module with ID: $moduleId does not exist.";
144
+        $hint = $this->l->t('Module with ID: %s does not exist. Please enable it in your apps settings or contact your administrator.', [$moduleId]);
145
+        throw new Exceptions\ModuleDoesNotExistsException($message, $hint);
146
+    }
147
+
148
+    /**
149
+     * get default encryption module
150
+     *
151
+     * @return \OCP\Encryption\IEncryptionModule
152
+     * @throws Exceptions\ModuleDoesNotExistsException
153
+     */
154
+    protected function getDefaultEncryptionModule() {
155
+        $defaultModuleId = $this->getDefaultEncryptionModuleId();
156
+        if (empty($defaultModuleId)) {
157
+            $message = 'No default encryption module defined';
158
+            throw new Exceptions\ModuleDoesNotExistsException($message);
159
+        }
160
+        if (isset($this->encryptionModules[$defaultModuleId])) {
161
+            return call_user_func($this->encryptionModules[$defaultModuleId]['callback']);
162
+        }
163
+        $message = 'Default encryption module not loaded';
164
+        throw new Exceptions\ModuleDoesNotExistsException($message);
165
+    }
166
+
167
+    /**
168
+     * set default encryption module Id
169
+     *
170
+     * @param string $moduleId
171
+     * @return bool
172
+     */
173
+    public function setDefaultEncryptionModule($moduleId) {
174
+        try {
175
+            $this->getEncryptionModule($moduleId);
176
+        } catch (\Exception $e) {
177
+            return false;
178
+        }
179
+
180
+        $this->config->setAppValue('core', 'default_encryption_module', $moduleId);
181
+        return true;
182
+    }
183
+
184
+    /**
185
+     * get default encryption module Id
186
+     *
187
+     * @return string
188
+     */
189
+    public function getDefaultEncryptionModuleId() {
190
+        return $this->config->getAppValue('core', 'default_encryption_module');
191
+    }
192
+
193
+    /**
194
+     * Add storage wrapper
195
+     */
196
+    public function setupStorage() {
197
+        // If encryption is disabled and there are no loaded modules it makes no sense to load the wrapper
198
+        if (!empty($this->encryptionModules) || $this->isEnabled()) {
199
+            $encryptionWrapper = new EncryptionWrapper($this->arrayCache, $this, $this->logger);
200
+            Filesystem::addStorageWrapper('oc_encryption', [$encryptionWrapper, 'wrapStorage'], 2);
201
+        }
202
+    }
203
+
204
+    public function forceWrapStorage(IMountPoint $mountPoint, IStorage $storage) {
205
+        $encryptionWrapper = new EncryptionWrapper($this->arrayCache, $this, $this->logger);
206
+        return $encryptionWrapper->wrapStorage($mountPoint->getMountPoint(), $storage, $mountPoint, true);
207
+    }
208
+
209
+
210
+    /**
211
+     * check if key storage is ready
212
+     *
213
+     * @return bool
214
+     */
215
+    protected function isKeyStorageReady() {
216
+        $rootDir = $this->util->getKeyStorageRoot();
217
+
218
+        // the default root is always valid
219
+        if ($rootDir === '') {
220
+            return true;
221
+        }
222
+
223
+        // check if key storage is mounted correctly
224
+        if ($this->rootView->file_exists($rootDir . '/' . Storage::KEY_STORAGE_MARKER)) {
225
+            return true;
226
+        }
227
+
228
+        return false;
229
+    }
230 230
 }
Please login to merge, or discard this patch.
ocs-provider/index.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@
 block discarded – undo
26 26
 $server = \OC::$server;
27 27
 
28 28
 $controller = new \OC\OCS\Provider(
29
-	'ocs_provider',
30
-	$server->getRequest(),
31
-	$server->getAppManager()
29
+    'ocs_provider',
30
+    $server->getRequest(),
31
+    $server->getAppManager()
32 32
 );
33 33
 echo $controller->buildProviderList()->render();
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
  * SPDX-License-Identifier: AGPL-3.0-only
6 6
  */
7 7
 
8
-require_once __DIR__ . '/../lib/base.php';
8
+require_once __DIR__.'/../lib/base.php';
9 9
 
10 10
 header('Content-Type: application/json');
11 11
 
Please login to merge, or discard this patch.
lib/private/Share20/ProviderFactory.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 		}
215 215
 
216 216
 		if ($provider === null) {
217
-			throw new ProviderException('No provider with id .' . $id . ' found.');
217
+			throw new ProviderException('No provider with id .'.$id.' found.');
218 218
 		}
219 219
 
220 220
 		return $provider;
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 
242 242
 
243 243
 		if ($provider === null) {
244
-			throw new ProviderException('No share provider for share type ' . $shareType);
244
+			throw new ProviderException('No share provider for share type '.$shareType);
245 245
 		}
246 246
 
247 247
 		return $provider;
Please login to merge, or discard this patch.
Indentation   +201 added lines, -201 removed lines patch added patch discarded remove patch
@@ -27,211 +27,211 @@
 block discarded – undo
27 27
  * @package OC\Share20
28 28
  */
29 29
 class ProviderFactory implements IProviderFactory {
30
-	private ?DefaultShareProvider $defaultProvider = null;
31
-	private ?FederatedShareProvider $federatedProvider = null;
32
-	private ?ShareByMailProvider $shareByMailProvider = null;
33
-	/**
34
-	 * @psalm-suppress UndefinedDocblockClass
35
-	 * @var ?RoomShareProvider
36
-	 */
37
-	private $roomShareProvider = null;
38
-
39
-	private array $registeredShareProviders = [];
40
-
41
-	private array $shareProviders = [];
42
-
43
-	public function __construct(
44
-		protected IAppManager $appManager,
45
-		protected LoggerInterface $logger,
46
-	) {
47
-	}
48
-
49
-	public function registerProvider(string $shareProviderClass): void {
50
-		$this->registeredShareProviders[] = $shareProviderClass;
51
-	}
52
-
53
-	/**
54
-	 * Create the default share provider.
55
-	 */
56
-	protected function defaultShareProvider(): DefaultShareProvider {
57
-		return Server::get(DefaultShareProvider::class);
58
-	}
59
-
60
-	/**
61
-	 * Create the federated share provider
62
-	 */
63
-	protected function federatedShareProvider(): ?FederatedShareProvider {
64
-		if ($this->federatedProvider === null) {
65
-			/*
30
+    private ?DefaultShareProvider $defaultProvider = null;
31
+    private ?FederatedShareProvider $federatedProvider = null;
32
+    private ?ShareByMailProvider $shareByMailProvider = null;
33
+    /**
34
+     * @psalm-suppress UndefinedDocblockClass
35
+     * @var ?RoomShareProvider
36
+     */
37
+    private $roomShareProvider = null;
38
+
39
+    private array $registeredShareProviders = [];
40
+
41
+    private array $shareProviders = [];
42
+
43
+    public function __construct(
44
+        protected IAppManager $appManager,
45
+        protected LoggerInterface $logger,
46
+    ) {
47
+    }
48
+
49
+    public function registerProvider(string $shareProviderClass): void {
50
+        $this->registeredShareProviders[] = $shareProviderClass;
51
+    }
52
+
53
+    /**
54
+     * Create the default share provider.
55
+     */
56
+    protected function defaultShareProvider(): DefaultShareProvider {
57
+        return Server::get(DefaultShareProvider::class);
58
+    }
59
+
60
+    /**
61
+     * Create the federated share provider
62
+     */
63
+    protected function federatedShareProvider(): ?FederatedShareProvider {
64
+        if ($this->federatedProvider === null) {
65
+            /*
66 66
 			 * Check if the app is enabled
67 67
 			 */
68
-			if (!$this->appManager->isEnabledForUser('federatedfilesharing')) {
69
-				return null;
70
-			}
71
-
72
-			$this->federatedProvider = Server::get(FederatedShareProvider::class);
73
-		}
74
-
75
-		return $this->federatedProvider;
76
-	}
77
-
78
-	/**
79
-	 * Create the federated share provider
80
-	 */
81
-	protected function getShareByMailProvider(): ?ShareByMailProvider {
82
-		if ($this->shareByMailProvider === null) {
83
-			/*
68
+            if (!$this->appManager->isEnabledForUser('federatedfilesharing')) {
69
+                return null;
70
+            }
71
+
72
+            $this->federatedProvider = Server::get(FederatedShareProvider::class);
73
+        }
74
+
75
+        return $this->federatedProvider;
76
+    }
77
+
78
+    /**
79
+     * Create the federated share provider
80
+     */
81
+    protected function getShareByMailProvider(): ?ShareByMailProvider {
82
+        if ($this->shareByMailProvider === null) {
83
+            /*
84 84
 			 * Check if the app is enabled
85 85
 			 */
86
-			if (!$this->appManager->isEnabledForUser('sharebymail')) {
87
-				return null;
88
-			}
89
-
90
-			$this->shareByMailProvider = Server::get(ShareByMailProvider::class);
91
-		}
92
-
93
-		return $this->shareByMailProvider;
94
-	}
95
-
96
-	/**
97
-	 * Create the room share provider
98
-	 *
99
-	 * @psalm-suppress UndefinedDocblockClass
100
-	 * @return ?RoomShareProvider
101
-	 */
102
-	protected function getRoomShareProvider() {
103
-		if ($this->roomShareProvider === null) {
104
-			/*
86
+            if (!$this->appManager->isEnabledForUser('sharebymail')) {
87
+                return null;
88
+            }
89
+
90
+            $this->shareByMailProvider = Server::get(ShareByMailProvider::class);
91
+        }
92
+
93
+        return $this->shareByMailProvider;
94
+    }
95
+
96
+    /**
97
+     * Create the room share provider
98
+     *
99
+     * @psalm-suppress UndefinedDocblockClass
100
+     * @return ?RoomShareProvider
101
+     */
102
+    protected function getRoomShareProvider() {
103
+        if ($this->roomShareProvider === null) {
104
+            /*
105 105
 			 * Check if the app is enabled
106 106
 			 */
107
-			if (!$this->appManager->isEnabledForUser('spreed')) {
108
-				return null;
109
-			}
110
-
111
-			try {
112
-				/**
113
-				 * @psalm-suppress UndefinedClass
114
-				 */
115
-				$this->roomShareProvider = Server::get(RoomShareProvider::class);
116
-			} catch (\Throwable $e) {
117
-				$this->logger->error(
118
-					$e->getMessage(),
119
-					['exception' => $e]
120
-				);
121
-				return null;
122
-			}
123
-		}
124
-
125
-		return $this->roomShareProvider;
126
-	}
127
-
128
-	/**
129
-	 * @inheritdoc
130
-	 */
131
-	public function getProvider($id) {
132
-		$provider = null;
133
-		if (isset($this->shareProviders[$id])) {
134
-			return $this->shareProviders[$id];
135
-		}
136
-
137
-		if ($id === 'ocinternal') {
138
-			$provider = $this->defaultShareProvider();
139
-		} elseif ($id === 'ocFederatedSharing') {
140
-			$provider = $this->federatedShareProvider();
141
-		} elseif ($id === 'ocMailShare') {
142
-			$provider = $this->getShareByMailProvider();
143
-		} elseif ($id === 'ocRoomShare') {
144
-			$provider = $this->getRoomShareProvider();
145
-		}
146
-
147
-		foreach ($this->registeredShareProviders as $shareProvider) {
148
-			try {
149
-				/** @var IShareProvider $instance */
150
-				$instance = Server::get($shareProvider);
151
-				$this->shareProviders[$instance->identifier()] = $instance;
152
-			} catch (\Throwable $e) {
153
-				$this->logger->error(
154
-					$e->getMessage(),
155
-					['exception' => $e]
156
-				);
157
-			}
158
-		}
159
-
160
-		if (isset($this->shareProviders[$id])) {
161
-			$provider = $this->shareProviders[$id];
162
-		}
163
-
164
-		if ($provider === null) {
165
-			throw new ProviderException('No provider with id .' . $id . ' found.');
166
-		}
167
-
168
-		return $provider;
169
-	}
170
-
171
-	/**
172
-	 * @inheritdoc
173
-	 */
174
-	public function getProviderForType($shareType) {
175
-		$provider = null;
176
-
177
-		if ($shareType === IShare::TYPE_USER ||
178
-			$shareType === IShare::TYPE_GROUP ||
179
-			$shareType === IShare::TYPE_LINK
180
-		) {
181
-			$provider = $this->defaultShareProvider();
182
-		} elseif ($shareType === IShare::TYPE_REMOTE || $shareType === IShare::TYPE_REMOTE_GROUP) {
183
-			$provider = $this->federatedShareProvider();
184
-		} elseif ($shareType === IShare::TYPE_EMAIL) {
185
-			$provider = $this->getShareByMailProvider();
186
-		} elseif ($shareType === IShare::TYPE_CIRCLE) {
187
-			$provider = $this->getProvider('ocCircleShare');
188
-		} elseif ($shareType === IShare::TYPE_ROOM) {
189
-			$provider = $this->getRoomShareProvider();
190
-		} elseif ($shareType === IShare::TYPE_DECK) {
191
-			$provider = $this->getProvider('deck');
192
-		} elseif ($shareType === IShare::TYPE_SCIENCEMESH) {
193
-			$provider = $this->getProvider('sciencemesh');
194
-		}
195
-
196
-
197
-		if ($provider === null) {
198
-			throw new ProviderException('No share provider for share type ' . $shareType);
199
-		}
200
-
201
-		return $provider;
202
-	}
203
-
204
-	public function getAllProviders() {
205
-		$shares = [$this->defaultShareProvider(), $this->federatedShareProvider()];
206
-		$shareByMail = $this->getShareByMailProvider();
207
-		if ($shareByMail !== null) {
208
-			$shares[] = $shareByMail;
209
-		}
210
-		$roomShare = $this->getRoomShareProvider();
211
-		if ($roomShare !== null) {
212
-			$shares[] = $roomShare;
213
-		}
214
-
215
-		foreach ($this->registeredShareProviders as $shareProvider) {
216
-			try {
217
-				/** @var IShareProvider $instance */
218
-				$instance = Server::get($shareProvider);
219
-			} catch (\Throwable $e) {
220
-				$this->logger->error(
221
-					$e->getMessage(),
222
-					['exception' => $e]
223
-				);
224
-				continue;
225
-			}
226
-
227
-			if (!isset($this->shareProviders[$instance->identifier()])) {
228
-				$this->shareProviders[$instance->identifier()] = $instance;
229
-			}
230
-			$shares[] = $this->shareProviders[$instance->identifier()];
231
-		}
232
-
233
-
234
-
235
-		return $shares;
236
-	}
107
+            if (!$this->appManager->isEnabledForUser('spreed')) {
108
+                return null;
109
+            }
110
+
111
+            try {
112
+                /**
113
+                 * @psalm-suppress UndefinedClass
114
+                 */
115
+                $this->roomShareProvider = Server::get(RoomShareProvider::class);
116
+            } catch (\Throwable $e) {
117
+                $this->logger->error(
118
+                    $e->getMessage(),
119
+                    ['exception' => $e]
120
+                );
121
+                return null;
122
+            }
123
+        }
124
+
125
+        return $this->roomShareProvider;
126
+    }
127
+
128
+    /**
129
+     * @inheritdoc
130
+     */
131
+    public function getProvider($id) {
132
+        $provider = null;
133
+        if (isset($this->shareProviders[$id])) {
134
+            return $this->shareProviders[$id];
135
+        }
136
+
137
+        if ($id === 'ocinternal') {
138
+            $provider = $this->defaultShareProvider();
139
+        } elseif ($id === 'ocFederatedSharing') {
140
+            $provider = $this->federatedShareProvider();
141
+        } elseif ($id === 'ocMailShare') {
142
+            $provider = $this->getShareByMailProvider();
143
+        } elseif ($id === 'ocRoomShare') {
144
+            $provider = $this->getRoomShareProvider();
145
+        }
146
+
147
+        foreach ($this->registeredShareProviders as $shareProvider) {
148
+            try {
149
+                /** @var IShareProvider $instance */
150
+                $instance = Server::get($shareProvider);
151
+                $this->shareProviders[$instance->identifier()] = $instance;
152
+            } catch (\Throwable $e) {
153
+                $this->logger->error(
154
+                    $e->getMessage(),
155
+                    ['exception' => $e]
156
+                );
157
+            }
158
+        }
159
+
160
+        if (isset($this->shareProviders[$id])) {
161
+            $provider = $this->shareProviders[$id];
162
+        }
163
+
164
+        if ($provider === null) {
165
+            throw new ProviderException('No provider with id .' . $id . ' found.');
166
+        }
167
+
168
+        return $provider;
169
+    }
170
+
171
+    /**
172
+     * @inheritdoc
173
+     */
174
+    public function getProviderForType($shareType) {
175
+        $provider = null;
176
+
177
+        if ($shareType === IShare::TYPE_USER ||
178
+            $shareType === IShare::TYPE_GROUP ||
179
+            $shareType === IShare::TYPE_LINK
180
+        ) {
181
+            $provider = $this->defaultShareProvider();
182
+        } elseif ($shareType === IShare::TYPE_REMOTE || $shareType === IShare::TYPE_REMOTE_GROUP) {
183
+            $provider = $this->federatedShareProvider();
184
+        } elseif ($shareType === IShare::TYPE_EMAIL) {
185
+            $provider = $this->getShareByMailProvider();
186
+        } elseif ($shareType === IShare::TYPE_CIRCLE) {
187
+            $provider = $this->getProvider('ocCircleShare');
188
+        } elseif ($shareType === IShare::TYPE_ROOM) {
189
+            $provider = $this->getRoomShareProvider();
190
+        } elseif ($shareType === IShare::TYPE_DECK) {
191
+            $provider = $this->getProvider('deck');
192
+        } elseif ($shareType === IShare::TYPE_SCIENCEMESH) {
193
+            $provider = $this->getProvider('sciencemesh');
194
+        }
195
+
196
+
197
+        if ($provider === null) {
198
+            throw new ProviderException('No share provider for share type ' . $shareType);
199
+        }
200
+
201
+        return $provider;
202
+    }
203
+
204
+    public function getAllProviders() {
205
+        $shares = [$this->defaultShareProvider(), $this->federatedShareProvider()];
206
+        $shareByMail = $this->getShareByMailProvider();
207
+        if ($shareByMail !== null) {
208
+            $shares[] = $shareByMail;
209
+        }
210
+        $roomShare = $this->getRoomShareProvider();
211
+        if ($roomShare !== null) {
212
+            $shares[] = $roomShare;
213
+        }
214
+
215
+        foreach ($this->registeredShareProviders as $shareProvider) {
216
+            try {
217
+                /** @var IShareProvider $instance */
218
+                $instance = Server::get($shareProvider);
219
+            } catch (\Throwable $e) {
220
+                $this->logger->error(
221
+                    $e->getMessage(),
222
+                    ['exception' => $e]
223
+                );
224
+                continue;
225
+            }
226
+
227
+            if (!isset($this->shareProviders[$instance->identifier()])) {
228
+                $this->shareProviders[$instance->identifier()] = $instance;
229
+            }
230
+            $shares[] = $this->shareProviders[$instance->identifier()];
231
+        }
232
+
233
+
234
+
235
+        return $shares;
236
+    }
237 237
 }
Please login to merge, or discard this patch.
apps/dav/lib/Migration/CalDAVRemoveEmptyValue.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
 
66 66
 		$output->startProgress(count($objects));
67 67
 		foreach ($objects as $row) {
68
-			$calObject = $this->calDavBackend->getCalendarObject((int)$row['calendarid'], $row['uri']);
69
-			$data = preg_replace('/' . $pattern . '/', ':', $calObject['calendardata']);
68
+			$calObject = $this->calDavBackend->getCalendarObject((int) $row['calendarid'], $row['uri']);
69
+			$data = preg_replace('/'.$pattern.'/', ':', $calObject['calendardata']);
70 70
 
71 71
 			if ($data !== $calObject['calendardata']) {
72 72
 				$output->advance();
@@ -76,14 +76,14 @@  discard block
 block discarded – undo
76 76
 				} catch (InvalidDataException $e) {
77 77
 					$this->logger->info('Calendar object for calendar {cal} with uri {uri} still invalid', [
78 78
 						'app' => 'dav',
79
-						'cal' => (int)$row['calendarid'],
79
+						'cal' => (int) $row['calendarid'],
80 80
 						'uri' => $row['uri'],
81 81
 					]);
82 82
 					$warnings++;
83 83
 					continue;
84 84
 				}
85 85
 
86
-				$this->calDavBackend->updateCalendarObject((int)$row['calendarid'], $row['uri'], $data);
86
+				$this->calDavBackend->updateCalendarObject((int) $row['calendarid'], $row['uri'], $data);
87 87
 				$count++;
88 88
 			}
89 89
 		}
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 			->where($query->expr()->like(
105 105
 				'calendardata',
106 106
 				$query->createNamedParameter(
107
-					'%' . $this->db->escapeLikeParameter($pattern) . '%',
107
+					'%'.$this->db->escapeLikeParameter($pattern).'%',
108 108
 					IQueryBuilder::PARAM_STR
109 109
 				),
110 110
 				IQueryBuilder::PARAM_STR
Please login to merge, or discard this patch.
Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -15,105 +15,105 @@
 block discarded – undo
15 15
 
16 16
 class CalDAVRemoveEmptyValue implements IRepairStep {
17 17
 
18
-	public function __construct(
19
-		private IDBConnection $db,
20
-		private CalDavBackend $calDavBackend,
21
-		private LoggerInterface $logger,
22
-	) {
23
-	}
24
-
25
-	public function getName() {
26
-		return 'Fix broken values of calendar objects';
27
-	}
28
-
29
-	public function run(IOutput $output) {
30
-		$pattern = ';VALUE=:';
31
-		$count = $warnings = 0;
32
-
33
-		$objects = $this->getInvalidObjects($pattern);
34
-
35
-		$output->startProgress(count($objects));
36
-		foreach ($objects as $row) {
37
-			$calObject = $this->calDavBackend->getCalendarObject((int)$row['calendarid'], $row['uri']);
38
-			$data = preg_replace('/' . $pattern . '/', ':', $calObject['calendardata']);
39
-
40
-			if ($data !== $calObject['calendardata']) {
41
-				$output->advance();
42
-
43
-				try {
44
-					$this->calDavBackend->getDenormalizedData($data);
45
-				} catch (InvalidDataException $e) {
46
-					$this->logger->info('Calendar object for calendar {cal} with uri {uri} still invalid', [
47
-						'app' => 'dav',
48
-						'cal' => (int)$row['calendarid'],
49
-						'uri' => $row['uri'],
50
-					]);
51
-					$warnings++;
52
-					continue;
53
-				}
54
-
55
-				$this->calDavBackend->updateCalendarObject((int)$row['calendarid'], $row['uri'], $data);
56
-				$count++;
57
-			}
58
-		}
59
-		$output->finishProgress();
60
-
61
-		if ($warnings > 0) {
62
-			$output->warning(sprintf('%d events could not be updated, see log file for more information', $warnings));
63
-		}
64
-		if ($count > 0) {
65
-			$output->info(sprintf('Updated %d events', $count));
66
-		}
67
-	}
68
-
69
-	protected function getInvalidObjects($pattern) {
70
-		if ($this->db->getDatabaseProvider() === IDBConnection::PLATFORM_ORACLE) {
71
-			$rows = [];
72
-			$chunkSize = 500;
73
-			$query = $this->db->getQueryBuilder();
74
-			$query->select($query->func()->count('*', 'num_entries'))
75
-				->from('calendarobjects');
76
-			$result = $query->executeQuery();
77
-			$count = $result->fetchOne();
78
-			$result->closeCursor();
79
-
80
-			$numChunks = ceil($count / $chunkSize);
81
-
82
-			$query = $this->db->getQueryBuilder();
83
-			$query->select(['calendarid', 'uri', 'calendardata'])
84
-				->from('calendarobjects')
85
-				->setMaxResults($chunkSize);
86
-			for ($chunk = 0; $chunk < $numChunks; $chunk++) {
87
-				$query->setFirstResult($chunk * $chunkSize);
88
-				$result = $query->executeQuery();
89
-
90
-				while ($row = $result->fetch()) {
91
-					if (mb_strpos($row['calendardata'], $pattern) !== false) {
92
-						unset($row['calendardata']);
93
-						$rows[] = $row;
94
-					}
95
-				}
96
-				$result->closeCursor();
97
-			}
98
-			return $rows;
99
-		}
100
-
101
-		$query = $this->db->getQueryBuilder();
102
-		$query->select(['calendarid', 'uri'])
103
-			->from('calendarobjects')
104
-			->where($query->expr()->like(
105
-				'calendardata',
106
-				$query->createNamedParameter(
107
-					'%' . $this->db->escapeLikeParameter($pattern) . '%',
108
-					IQueryBuilder::PARAM_STR
109
-				),
110
-				IQueryBuilder::PARAM_STR
111
-			));
112
-
113
-		$result = $query->executeQuery();
114
-		$rows = $result->fetchAll();
115
-		$result->closeCursor();
116
-
117
-		return $rows;
118
-	}
18
+    public function __construct(
19
+        private IDBConnection $db,
20
+        private CalDavBackend $calDavBackend,
21
+        private LoggerInterface $logger,
22
+    ) {
23
+    }
24
+
25
+    public function getName() {
26
+        return 'Fix broken values of calendar objects';
27
+    }
28
+
29
+    public function run(IOutput $output) {
30
+        $pattern = ';VALUE=:';
31
+        $count = $warnings = 0;
32
+
33
+        $objects = $this->getInvalidObjects($pattern);
34
+
35
+        $output->startProgress(count($objects));
36
+        foreach ($objects as $row) {
37
+            $calObject = $this->calDavBackend->getCalendarObject((int)$row['calendarid'], $row['uri']);
38
+            $data = preg_replace('/' . $pattern . '/', ':', $calObject['calendardata']);
39
+
40
+            if ($data !== $calObject['calendardata']) {
41
+                $output->advance();
42
+
43
+                try {
44
+                    $this->calDavBackend->getDenormalizedData($data);
45
+                } catch (InvalidDataException $e) {
46
+                    $this->logger->info('Calendar object for calendar {cal} with uri {uri} still invalid', [
47
+                        'app' => 'dav',
48
+                        'cal' => (int)$row['calendarid'],
49
+                        'uri' => $row['uri'],
50
+                    ]);
51
+                    $warnings++;
52
+                    continue;
53
+                }
54
+
55
+                $this->calDavBackend->updateCalendarObject((int)$row['calendarid'], $row['uri'], $data);
56
+                $count++;
57
+            }
58
+        }
59
+        $output->finishProgress();
60
+
61
+        if ($warnings > 0) {
62
+            $output->warning(sprintf('%d events could not be updated, see log file for more information', $warnings));
63
+        }
64
+        if ($count > 0) {
65
+            $output->info(sprintf('Updated %d events', $count));
66
+        }
67
+    }
68
+
69
+    protected function getInvalidObjects($pattern) {
70
+        if ($this->db->getDatabaseProvider() === IDBConnection::PLATFORM_ORACLE) {
71
+            $rows = [];
72
+            $chunkSize = 500;
73
+            $query = $this->db->getQueryBuilder();
74
+            $query->select($query->func()->count('*', 'num_entries'))
75
+                ->from('calendarobjects');
76
+            $result = $query->executeQuery();
77
+            $count = $result->fetchOne();
78
+            $result->closeCursor();
79
+
80
+            $numChunks = ceil($count / $chunkSize);
81
+
82
+            $query = $this->db->getQueryBuilder();
83
+            $query->select(['calendarid', 'uri', 'calendardata'])
84
+                ->from('calendarobjects')
85
+                ->setMaxResults($chunkSize);
86
+            for ($chunk = 0; $chunk < $numChunks; $chunk++) {
87
+                $query->setFirstResult($chunk * $chunkSize);
88
+                $result = $query->executeQuery();
89
+
90
+                while ($row = $result->fetch()) {
91
+                    if (mb_strpos($row['calendardata'], $pattern) !== false) {
92
+                        unset($row['calendardata']);
93
+                        $rows[] = $row;
94
+                    }
95
+                }
96
+                $result->closeCursor();
97
+            }
98
+            return $rows;
99
+        }
100
+
101
+        $query = $this->db->getQueryBuilder();
102
+        $query->select(['calendarid', 'uri'])
103
+            ->from('calendarobjects')
104
+            ->where($query->expr()->like(
105
+                'calendardata',
106
+                $query->createNamedParameter(
107
+                    '%' . $this->db->escapeLikeParameter($pattern) . '%',
108
+                    IQueryBuilder::PARAM_STR
109
+                ),
110
+                IQueryBuilder::PARAM_STR
111
+            ));
112
+
113
+        $result = $query->executeQuery();
114
+        $rows = $result->fetchAll();
115
+        $result->closeCursor();
116
+
117
+        return $rows;
118
+    }
119 119
 }
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Search/Xml/Filter/CompFilter.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
 		$reader->parseInnerTree();
40 40
 
41 41
 		if (!is_string($componentName)) {
42
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}comp-filter requires a valid name attribute');
42
+			throw new BadRequest('The {'.SearchPlugin::NS_Nextcloud.'}comp-filter requires a valid name attribute');
43 43
 		}
44 44
 
45 45
 		return $componentName;
Please login to merge, or discard this patch.
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -27,21 +27,21 @@
 block discarded – undo
27 27
 
28 28
 class CompFilter implements XmlDeserializable {
29 29
 
30
-	/**
31
-	 * @param Reader $reader
32
-	 * @throws BadRequest
33
-	 * @return string
34
-	 */
35
-	public static function xmlDeserialize(Reader $reader) {
36
-		$att = $reader->parseAttributes();
37
-		$componentName = $att['name'];
30
+    /**
31
+     * @param Reader $reader
32
+     * @throws BadRequest
33
+     * @return string
34
+     */
35
+    public static function xmlDeserialize(Reader $reader) {
36
+        $att = $reader->parseAttributes();
37
+        $componentName = $att['name'];
38 38
 
39
-		$reader->parseInnerTree();
39
+        $reader->parseInnerTree();
40 40
 
41
-		if (!is_string($componentName)) {
42
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}comp-filter requires a valid name attribute');
43
-		}
41
+        if (!is_string($componentName)) {
42
+            throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}comp-filter requires a valid name attribute');
43
+        }
44 44
 
45
-		return $componentName;
46
-	}
45
+        return $componentName;
46
+    }
47 47
 }
Please login to merge, or discard this patch.