@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $this->backend = $backend; |
88 | 88 | $this->dispatcher = $dispatcher; |
89 | 89 | $this->emitter = $emitter; |
90 | - if(is_null($config)) { |
|
90 | + if (is_null($config)) { |
|
91 | 91 | $config = \OC::$server->getConfig(); |
92 | 92 | } |
93 | 93 | $this->config = $config; |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public function setEMailAddress($mailAddress) { |
165 | 165 | $oldMailAddress = $this->getEMailAddress(); |
166 | - if($oldMailAddress !== $mailAddress) { |
|
167 | - if($mailAddress === '') { |
|
166 | + if ($oldMailAddress !== $mailAddress) { |
|
167 | + if ($mailAddress === '') { |
|
168 | 168 | $this->config->deleteUserValue($this->uid, 'settings', 'email'); |
169 | 169 | } else { |
170 | 170 | $this->config->setUserValue($this->uid, 'settings', 'email', $mailAddress); |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * @return bool |
202 | 202 | */ |
203 | 203 | public function delete() { |
204 | - $this->dispatcher->dispatch(IUser::class . '::preDelete', new GenericEvent($this)); |
|
204 | + $this->dispatcher->dispatch(IUser::class.'::preDelete', new GenericEvent($this)); |
|
205 | 205 | if ($this->emitter) { |
206 | 206 | $this->emitter->emit('\OC\User', 'preDelete', [$this]); |
207 | 207 | } |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | } |
234 | 234 | |
235 | 235 | // Delete the users entry in the storage table |
236 | - Storage::remove('home::' . $this->uid); |
|
236 | + Storage::remove('home::'.$this->uid); |
|
237 | 237 | |
238 | 238 | \OC::$server->getCommentsManager()->deleteReferencesOfActor('users', $this->uid); |
239 | 239 | \OC::$server->getCommentsManager()->deleteReadMarksFromUser($this); |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $accountManager = \OC::$server->query(AccountManager::class); |
247 | 247 | $accountManager->deleteUser($this); |
248 | 248 | |
249 | - $this->dispatcher->dispatch(IUser::class . '::postDelete', new GenericEvent($this)); |
|
249 | + $this->dispatcher->dispatch(IUser::class.'::postDelete', new GenericEvent($this)); |
|
250 | 250 | if ($this->emitter) { |
251 | 251 | $this->emitter->emit('\OC\User', 'postDelete', [$this]); |
252 | 252 | } |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | * @return bool |
263 | 263 | */ |
264 | 264 | public function setPassword($password, $recoveryPassword = null) { |
265 | - $this->dispatcher->dispatch(IUser::class . '::preSetPassword', new GenericEvent($this, [ |
|
265 | + $this->dispatcher->dispatch(IUser::class.'::preSetPassword', new GenericEvent($this, [ |
|
266 | 266 | 'password' => $password, |
267 | 267 | 'recoveryPassword' => $recoveryPassword, |
268 | 268 | ])); |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | } |
272 | 272 | if ($this->backend->implementsActions(Backend::SET_PASSWORD)) { |
273 | 273 | $result = $this->backend->setPassword($this->uid, $password); |
274 | - $this->dispatcher->dispatch(IUser::class . '::postSetPassword', new GenericEvent($this, [ |
|
274 | + $this->dispatcher->dispatch(IUser::class.'::postSetPassword', new GenericEvent($this, [ |
|
275 | 275 | 'password' => $password, |
276 | 276 | 'recoveryPassword' => $recoveryPassword, |
277 | 277 | ])); |
@@ -294,9 +294,9 @@ discard block |
||
294 | 294 | if ($this->backend->implementsActions(Backend::GET_HOME) and $home = $this->backend->getHome($this->uid)) { |
295 | 295 | $this->home = $home; |
296 | 296 | } elseif ($this->config) { |
297 | - $this->home = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/' . $this->uid; |
|
297 | + $this->home = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').'/'.$this->uid; |
|
298 | 298 | } else { |
299 | - $this->home = \OC::$SERVERROOT . '/data/' . $this->uid; |
|
299 | + $this->home = \OC::$SERVERROOT.'/data/'.$this->uid; |
|
300 | 300 | } |
301 | 301 | } |
302 | 302 | return $this->home; |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | * @return string |
309 | 309 | */ |
310 | 310 | public function getBackendClassName() { |
311 | - if($this->backend instanceof IUserBackend) { |
|
311 | + if ($this->backend instanceof IUserBackend) { |
|
312 | 312 | return $this->backend->getBackendName(); |
313 | 313 | } |
314 | 314 | return get_class($this->backend); |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | */ |
394 | 394 | public function getQuota() { |
395 | 395 | $quota = $this->config->getUserValue($this->uid, 'files', 'quota', 'default'); |
396 | - if($quota === 'default') { |
|
396 | + if ($quota === 'default') { |
|
397 | 397 | $quota = $this->config->getAppValue('files', 'default_quota', 'none'); |
398 | 398 | } |
399 | 399 | return $quota; |
@@ -408,11 +408,11 @@ discard block |
||
408 | 408 | */ |
409 | 409 | public function setQuota($quota) { |
410 | 410 | $oldQuota = $this->config->getUserValue($this->uid, 'files', 'quota', ''); |
411 | - if($quota !== 'none' and $quota !== 'default') { |
|
411 | + if ($quota !== 'none' and $quota !== 'default') { |
|
412 | 412 | $quota = OC_Helper::computerFileSize($quota); |
413 | 413 | $quota = OC_Helper::humanFileSize($quota); |
414 | 414 | } |
415 | - if($quota !== $oldQuota) { |
|
415 | + if ($quota !== $oldQuota) { |
|
416 | 416 | $this->config->setUserValue($this->uid, 'files', 'quota', $quota); |
417 | 417 | $this->triggerChange('quota', $quota, $oldQuota); |
418 | 418 | } |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | public function getCloudId() { |
450 | 450 | $uid = $this->getUID(); |
451 | 451 | $server = $this->urlGenerator->getAbsoluteURL('/'); |
452 | - $server = rtrim($this->removeProtocolFromUrl($server), '/'); |
|
452 | + $server = rtrim($this->removeProtocolFromUrl($server), '/'); |
|
453 | 453 | return \OC::$server->getCloudIdManager()->getCloudId($uid, $server)->getId(); |
454 | 454 | } |
455 | 455 | |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | } |
469 | 469 | |
470 | 470 | public function triggerChange($feature, $value = null, $oldValue = null) { |
471 | - $this->dispatcher->dispatch(IUser::class . '::changeUser', new GenericEvent($this, [ |
|
471 | + $this->dispatcher->dispatch(IUser::class.'::changeUser', new GenericEvent($this, [ |
|
472 | 472 | 'feature' => $feature, |
473 | 473 | 'value' => $value, |
474 | 474 | 'oldValue' => $oldValue, |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | } |
137 | 137 | $this->tags = $this->mapper->loadTags($this->owners, $this->type); |
138 | 138 | |
139 | - if(count($defaultTags) > 0 && count($this->tags) === 0) { |
|
139 | + if (count($defaultTags) > 0 && count($this->tags) === 0) { |
|
140 | 140 | $this->addMultiple($defaultTags, true); |
141 | 141 | } |
142 | 142 | } |
@@ -177,17 +177,17 @@ discard block |
||
177 | 177 | * @return array |
178 | 178 | */ |
179 | 179 | public function getTags() { |
180 | - if(!count($this->tags)) { |
|
180 | + if (!count($this->tags)) { |
|
181 | 181 | return []; |
182 | 182 | } |
183 | 183 | |
184 | - usort($this->tags, function ($a, $b) { |
|
184 | + usort($this->tags, function($a, $b) { |
|
185 | 185 | return strnatcasecmp($a->getName(), $b->getName()); |
186 | 186 | }); |
187 | 187 | $tagMap = []; |
188 | 188 | |
189 | - foreach($this->tags as $tag) { |
|
190 | - if($tag->getName() !== ITags::TAG_FAVORITE) { |
|
189 | + foreach ($this->tags as $tag) { |
|
190 | + if ($tag->getName() !== ITags::TAG_FAVORITE) { |
|
191 | 191 | $tagMap[] = $this->tagMap($tag); |
192 | 192 | } |
193 | 193 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | */ |
205 | 205 | public function getTagsForUser($user) { |
206 | 206 | return array_filter($this->tags, |
207 | - function ($tag) use ($user) { |
|
207 | + function($tag) use ($user) { |
|
208 | 208 | return $tag->getOwner() === $user; |
209 | 209 | } |
210 | 210 | ); |
@@ -225,25 +225,25 @@ discard block |
||
225 | 225 | $chunks = array_chunk($objIds, 900, false); |
226 | 226 | foreach ($chunks as $chunk) { |
227 | 227 | $result = $conn->executeQuery( |
228 | - 'SELECT `category`, `categoryid`, `objid` ' . |
|
229 | - 'FROM `' . self::RELATION_TABLE . '` r, `' . self::TAG_TABLE . '` ' . |
|
228 | + 'SELECT `category`, `categoryid`, `objid` '. |
|
229 | + 'FROM `'.self::RELATION_TABLE.'` r, `'.self::TAG_TABLE.'` '. |
|
230 | 230 | 'WHERE `categoryid` = `id` AND `uid` = ? AND r.`type` = ? AND `objid` IN (?)', |
231 | 231 | [$this->user, $this->type, $chunk], |
232 | 232 | [null, null, IQueryBuilder::PARAM_INT_ARRAY] |
233 | 233 | ); |
234 | 234 | while ($row = $result->fetch()) { |
235 | - $objId = (int)$row['objid']; |
|
235 | + $objId = (int) $row['objid']; |
|
236 | 236 | if (!isset($entries[$objId])) { |
237 | 237 | $entries[$objId] = []; |
238 | 238 | } |
239 | 239 | $entries[$objId][] = $row['category']; |
240 | 240 | } |
241 | 241 | if ($result === null) { |
242 | - \OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR); |
|
242 | + \OCP\Util::writeLog('core', __METHOD__.'DB error: '.\OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR); |
|
243 | 243 | return false; |
244 | 244 | } |
245 | 245 | } |
246 | - } catch(\Exception $e) { |
|
246 | + } catch (\Exception $e) { |
|
247 | 247 | \OC::$server->getLogger()->logException($e, [ |
248 | 248 | 'message' => __METHOD__, |
249 | 249 | 'level' => ILogger::ERROR, |
@@ -267,18 +267,18 @@ discard block |
||
267 | 267 | public function getIdsForTag($tag) { |
268 | 268 | $result = null; |
269 | 269 | $tagId = false; |
270 | - if(is_numeric($tag)) { |
|
270 | + if (is_numeric($tag)) { |
|
271 | 271 | $tagId = $tag; |
272 | - } elseif(is_string($tag)) { |
|
272 | + } elseif (is_string($tag)) { |
|
273 | 273 | $tag = trim($tag); |
274 | - if($tag === '') { |
|
274 | + if ($tag === '') { |
|
275 | 275 | \OCP\Util::writeLog('core', __METHOD__.', Cannot use empty tag names', ILogger::DEBUG); |
276 | 276 | return false; |
277 | 277 | } |
278 | 278 | $tagId = $this->getTagId($tag); |
279 | 279 | } |
280 | 280 | |
281 | - if($tagId === false) { |
|
281 | + if ($tagId === false) { |
|
282 | 282 | $l10n = \OC::$server->getL10N('core'); |
283 | 283 | throw new \Exception( |
284 | 284 | $l10n->t('Could not find category "%s"', [$tag]) |
@@ -286,17 +286,17 @@ discard block |
||
286 | 286 | } |
287 | 287 | |
288 | 288 | $ids = []; |
289 | - $sql = 'SELECT `objid` FROM `' . self::RELATION_TABLE |
|
289 | + $sql = 'SELECT `objid` FROM `'.self::RELATION_TABLE |
|
290 | 290 | . '` WHERE `categoryid` = ?'; |
291 | 291 | |
292 | 292 | try { |
293 | 293 | $stmt = \OC_DB::prepare($sql); |
294 | 294 | $result = $stmt->execute([$tagId]); |
295 | 295 | if ($result === null) { |
296 | - \OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR); |
|
296 | + \OCP\Util::writeLog('core', __METHOD__.'DB error: '.\OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR); |
|
297 | 297 | return false; |
298 | 298 | } |
299 | - } catch(\Exception $e) { |
|
299 | + } catch (\Exception $e) { |
|
300 | 300 | \OC::$server->getLogger()->logException($e, [ |
301 | 301 | 'message' => __METHOD__, |
302 | 302 | 'level' => ILogger::ERROR, |
@@ -305,9 +305,9 @@ discard block |
||
305 | 305 | return false; |
306 | 306 | } |
307 | 307 | |
308 | - if(!is_null($result)) { |
|
309 | - while($row = $result->fetchRow()) { |
|
310 | - $id = (int)$row['objid']; |
|
308 | + if (!is_null($result)) { |
|
309 | + while ($row = $result->fetchRow()) { |
|
310 | + $id = (int) $row['objid']; |
|
311 | 311 | |
312 | 312 | if ($this->includeShared) { |
313 | 313 | // We have to check if we are really allowed to access the |
@@ -361,19 +361,19 @@ discard block |
||
361 | 361 | public function add($name) { |
362 | 362 | $name = trim($name); |
363 | 363 | |
364 | - if($name === '') { |
|
364 | + if ($name === '') { |
|
365 | 365 | \OCP\Util::writeLog('core', __METHOD__.', Cannot add an empty tag', ILogger::DEBUG); |
366 | 366 | return false; |
367 | 367 | } |
368 | - if($this->userHasTag($name, $this->user)) { |
|
369 | - \OCP\Util::writeLog('core', __METHOD__.', name: ' . $name. ' exists already', ILogger::DEBUG); |
|
368 | + if ($this->userHasTag($name, $this->user)) { |
|
369 | + \OCP\Util::writeLog('core', __METHOD__.', name: '.$name.' exists already', ILogger::DEBUG); |
|
370 | 370 | return false; |
371 | 371 | } |
372 | 372 | try { |
373 | 373 | $tag = new Tag($this->user, $this->type, $name); |
374 | 374 | $tag = $this->mapper->insert($tag); |
375 | 375 | $this->tags[] = $tag; |
376 | - } catch(\Exception $e) { |
|
376 | + } catch (\Exception $e) { |
|
377 | 377 | \OC::$server->getLogger()->logException($e, [ |
378 | 378 | 'message' => __METHOD__, |
379 | 379 | 'level' => ILogger::ERROR, |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | ]); |
382 | 382 | return false; |
383 | 383 | } |
384 | - \OCP\Util::writeLog('core', __METHOD__.', id: ' . $tag->getId(), ILogger::DEBUG); |
|
384 | + \OCP\Util::writeLog('core', __METHOD__.', id: '.$tag->getId(), ILogger::DEBUG); |
|
385 | 385 | return $tag->getId(); |
386 | 386 | } |
387 | 387 | |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | $from = trim($from); |
397 | 397 | $to = trim($to); |
398 | 398 | |
399 | - if($to === '' || $from === '') { |
|
399 | + if ($to === '' || $from === '') { |
|
400 | 400 | \OCP\Util::writeLog('core', __METHOD__.', Cannot use empty tag names', ILogger::DEBUG); |
401 | 401 | return false; |
402 | 402 | } |
@@ -406,21 +406,21 @@ discard block |
||
406 | 406 | } else { |
407 | 407 | $key = $this->getTagByName($from); |
408 | 408 | } |
409 | - if($key === false) { |
|
410 | - \OCP\Util::writeLog('core', __METHOD__.', tag: ' . $from. ' does not exist', ILogger::DEBUG); |
|
409 | + if ($key === false) { |
|
410 | + \OCP\Util::writeLog('core', __METHOD__.', tag: '.$from.' does not exist', ILogger::DEBUG); |
|
411 | 411 | return false; |
412 | 412 | } |
413 | 413 | $tag = $this->tags[$key]; |
414 | 414 | |
415 | - if($this->userHasTag($to, $tag->getOwner())) { |
|
416 | - \OCP\Util::writeLog('core', __METHOD__.', A tag named ' . $to. ' already exists for user ' . $tag->getOwner() . '.', ILogger::DEBUG); |
|
415 | + if ($this->userHasTag($to, $tag->getOwner())) { |
|
416 | + \OCP\Util::writeLog('core', __METHOD__.', A tag named '.$to.' already exists for user '.$tag->getOwner().'.', ILogger::DEBUG); |
|
417 | 417 | return false; |
418 | 418 | } |
419 | 419 | |
420 | 420 | try { |
421 | 421 | $tag->setName($to); |
422 | 422 | $this->tags[$key] = $this->mapper->update($tag); |
423 | - } catch(\Exception $e) { |
|
423 | + } catch (\Exception $e) { |
|
424 | 424 | \OC::$server->getLogger()->logException($e, [ |
425 | 425 | 'message' => __METHOD__, |
426 | 426 | 'level' => ILogger::ERROR, |
@@ -440,25 +440,25 @@ discard block |
||
440 | 440 | * @param int|null $id int Optional object id to add to this|these tag(s) |
441 | 441 | * @return bool Returns false on error. |
442 | 442 | */ |
443 | - public function addMultiple($names, $sync=false, $id = null) { |
|
444 | - if(!is_array($names)) { |
|
443 | + public function addMultiple($names, $sync = false, $id = null) { |
|
444 | + if (!is_array($names)) { |
|
445 | 445 | $names = [$names]; |
446 | 446 | } |
447 | 447 | $names = array_map('trim', $names); |
448 | 448 | array_filter($names); |
449 | 449 | |
450 | 450 | $newones = []; |
451 | - foreach($names as $name) { |
|
452 | - if(!$this->hasTag($name) && $name !== '') { |
|
451 | + foreach ($names as $name) { |
|
452 | + if (!$this->hasTag($name) && $name !== '') { |
|
453 | 453 | $newones[] = new Tag($this->user, $this->type, $name); |
454 | 454 | } |
455 | - if(!is_null($id)) { |
|
455 | + if (!is_null($id)) { |
|
456 | 456 | // Insert $objectid, $categoryid pairs if not exist. |
457 | 457 | self::$relations[] = ['objid' => $id, 'tag' => $name]; |
458 | 458 | } |
459 | 459 | } |
460 | 460 | $this->tags = array_merge($this->tags, $newones); |
461 | - if($sync === true) { |
|
461 | + if ($sync === true) { |
|
462 | 462 | $this->save(); |
463 | 463 | } |
464 | 464 | |
@@ -469,13 +469,13 @@ discard block |
||
469 | 469 | * Save the list of tags and their object relations |
470 | 470 | */ |
471 | 471 | protected function save() { |
472 | - if(is_array($this->tags)) { |
|
473 | - foreach($this->tags as $tag) { |
|
472 | + if (is_array($this->tags)) { |
|
473 | + foreach ($this->tags as $tag) { |
|
474 | 474 | try { |
475 | 475 | if (!$this->mapper->tagExists($tag)) { |
476 | 476 | $this->mapper->insert($tag); |
477 | 477 | } |
478 | - } catch(\Exception $e) { |
|
478 | + } catch (\Exception $e) { |
|
479 | 479 | \OC::$server->getLogger()->logException($e, [ |
480 | 480 | 'message' => __METHOD__, |
481 | 481 | 'level' => ILogger::ERROR, |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | |
487 | 487 | // reload tags to get the proper ids. |
488 | 488 | $this->tags = $this->mapper->loadTags($this->owners, $this->type); |
489 | - \OCP\Util::writeLog('core', __METHOD__.', tags: ' . print_r($this->tags, true), |
|
489 | + \OCP\Util::writeLog('core', __METHOD__.', tags: '.print_r($this->tags, true), |
|
490 | 490 | ILogger::DEBUG); |
491 | 491 | // Loop through temporarily cached objectid/tagname pairs |
492 | 492 | // and save relations. |
@@ -494,10 +494,10 @@ discard block |
||
494 | 494 | // For some reason this is needed or array_search(i) will return 0..? |
495 | 495 | ksort($tags); |
496 | 496 | $dbConnection = \OC::$server->getDatabaseConnection(); |
497 | - foreach(self::$relations as $relation) { |
|
497 | + foreach (self::$relations as $relation) { |
|
498 | 498 | $tagId = $this->getTagId($relation['tag']); |
499 | - \OCP\Util::writeLog('core', __METHOD__ . 'catid, ' . $relation['tag'] . ' ' . $tagId, ILogger::DEBUG); |
|
500 | - if($tagId) { |
|
499 | + \OCP\Util::writeLog('core', __METHOD__.'catid, '.$relation['tag'].' '.$tagId, ILogger::DEBUG); |
|
500 | + if ($tagId) { |
|
501 | 501 | try { |
502 | 502 | $dbConnection->insertIfNotExist(self::RELATION_TABLE, |
503 | 503 | [ |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | 'categoryid' => $tagId, |
506 | 506 | 'type' => $this->type, |
507 | 507 | ]); |
508 | - } catch(\Exception $e) { |
|
508 | + } catch (\Exception $e) { |
|
509 | 509 | \OC::$server->getLogger()->logException($e, [ |
510 | 510 | 'message' => __METHOD__, |
511 | 511 | 'level' => ILogger::ERROR, |
@@ -532,13 +532,13 @@ discard block |
||
532 | 532 | // Find all objectid/tagId pairs. |
533 | 533 | $result = null; |
534 | 534 | try { |
535 | - $stmt = \OC_DB::prepare('SELECT `id` FROM `' . self::TAG_TABLE . '` ' |
|
535 | + $stmt = \OC_DB::prepare('SELECT `id` FROM `'.self::TAG_TABLE.'` ' |
|
536 | 536 | . 'WHERE `uid` = ?'); |
537 | 537 | $result = $stmt->execute([$arguments['uid']]); |
538 | 538 | if ($result === null) { |
539 | - \OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR); |
|
539 | + \OCP\Util::writeLog('core', __METHOD__.'DB error: '.\OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR); |
|
540 | 540 | } |
541 | - } catch(\Exception $e) { |
|
541 | + } catch (\Exception $e) { |
|
542 | 542 | \OC::$server->getLogger()->logException($e, [ |
543 | 543 | 'message' => __METHOD__, |
544 | 544 | 'level' => ILogger::ERROR, |
@@ -546,14 +546,14 @@ discard block |
||
546 | 546 | ]); |
547 | 547 | } |
548 | 548 | |
549 | - if(!is_null($result)) { |
|
549 | + if (!is_null($result)) { |
|
550 | 550 | try { |
551 | - $stmt = \OC_DB::prepare('DELETE FROM `' . self::RELATION_TABLE . '` ' |
|
551 | + $stmt = \OC_DB::prepare('DELETE FROM `'.self::RELATION_TABLE.'` ' |
|
552 | 552 | . 'WHERE `categoryid` = ?'); |
553 | - while($row = $result->fetchRow()) { |
|
553 | + while ($row = $result->fetchRow()) { |
|
554 | 554 | try { |
555 | 555 | $stmt->execute([$row['id']]); |
556 | - } catch(\Exception $e) { |
|
556 | + } catch (\Exception $e) { |
|
557 | 557 | \OC::$server->getLogger()->logException($e, [ |
558 | 558 | 'message' => __METHOD__, |
559 | 559 | 'level' => ILogger::ERROR, |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | ]); |
562 | 562 | } |
563 | 563 | } |
564 | - } catch(\Exception $e) { |
|
564 | + } catch (\Exception $e) { |
|
565 | 565 | \OC::$server->getLogger()->logException($e, [ |
566 | 566 | 'message' => __METHOD__, |
567 | 567 | 'level' => ILogger::ERROR, |
@@ -570,13 +570,13 @@ discard block |
||
570 | 570 | } |
571 | 571 | } |
572 | 572 | try { |
573 | - $stmt = \OC_DB::prepare('DELETE FROM `' . self::TAG_TABLE . '` ' |
|
573 | + $stmt = \OC_DB::prepare('DELETE FROM `'.self::TAG_TABLE.'` ' |
|
574 | 574 | . 'WHERE `uid` = ?'); |
575 | 575 | $result = $stmt->execute([$arguments['uid']]); |
576 | 576 | if ($result === null) { |
577 | - \OCP\Util::writeLog('core', __METHOD__. ', DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR); |
|
577 | + \OCP\Util::writeLog('core', __METHOD__.', DB error: '.\OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR); |
|
578 | 578 | } |
579 | - } catch(\Exception $e) { |
|
579 | + } catch (\Exception $e) { |
|
580 | 580 | \OC::$server->getLogger()->logException($e, [ |
581 | 581 | 'message' => __METHOD__, |
582 | 582 | 'level' => ILogger::ERROR, |
@@ -592,23 +592,23 @@ discard block |
||
592 | 592 | * @return boolean Returns false on error. |
593 | 593 | */ |
594 | 594 | public function purgeObjects(array $ids) { |
595 | - if(count($ids) === 0) { |
|
595 | + if (count($ids) === 0) { |
|
596 | 596 | // job done ;) |
597 | 597 | return true; |
598 | 598 | } |
599 | 599 | $updates = $ids; |
600 | 600 | try { |
601 | - $query = 'DELETE FROM `' . self::RELATION_TABLE . '` '; |
|
602 | - $query .= 'WHERE `objid` IN (' . str_repeat('?,', count($ids)-1) . '?) '; |
|
601 | + $query = 'DELETE FROM `'.self::RELATION_TABLE.'` '; |
|
602 | + $query .= 'WHERE `objid` IN ('.str_repeat('?,', count($ids) - 1).'?) '; |
|
603 | 603 | $query .= 'AND `type`= ?'; |
604 | 604 | $updates[] = $this->type; |
605 | 605 | $stmt = \OC_DB::prepare($query); |
606 | 606 | $result = $stmt->execute($updates); |
607 | 607 | if ($result === null) { |
608 | - \OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR); |
|
608 | + \OCP\Util::writeLog('core', __METHOD__.'DB error: '.\OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR); |
|
609 | 609 | return false; |
610 | 610 | } |
611 | - } catch(\Exception $e) { |
|
611 | + } catch (\Exception $e) { |
|
612 | 612 | \OC::$server->getLogger()->logException($e, [ |
613 | 613 | 'message' => __METHOD__, |
614 | 614 | 'level' => ILogger::ERROR, |
@@ -625,13 +625,13 @@ discard block |
||
625 | 625 | * @return array|false An array of object ids. |
626 | 626 | */ |
627 | 627 | public function getFavorites() { |
628 | - if(!$this->userHasTag(ITags::TAG_FAVORITE, $this->user)) { |
|
628 | + if (!$this->userHasTag(ITags::TAG_FAVORITE, $this->user)) { |
|
629 | 629 | return []; |
630 | 630 | } |
631 | 631 | |
632 | 632 | try { |
633 | 633 | return $this->getIdsForTag(ITags::TAG_FAVORITE); |
634 | - } catch(\Exception $e) { |
|
634 | + } catch (\Exception $e) { |
|
635 | 635 | \OC::$server->getLogger()->logException($e, [ |
636 | 636 | 'message' => __METHOD__, |
637 | 637 | 'level' => ILogger::ERROR, |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | * @return boolean |
649 | 649 | */ |
650 | 650 | public function addToFavorites($objid) { |
651 | - if(!$this->userHasTag(ITags::TAG_FAVORITE, $this->user)) { |
|
651 | + if (!$this->userHasTag(ITags::TAG_FAVORITE, $this->user)) { |
|
652 | 652 | $this->add(ITags::TAG_FAVORITE); |
653 | 653 | } |
654 | 654 | return $this->tagAs($objid, ITags::TAG_FAVORITE); |
@@ -672,16 +672,16 @@ discard block |
||
672 | 672 | * @return boolean Returns false on error. |
673 | 673 | */ |
674 | 674 | public function tagAs($objid, $tag) { |
675 | - if(is_string($tag) && !is_numeric($tag)) { |
|
675 | + if (is_string($tag) && !is_numeric($tag)) { |
|
676 | 676 | $tag = trim($tag); |
677 | - if($tag === '') { |
|
677 | + if ($tag === '') { |
|
678 | 678 | \OCP\Util::writeLog('core', __METHOD__.', Cannot add an empty tag', ILogger::DEBUG); |
679 | 679 | return false; |
680 | 680 | } |
681 | - if(!$this->hasTag($tag)) { |
|
681 | + if (!$this->hasTag($tag)) { |
|
682 | 682 | $this->add($tag); |
683 | 683 | } |
684 | - $tagId = $this->getTagId($tag); |
|
684 | + $tagId = $this->getTagId($tag); |
|
685 | 685 | } else { |
686 | 686 | $tagId = $tag; |
687 | 687 | } |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | 'categoryid' => $tagId, |
693 | 693 | 'type' => $this->type, |
694 | 694 | ]); |
695 | - } catch(\Exception $e) { |
|
695 | + } catch (\Exception $e) { |
|
696 | 696 | \OC::$server->getLogger()->logException($e, [ |
697 | 697 | 'message' => __METHOD__, |
698 | 698 | 'level' => ILogger::ERROR, |
@@ -711,23 +711,23 @@ discard block |
||
711 | 711 | * @return boolean |
712 | 712 | */ |
713 | 713 | public function unTag($objid, $tag) { |
714 | - if(is_string($tag) && !is_numeric($tag)) { |
|
714 | + if (is_string($tag) && !is_numeric($tag)) { |
|
715 | 715 | $tag = trim($tag); |
716 | - if($tag === '') { |
|
716 | + if ($tag === '') { |
|
717 | 717 | \OCP\Util::writeLog('core', __METHOD__.', Tag name is empty', ILogger::DEBUG); |
718 | 718 | return false; |
719 | 719 | } |
720 | - $tagId = $this->getTagId($tag); |
|
720 | + $tagId = $this->getTagId($tag); |
|
721 | 721 | } else { |
722 | 722 | $tagId = $tag; |
723 | 723 | } |
724 | 724 | |
725 | 725 | try { |
726 | - $sql = 'DELETE FROM `' . self::RELATION_TABLE . '` ' |
|
726 | + $sql = 'DELETE FROM `'.self::RELATION_TABLE.'` ' |
|
727 | 727 | . 'WHERE `objid` = ? AND `categoryid` = ? AND `type` = ?'; |
728 | 728 | $stmt = \OC_DB::prepare($sql); |
729 | 729 | $stmt->execute([$objid, $tagId, $this->type]); |
730 | - } catch(\Exception $e) { |
|
730 | + } catch (\Exception $e) { |
|
731 | 731 | \OC::$server->getLogger()->logException($e, [ |
732 | 732 | 'message' => __METHOD__, |
733 | 733 | 'level' => ILogger::ERROR, |
@@ -745,16 +745,16 @@ discard block |
||
745 | 745 | * @return bool Returns false on error |
746 | 746 | */ |
747 | 747 | public function delete($names) { |
748 | - if(!is_array($names)) { |
|
748 | + if (!is_array($names)) { |
|
749 | 749 | $names = [$names]; |
750 | 750 | } |
751 | 751 | |
752 | 752 | $names = array_map('trim', $names); |
753 | 753 | array_filter($names); |
754 | 754 | |
755 | - \OCP\Util::writeLog('core', __METHOD__ . ', before: ' |
|
755 | + \OCP\Util::writeLog('core', __METHOD__.', before: ' |
|
756 | 756 | . print_r($this->tags, true), ILogger::DEBUG); |
757 | - foreach($names as $name) { |
|
757 | + foreach ($names as $name) { |
|
758 | 758 | $id = null; |
759 | 759 | |
760 | 760 | if (is_numeric($name)) { |
@@ -768,22 +768,22 @@ discard block |
||
768 | 768 | unset($this->tags[$key]); |
769 | 769 | $this->mapper->delete($tag); |
770 | 770 | } else { |
771 | - \OCP\Util::writeLog('core', __METHOD__ . 'Cannot delete tag ' . $name |
|
771 | + \OCP\Util::writeLog('core', __METHOD__.'Cannot delete tag '.$name |
|
772 | 772 | . ': not found.', ILogger::ERROR); |
773 | 773 | } |
774 | - if(!is_null($id) && $id !== false) { |
|
774 | + if (!is_null($id) && $id !== false) { |
|
775 | 775 | try { |
776 | - $sql = 'DELETE FROM `' . self::RELATION_TABLE . '` ' |
|
776 | + $sql = 'DELETE FROM `'.self::RELATION_TABLE.'` ' |
|
777 | 777 | . 'WHERE `categoryid` = ?'; |
778 | 778 | $stmt = \OC_DB::prepare($sql); |
779 | 779 | $result = $stmt->execute([$id]); |
780 | 780 | if ($result === null) { |
781 | 781 | \OCP\Util::writeLog('core', |
782 | - __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), |
|
782 | + __METHOD__.'DB error: '.\OC::$server->getDatabaseConnection()->getError(), |
|
783 | 783 | ILogger::ERROR); |
784 | 784 | return false; |
785 | 785 | } |
786 | - } catch(\Exception $e) { |
|
786 | + } catch (\Exception $e) { |
|
787 | 787 | \OC::$server->getLogger()->logException($e, [ |
788 | 788 | 'message' => __METHOD__, |
789 | 789 | 'level' => ILogger::ERROR, |
@@ -797,12 +797,12 @@ discard block |
||
797 | 797 | } |
798 | 798 | |
799 | 799 | // case-insensitive array_search |
800 | - protected function array_searchi($needle, $haystack, $mem='getName') { |
|
801 | - if(!is_array($haystack)) { |
|
800 | + protected function array_searchi($needle, $haystack, $mem = 'getName') { |
|
801 | + if (!is_array($haystack)) { |
|
802 | 802 | return false; |
803 | 803 | } |
804 | 804 | return array_search(strtolower($needle), array_map( |
805 | - function ($tag) use ($mem) { |
|
805 | + function($tag) use ($mem) { |
|
806 | 806 | return strtolower(call_user_func([$tag, $mem])); |
807 | 807 | }, $haystack) |
808 | 808 | ); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $searchResult->markExactIdMatch($resultType); |
113 | 113 | } |
114 | 114 | $result['exact'][] = [ |
115 | - 'label' => $contact['FN'] . " ($cloudId)", |
|
115 | + 'label' => $contact['FN']." ($cloudId)", |
|
116 | 116 | 'uuid' => $contact['UID'], |
117 | 117 | 'name' => $contact['FN'], |
118 | 118 | 'type' => $cloudIdType, |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | ]; |
125 | 125 | } else { |
126 | 126 | $result['wide'][] = [ |
127 | - 'label' => $contact['FN'] . " ($cloudId)", |
|
127 | + 'label' => $contact['FN']." ($cloudId)", |
|
128 | 128 | 'uuid' => $contact['UID'], |
129 | 129 | 'name' => $contact['FN'], |
130 | 130 | 'type' => $cloudIdType, |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $localUser = $this->userManager->get($remoteUser); |
155 | 155 | if ($localUser === null || $search !== $localUser->getCloudId()) { |
156 | 156 | $result['exact'][] = [ |
157 | - 'label' => $remoteUser . " ($serverUrl)", |
|
157 | + 'label' => $remoteUser." ($serverUrl)", |
|
158 | 158 | 'uuid' => $remoteUser, |
159 | 159 | 'name' => $remoteUser, |
160 | 160 | 'value' => [ |
@@ -69,16 +69,16 @@ discard block |
||
69 | 69 | // yes - should be injected .... |
70 | 70 | $this->config = \OC::$server->getConfig(); |
71 | 71 | |
72 | - if(\OCP\Util::isIE()) { |
|
72 | + if (\OCP\Util::isIE()) { |
|
73 | 73 | \OC_Util::addStyle('ie'); |
74 | 74 | } |
75 | 75 | |
76 | 76 | // Decide which page we show |
77 | - if($renderAs === 'user') { |
|
77 | + if ($renderAs === 'user') { |
|
78 | 78 | parent::__construct('core', 'layout.user'); |
79 | - if(in_array(\OC_App::getCurrentApp(), ['settings','admin', 'help']) !== false) { |
|
79 | + if (in_array(\OC_App::getCurrentApp(), ['settings', 'admin', 'help']) !== false) { |
|
80 | 80 | $this->assign('bodyid', 'body-settings'); |
81 | - }else{ |
|
81 | + } else { |
|
82 | 82 | $this->assign('bodyid', 'body-user'); |
83 | 83 | } |
84 | 84 | |
@@ -89,14 +89,14 @@ discard block |
||
89 | 89 | $this->assign('navigation', $navigation); |
90 | 90 | $settingsNavigation = \OC::$server->getNavigationManager()->getAll('settings'); |
91 | 91 | $this->assign('settingsnavigation', $settingsNavigation); |
92 | - foreach($navigation as $entry) { |
|
92 | + foreach ($navigation as $entry) { |
|
93 | 93 | if ($entry['active']) { |
94 | 94 | $this->assign('application', $entry['name']); |
95 | 95 | break; |
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
99 | - foreach($settingsNavigation as $entry) { |
|
99 | + foreach ($settingsNavigation as $entry) { |
|
100 | 100 | if ($entry['active']) { |
101 | 101 | $this->assign('application', $entry['name']); |
102 | 102 | break; |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | $this->assign('language', $lang); |
162 | 162 | $this->assign('locale', $locale); |
163 | 163 | |
164 | - if(\OC::$server->getSystemConfig()->getValue('installed', false)) { |
|
164 | + if (\OC::$server->getSystemConfig()->getValue('installed', false)) { |
|
165 | 165 | if (empty(self::$versionHash)) { |
166 | 166 | $v = \OC_App::getAppVersions(); |
167 | 167 | $v['core'] = implode('.', \OCP\Util::getVersion()); |
@@ -193,10 +193,10 @@ discard block |
||
193 | 193 | $this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('core.OCJS.getConfig', ['v' => self::$versionHash])); |
194 | 194 | } |
195 | 195 | } |
196 | - foreach($jsFiles as $info) { |
|
196 | + foreach ($jsFiles as $info) { |
|
197 | 197 | $web = $info[1]; |
198 | 198 | $file = $info[2]; |
199 | - $this->append('jsfiles', $web.'/'.$file . $this->getVersionHashSuffix()); |
|
199 | + $this->append('jsfiles', $web.'/'.$file.$this->getVersionHashSuffix()); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | try { |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | |
208 | 208 | // Do not initialise scss appdata until we have a fully installed instance |
209 | 209 | // Do not load scss for update, errors, installation or login page |
210 | - if(\OC::$server->getSystemConfig()->getValue('installed', false) |
|
210 | + if (\OC::$server->getSystemConfig()->getValue('installed', false) |
|
211 | 211 | && !\OCP\Util::needUpgrade() |
212 | 212 | && $pathInfo !== '' |
213 | 213 | && !preg_match('/^\/login/', $pathInfo) |
@@ -224,19 +224,19 @@ discard block |
||
224 | 224 | $this->assign('cssfiles', []); |
225 | 225 | $this->assign('printcssfiles', []); |
226 | 226 | $this->assign('versionHash', self::$versionHash); |
227 | - foreach($cssFiles as $info) { |
|
227 | + foreach ($cssFiles as $info) { |
|
228 | 228 | $web = $info[1]; |
229 | 229 | $file = $info[2]; |
230 | 230 | |
231 | 231 | if (substr($file, -strlen('print.css')) === 'print.css') { |
232 | - $this->append('printcssfiles', $web.'/'.$file . $this->getVersionHashSuffix()); |
|
232 | + $this->append('printcssfiles', $web.'/'.$file.$this->getVersionHashSuffix()); |
|
233 | 233 | } else { |
234 | 234 | $suffix = $this->getVersionHashSuffix($web, $file); |
235 | 235 | |
236 | 236 | if (strpos($file, '?v=') == false) { |
237 | - $this->append('cssfiles', $web.'/'.$file . $suffix); |
|
237 | + $this->append('cssfiles', $web.'/'.$file.$suffix); |
|
238 | 238 | } else { |
239 | - $this->append('cssfiles', $web.'/'.$file . '-' . substr($suffix, 3)); |
|
239 | + $this->append('cssfiles', $web.'/'.$file.'-'.substr($suffix, 3)); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | } |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | |
263 | 263 | if ($this->config->getSystemValue('installed', false)) { |
264 | 264 | if (\OC::$server->getAppManager()->isInstalled('theming')) { |
265 | - $themingSuffix = '-' . $this->config->getAppValue('theming', 'cachebuster', '0'); |
|
265 | + $themingSuffix = '-'.$this->config->getAppValue('theming', 'cachebuster', '0'); |
|
266 | 266 | } |
267 | 267 | $v = \OC_App::getAppVersions(); |
268 | 268 | } |
@@ -270,21 +270,21 @@ discard block |
||
270 | 270 | // Try the webroot path for a match |
271 | 271 | if ($path !== false && $path !== '') { |
272 | 272 | $appName = $this->getAppNamefromPath($path); |
273 | - if(array_key_exists($appName, $v)) { |
|
273 | + if (array_key_exists($appName, $v)) { |
|
274 | 274 | $appVersion = $v[$appName]; |
275 | - return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix; |
|
275 | + return '?v='.substr(md5($appVersion), 0, 8).$themingSuffix; |
|
276 | 276 | } |
277 | 277 | } |
278 | 278 | // fallback to the file path instead |
279 | 279 | if ($file !== false && $file !== '') { |
280 | 280 | $appName = $this->getAppNamefromPath($file); |
281 | - if(array_key_exists($appName, $v)) { |
|
281 | + if (array_key_exists($appName, $v)) { |
|
282 | 282 | $appVersion = $v[$appName]; |
283 | - return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix; |
|
283 | + return '?v='.substr(md5($appVersion), 0, 8).$themingSuffix; |
|
284 | 284 | } |
285 | 285 | } |
286 | 286 | |
287 | - return '?v=' . self::$versionHash . $themingSuffix; |
|
287 | + return '?v='.self::$versionHash.$themingSuffix; |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | /** |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | // Read the selected theme from the config file |
296 | 296 | $theme = \OC_Util::getTheme(); |
297 | 297 | |
298 | - if($compileScss) { |
|
298 | + if ($compileScss) { |
|
299 | 299 | $SCSSCacher = \OC::$server->query(SCSSCacher::class); |
300 | 300 | } else { |
301 | 301 | $SCSSCacher = null; |
@@ -304,8 +304,8 @@ discard block |
||
304 | 304 | $locator = new \OC\Template\CSSResourceLocator( |
305 | 305 | \OC::$server->getLogger(), |
306 | 306 | $theme, |
307 | - [ \OC::$SERVERROOT => \OC::$WEBROOT ], |
|
308 | - [ \OC::$SERVERROOT => \OC::$WEBROOT ], |
|
307 | + [\OC::$SERVERROOT => \OC::$WEBROOT], |
|
308 | + [\OC::$SERVERROOT => \OC::$WEBROOT], |
|
309 | 309 | $SCSSCacher |
310 | 310 | ); |
311 | 311 | $locator->find($styles); |
@@ -340,8 +340,8 @@ discard block |
||
340 | 340 | $locator = new \OC\Template\JSResourceLocator( |
341 | 341 | \OC::$server->getLogger(), |
342 | 342 | $theme, |
343 | - [ \OC::$SERVERROOT => \OC::$WEBROOT ], |
|
344 | - [ \OC::$SERVERROOT => \OC::$WEBROOT ], |
|
343 | + [\OC::$SERVERROOT => \OC::$WEBROOT], |
|
344 | + [\OC::$SERVERROOT => \OC::$WEBROOT], |
|
345 | 345 | \OC::$server->query(JSCombiner::class) |
346 | 346 | ); |
347 | 347 | $locator->find($scripts); |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | */ |
357 | 357 | public static function convertToRelativePath($filePath) { |
358 | 358 | $relativePath = explode(\OC::$SERVERROOT, $filePath); |
359 | - if(count($relativePath) !== 2) { |
|
359 | + if (count($relativePath) !== 2) { |
|
360 | 360 | throw new \Exception('$filePath is not under the \OC::$SERVERROOT'); |
361 | 361 | } |
362 | 362 |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | return parent::connect(); |
65 | 65 | } catch (DBALException $e) { |
66 | 66 | // throw a new exception to prevent leaking info from the stacktrace |
67 | - throw new DBALException('Failed to connect to the database: ' . $e->getMessage(), $e->getCode()); |
|
67 | + throw new DBALException('Failed to connect to the database: '.$e->getMessage(), $e->getCode()); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | // 0 is the method where we use `getCallerBacktrace` |
117 | 117 | // 1 is the target method which uses the method we want to log |
118 | 118 | if (isset($traces[1])) { |
119 | - return $traces[1]['file'] . ':' . $traces[1]['line']; |
|
119 | + return $traces[1]['file'].':'.$traces[1]['line']; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | return ''; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @param int $offset |
161 | 161 | * @return \Doctrine\DBAL\Driver\Statement The prepared statement. |
162 | 162 | */ |
163 | - public function prepare($statement, $limit=null, $offset=null) { |
|
163 | + public function prepare($statement, $limit = null, $offset = null) { |
|
164 | 164 | if ($limit === -1) { |
165 | 165 | $limit = null; |
166 | 166 | } |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | $insertQb = $this->getQueryBuilder(); |
290 | 290 | $insertQb->insert($table) |
291 | 291 | ->values( |
292 | - array_map(function ($value) use ($insertQb) { |
|
292 | + array_map(function($value) use ($insertQb) { |
|
293 | 293 | return $insertQb->createNamedParameter($value, $this->getType($value)); |
294 | 294 | }, array_merge($keys, $values)) |
295 | 295 | ); |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | throw new \BadMethodCallException('Can not lock a new table until the previous lock is released.'); |
334 | 334 | } |
335 | 335 | |
336 | - $tableName = $this->tablePrefix . $tableName; |
|
336 | + $tableName = $this->tablePrefix.$tableName; |
|
337 | 337 | $this->lockedTable = $tableName; |
338 | 338 | $this->adapter->lockTable($tableName); |
339 | 339 | } |
@@ -354,11 +354,11 @@ discard block |
||
354 | 354 | * @return string |
355 | 355 | */ |
356 | 356 | public function getError() { |
357 | - $msg = $this->errorCode() . ': '; |
|
357 | + $msg = $this->errorCode().': '; |
|
358 | 358 | $errorInfo = $this->errorInfo(); |
359 | 359 | if (is_array($errorInfo)) { |
360 | - $msg .= 'SQLSTATE = '.$errorInfo[0] . ', '; |
|
361 | - $msg .= 'Driver Code = '.$errorInfo[1] . ', '; |
|
360 | + $msg .= 'SQLSTATE = '.$errorInfo[0].', '; |
|
361 | + $msg .= 'Driver Code = '.$errorInfo[1].', '; |
|
362 | 362 | $msg .= 'Driver Message = '.$errorInfo[2]; |
363 | 363 | } |
364 | 364 | return $msg; |
@@ -370,9 +370,9 @@ discard block |
||
370 | 370 | * @param string $table table name without the prefix |
371 | 371 | */ |
372 | 372 | public function dropTable($table) { |
373 | - $table = $this->tablePrefix . trim($table); |
|
373 | + $table = $this->tablePrefix.trim($table); |
|
374 | 374 | $schema = $this->getSchemaManager(); |
375 | - if($schema->tablesExist([$table])) { |
|
375 | + if ($schema->tablesExist([$table])) { |
|
376 | 376 | $schema->dropTable($table); |
377 | 377 | } |
378 | 378 | } |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | * @return bool |
385 | 385 | */ |
386 | 386 | public function tableExists($table) { |
387 | - $table = $this->tablePrefix . trim($table); |
|
387 | + $table = $this->tablePrefix.trim($table); |
|
388 | 388 | $schema = $this->getSchemaManager(); |
389 | 389 | return $schema->tablesExist([$table]); |
390 | 390 | } |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | /** |
44 | 44 | * @suppress SqlInjectionChecker |
45 | 45 | */ |
46 | - public function insertIgnoreConflict(string $table,array $values) : int { |
|
47 | - if($this->isPre9_5CompatMode() === true) { |
|
46 | + public function insertIgnoreConflict(string $table, array $values) : int { |
|
47 | + if ($this->isPre9_5CompatMode() === true) { |
|
48 | 48 | return parent::insertIgnoreConflict($table, $values); |
49 | 49 | } |
50 | 50 | |
@@ -55,12 +55,12 @@ discard block |
||
55 | 55 | foreach ($values as $key => $value) { |
56 | 56 | $builder->setValue($key, $builder->createNamedParameter($value)); |
57 | 57 | } |
58 | - $queryString = $builder->getSQL() . ' ON CONFLICT DO NOTHING'; |
|
58 | + $queryString = $builder->getSQL().' ON CONFLICT DO NOTHING'; |
|
59 | 59 | return $this->conn->executeUpdate($queryString, $builder->getParameters(), $builder->getParameterTypes()); |
60 | 60 | } |
61 | 61 | |
62 | 62 | protected function isPre9_5CompatMode(): bool { |
63 | - if($this->compatModePre9_5 !== null) { |
|
63 | + if ($this->compatModePre9_5 !== null) { |
|
64 | 64 | return $this->compatModePre9_5; |
65 | 65 | } |
66 | 66 |
@@ -68,14 +68,14 @@ |
||
68 | 68 | if (empty($compare)) { |
69 | 69 | $compare = array_keys($input); |
70 | 70 | } |
71 | - $fieldList = '`' . implode('`,`', array_keys($input)) . '`'; |
|
71 | + $fieldList = '`'.implode('`,`', array_keys($input)).'`'; |
|
72 | 72 | $query = "INSERT INTO `$table` ($fieldList) SELECT " |
73 | - . str_repeat('?,', count($input)-1).'? ' |
|
73 | + . str_repeat('?,', count($input) - 1).'? ' |
|
74 | 74 | . " WHERE NOT EXISTS (SELECT 1 FROM `$table` WHERE "; |
75 | 75 | |
76 | 76 | $inserts = array_values($input); |
77 | - foreach($compare as $key) { |
|
78 | - $query .= '`' . $key . '`'; |
|
77 | + foreach ($compare as $key) { |
|
78 | + $query .= '`'.$key.'`'; |
|
79 | 79 | if (is_null($input[$key])) { |
80 | 80 | $query .= ' IS NULL AND '; |
81 | 81 | } else { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | protected function getAppTemplateDirs($theme, $app, $serverRoot, $app_dir) { |
67 | 67 | // Check if the app is in the app folder or in the root |
68 | - if(file_exists($app_dir.'/templates/')) { |
|
68 | + if (file_exists($app_dir.'/templates/')) { |
|
69 | 69 | return [ |
70 | 70 | $serverRoot.'/themes/'.$theme.'/apps/'.$app.'/templates/', |
71 | 71 | $app_dir.'/templates/', |
@@ -115,11 +115,11 @@ discard block |
||
115 | 115 | * $_[$key][$position] in the template. |
116 | 116 | */ |
117 | 117 | public function append($key, $value) { |
118 | - if(array_key_exists($key, $this->vars)) { |
|
118 | + if (array_key_exists($key, $this->vars)) { |
|
119 | 119 | $this->vars[$key][] = $value; |
120 | 120 | } |
121 | - else{ |
|
122 | - $this->vars[$key] = [ $value ]; |
|
121 | + else { |
|
122 | + $this->vars[$key] = [$value]; |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
@@ -131,10 +131,10 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public function printPage() { |
133 | 133 | $data = $this->fetchPage(); |
134 | - if($data === false) { |
|
134 | + if ($data === false) { |
|
135 | 135 | return false; |
136 | 136 | } |
137 | - else{ |
|
137 | + else { |
|
138 | 138 | print $data; |
139 | 139 | return true; |
140 | 140 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $l = $this->l10n; |
168 | 168 | $theme = $this->theme; |
169 | 169 | |
170 | - if(!is_null($additionalParams)) { |
|
170 | + if (!is_null($additionalParams)) { |
|
171 | 171 | $_ = array_merge($additionalParams, $this->vars); |
172 | 172 | foreach ($_ as $var => $value) { |
173 | 173 | ${$var} = $value; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $this->config = $config; |
101 | 101 | |
102 | 102 | $this->excludedPaths[] = 'files_encryption'; |
103 | - $this->excludedPaths[] = 'appdata_' . $config->getSystemValue('instanceid', null); |
|
103 | + $this->excludedPaths[] = 'appdata_'.$config->getSystemValue('instanceid', null); |
|
104 | 104 | $this->excludedPaths[] = 'files_external'; |
105 | 105 | } |
106 | 106 | |
@@ -140,12 +140,12 @@ discard block |
||
140 | 140 | * @throws EncryptionHeaderKeyExistsException if header key is already in use |
141 | 141 | */ |
142 | 142 | public function createHeader(array $headerData, IEncryptionModule $encryptionModule) { |
143 | - $header = self::HEADER_START . ':' . self::HEADER_ENCRYPTION_MODULE_KEY . ':' . $encryptionModule->getId() . ':'; |
|
143 | + $header = self::HEADER_START.':'.self::HEADER_ENCRYPTION_MODULE_KEY.':'.$encryptionModule->getId().':'; |
|
144 | 144 | foreach ($headerData as $key => $value) { |
145 | 145 | if (in_array($key, $this->ocHeaderKeys)) { |
146 | 146 | throw new EncryptionHeaderKeyExistsException($key); |
147 | 147 | } |
148 | - $header .= $key . ':' . $value . ':'; |
|
148 | + $header .= $key.':'.$value.':'; |
|
149 | 149 | } |
150 | 150 | $header .= self::HEADER_END; |
151 | 151 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | if ($c->getType() === 'dir') { |
177 | 177 | $dirList[] = $c->getPath(); |
178 | 178 | } else { |
179 | - $result[] = $c->getPath(); |
|
179 | + $result[] = $c->getPath(); |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 | |
@@ -260,8 +260,8 @@ discard block |
||
260 | 260 | |
261 | 261 | // if path also contains a transaction id, we remove it too |
262 | 262 | $extension = pathinfo($fPath, PATHINFO_EXTENSION); |
263 | - if(substr($extension, 0, 12) === 'ocTransferId') { // 12 = strlen("ocTransferId") |
|
264 | - $newLength = strlen($fPath) - strlen($extension) -1; |
|
263 | + if (substr($extension, 0, 12) === 'ocTransferId') { // 12 = strlen("ocTransferId") |
|
264 | + $newLength = strlen($fPath) - strlen($extension) - 1; |
|
265 | 265 | $fPath = substr($fPath, 0, $newLength); |
266 | 266 | } |
267 | 267 | return $fPath; |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | $result = []; |
276 | 276 | if (in_array('all', $users)) { |
277 | 277 | $users = $this->userManager->search('', null, null); |
278 | - $result = array_map(function (IUser $user) { |
|
278 | + $result = array_map(function(IUser $user) { |
|
279 | 279 | return $user->getUID(); |
280 | 280 | }, $users); |
281 | 281 | } else { |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | if (\OCP\App::isEnabled("files_external")) { |
309 | 309 | $mounts = \OC_Mount_Config::getSystemMountPoints(); |
310 | 310 | foreach ($mounts as $mount) { |
311 | - if (strpos($path, '/files/' . $mount['mountpoint']) === 0) { |
|
311 | + if (strpos($path, '/files/'.$mount['mountpoint']) === 0) { |
|
312 | 312 | if ($this->isMountPointApplicableToUser($mount, $uid)) { |
313 | 313 | return true; |
314 | 314 | } |