@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | $select = self::createSelectStatement(self::FORMAT_NONE, $fileDependent); |
| 152 | 152 | |
| 153 | - $where .= ' `' . $column . '` = ? AND `item_type` = ? '; |
|
| 153 | + $where .= ' `'.$column.'` = ? AND `item_type` = ? '; |
|
| 154 | 154 | $arguments = [$itemSource, $itemType]; |
| 155 | 155 | // for link shares $user === null |
| 156 | 156 | if ($user !== null) { |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $arguments[] = $owner; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - $query = \OC_DB::prepare('SELECT ' . $select . ' FROM `*PREFIX*share` '. $fileDependentWhere . $where); |
|
| 171 | + $query = \OC_DB::prepare('SELECT '.$select.' FROM `*PREFIX*share` '.$fileDependentWhere.$where); |
|
| 172 | 172 | |
| 173 | 173 | $result = \OC_DB::executeAudited($query, $arguments); |
| 174 | 174 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | if ($fileDependent && !self::isFileReachable($row['path'], $row['storage_id'])) { |
| 177 | 177 | continue; |
| 178 | 178 | } |
| 179 | - if ($fileDependent && (int)$row['file_parent'] === -1) { |
|
| 179 | + if ($fileDependent && (int) $row['file_parent'] === -1) { |
|
| 180 | 180 | // if it is a mount point we need to get the path from the mount manager |
| 181 | 181 | $mountManager = \OC\Files\Filesystem::getMountManager(); |
| 182 | 182 | $mountPoint = $mountManager->findByStorageId($row['storage_id']); |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | $row['path'] = $path; |
| 188 | 188 | } else { |
| 189 | 189 | \OC::$server->getLogger()->warning( |
| 190 | - 'Could not resolve mount point for ' . $row['storage_id'], |
|
| 190 | + 'Could not resolve mount point for '.$row['storage_id'], |
|
| 191 | 191 | ['app' => 'OCP\Share'] |
| 192 | 192 | ); |
| 193 | 193 | } |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | if (!empty($groups)) { |
| 207 | - $where = $fileDependentWhere . ' WHERE `' . $column . '` = ? AND `item_type` = ? AND `share_with` in (?)'; |
|
| 207 | + $where = $fileDependentWhere.' WHERE `'.$column.'` = ? AND `item_type` = ? AND `share_with` in (?)'; |
|
| 208 | 208 | $arguments = [$itemSource, $itemType, $groups]; |
| 209 | 209 | $types = [null, null, IQueryBuilder::PARAM_STR_ARRAY]; |
| 210 | 210 | |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | // class isn't static anymore... |
| 219 | 219 | $conn = \OC::$server->getDatabaseConnection(); |
| 220 | 220 | $result = $conn->executeQuery( |
| 221 | - 'SELECT ' . $select . ' FROM `*PREFIX*share` ' . $where, |
|
| 221 | + 'SELECT '.$select.' FROM `*PREFIX*share` '.$where, |
|
| 222 | 222 | $arguments, |
| 223 | 223 | $types |
| 224 | 224 | ); |
@@ -285,12 +285,12 @@ discard block |
||
| 285 | 285 | $currentUser = $owner ? $owner : \OC_User::getUser(); |
| 286 | 286 | foreach ($items as $item) { |
| 287 | 287 | // delete the item with the expected share_type and owner |
| 288 | - if ((int)$item['share_type'] === (int)$shareType && $item['uid_owner'] === $currentUser) { |
|
| 288 | + if ((int) $item['share_type'] === (int) $shareType && $item['uid_owner'] === $currentUser) { |
|
| 289 | 289 | $toDelete = $item; |
| 290 | 290 | // if there is more then one result we don't have to delete the children |
| 291 | 291 | // but update their parent. For group shares the new parent should always be |
| 292 | 292 | // the original group share and not the db entry with the unique name |
| 293 | - } elseif ((int)$item['share_type'] === self::$shareTypeGroupUserUnique) { |
|
| 293 | + } elseif ((int) $item['share_type'] === self::$shareTypeGroupUserUnique) { |
|
| 294 | 294 | $newParent = $item['parent']; |
| 295 | 295 | } else { |
| 296 | 296 | $newParent = $item['id']; |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | * @return null |
| 348 | 348 | */ |
| 349 | 349 | protected static function unshareItem(array $item, $newParent = null) { |
| 350 | - $shareType = (int)$item['share_type']; |
|
| 350 | + $shareType = (int) $item['share_type']; |
|
| 351 | 351 | $shareWith = null; |
| 352 | 352 | if ($shareType !== IShare::TYPE_LINK) { |
| 353 | 353 | $shareWith = $item['share_with']; |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | $deletedShares[] = $hookParams; |
| 374 | 374 | $hookParams['deletedShares'] = $deletedShares; |
| 375 | 375 | \OC_Hook::emit(\OCP\Share::class, 'post_unshare', $hookParams); |
| 376 | - if ((int)$item['share_type'] === IShare::TYPE_REMOTE && \OC::$server->getUserSession()->getUser()) { |
|
| 376 | + if ((int) $item['share_type'] === IShare::TYPE_REMOTE && \OC::$server->getUserSession()->getUser()) { |
|
| 377 | 377 | list(, $remote) = Helper::splitUserRemote($item['share_with']); |
| 378 | 378 | self::sendRemoteUnshare($remote, $item['id'], $item['token']); |
| 379 | 379 | } |
@@ -628,7 +628,7 @@ discard block |
||
| 628 | 628 | $result = $query->execute($queryArgs); |
| 629 | 629 | if ($result === false) { |
| 630 | 630 | \OCP\Util::writeLog('OCP\Share', |
| 631 | - \OC_DB::getErrorMessage() . ', select=' . $select . ' where=', |
|
| 631 | + \OC_DB::getErrorMessage().', select='.$select.' where=', |
|
| 632 | 632 | ILogger::ERROR); |
| 633 | 633 | } |
| 634 | 634 | $items = []; |
@@ -670,14 +670,14 @@ discard block |
||
| 670 | 670 | } |
| 671 | 671 | // Switch ids if sharing permission is granted on only |
| 672 | 672 | // one share to ensure correct parent is used if resharing |
| 673 | - if (~(int)$items[$id]['permissions'] & \OCP\Constants::PERMISSION_SHARE |
|
| 674 | - && (int)$row['permissions'] & \OCP\Constants::PERMISSION_SHARE) { |
|
| 673 | + if (~(int) $items[$id]['permissions'] & \OCP\Constants::PERMISSION_SHARE |
|
| 674 | + && (int) $row['permissions'] & \OCP\Constants::PERMISSION_SHARE) { |
|
| 675 | 675 | $items[$row['id']] = $items[$id]; |
| 676 | 676 | $switchedItems[$id] = $row['id']; |
| 677 | 677 | unset($items[$id]); |
| 678 | 678 | $id = $row['id']; |
| 679 | 679 | } |
| 680 | - $items[$id]['permissions'] |= (int)$row['permissions']; |
|
| 680 | + $items[$id]['permissions'] |= (int) $row['permissions']; |
|
| 681 | 681 | } |
| 682 | 682 | continue; |
| 683 | 683 | } elseif (!empty($row['parent'])) { |
@@ -690,8 +690,8 @@ discard block |
||
| 690 | 690 | $query = \OC_DB::prepare('SELECT `file_target` FROM `*PREFIX*share` WHERE `id` = ?'); |
| 691 | 691 | $parentResult = $query->execute([$row['parent']]); |
| 692 | 692 | if ($result === false) { |
| 693 | - \OCP\Util::writeLog('OCP\Share', 'Can\'t select parent: ' . |
|
| 694 | - \OC_DB::getErrorMessage() . ', select=' . $select . ' where=' . $where, |
|
| 693 | + \OCP\Util::writeLog('OCP\Share', 'Can\'t select parent: '. |
|
| 694 | + \OC_DB::getErrorMessage().', select='.$select.' where='.$where, |
|
| 695 | 695 | ILogger::ERROR); |
| 696 | 696 | } else { |
| 697 | 697 | $parentRow = $parentResult->fetchRow(); |
@@ -701,7 +701,7 @@ discard block |
||
| 701 | 701 | $subPath = substr($row['path'], $pos); |
| 702 | 702 | $splitPath = explode('/', $subPath); |
| 703 | 703 | foreach (array_slice($splitPath, 2) as $pathPart) { |
| 704 | - $tmpPath = $tmpPath . '/' . $pathPart; |
|
| 704 | + $tmpPath = $tmpPath.'/'.$pathPart; |
|
| 705 | 705 | } |
| 706 | 706 | $row['path'] = $tmpPath; |
| 707 | 707 | } |
@@ -851,7 +851,7 @@ discard block |
||
| 851 | 851 | |
| 852 | 852 | // filter out invalid items, these can appear when subshare entries exist |
| 853 | 853 | // for a group in which the requested user isn't a member any more |
| 854 | - $items = array_filter($items, function ($item) { |
|
| 854 | + $items = array_filter($items, function($item) { |
|
| 855 | 855 | return $item['share_type'] !== self::$shareTypeGroupUserUnique; |
| 856 | 856 | }); |
| 857 | 857 | |
@@ -1009,7 +1009,7 @@ discard block |
||
| 1009 | 1009 | * @param array $parameters additional format parameters |
| 1010 | 1010 | * @return array format result |
| 1011 | 1011 | */ |
| 1012 | - private static function formatResult($items, $column, $backend, $format = self::FORMAT_NONE , $parameters = null) { |
|
| 1012 | + private static function formatResult($items, $column, $backend, $format = self::FORMAT_NONE, $parameters = null) { |
|
| 1013 | 1013 | if ($format === self::FORMAT_NONE) { |
| 1014 | 1014 | return $items; |
| 1015 | 1015 | } elseif ($format === self::FORMAT_STATUSES) { |
@@ -1066,13 +1066,13 @@ discard block |
||
| 1066 | 1066 | $try = 0; |
| 1067 | 1067 | $discoveryService = \OC::$server->query(\OCP\OCS\IDiscoveryService::class); |
| 1068 | 1068 | while ($result['success'] === false && $try < 2) { |
| 1069 | - $federationEndpoints = $discoveryService->discover($protocol . $remoteDomain, 'FEDERATED_SHARING'); |
|
| 1069 | + $federationEndpoints = $discoveryService->discover($protocol.$remoteDomain, 'FEDERATED_SHARING'); |
|
| 1070 | 1070 | $endpoint = isset($federationEndpoints['share']) ? $federationEndpoints['share'] : '/ocs/v2.php/cloud/shares'; |
| 1071 | 1071 | $client = \OC::$server->getHTTPClientService()->newClient(); |
| 1072 | 1072 | |
| 1073 | 1073 | try { |
| 1074 | 1074 | $response = $client->post( |
| 1075 | - $protocol . $remoteDomain . $endpoint . $urlSuffix . '?format=' . self::RESPONSE_FORMAT, |
|
| 1075 | + $protocol.$remoteDomain.$endpoint.$urlSuffix.'?format='.self::RESPONSE_FORMAT, |
|
| 1076 | 1076 | [ |
| 1077 | 1077 | 'body' => $fields, |
| 1078 | 1078 | 'connect_timeout' => 10, |
@@ -1113,7 +1113,7 @@ discard block |
||
| 1113 | 1113 | * @return int |
| 1114 | 1114 | */ |
| 1115 | 1115 | public static function getExpireInterval() { |
| 1116 | - return (int)\OC::$server->getConfig()->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
| 1116 | + return (int) \OC::$server->getConfig()->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
| 1117 | 1117 | } |
| 1118 | 1118 | |
| 1119 | 1119 | /** |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | return []; |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - usort($this->tags, function ($a, $b) { |
|
| 177 | + usort($this->tags, function($a, $b) { |
|
| 178 | 178 | return strnatcasecmp($a->getName(), $b->getName()); |
| 179 | 179 | }); |
| 180 | 180 | $tagMap = []; |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | */ |
| 197 | 197 | public function getTagsForUser($user) { |
| 198 | 198 | return array_filter($this->tags, |
| 199 | - function ($tag) use ($user) { |
|
| 199 | + function($tag) use ($user) { |
|
| 200 | 200 | return $tag->getOwner() === $user; |
| 201 | 201 | } |
| 202 | 202 | ); |
@@ -217,21 +217,21 @@ discard block |
||
| 217 | 217 | $chunks = array_chunk($objIds, 900, false); |
| 218 | 218 | foreach ($chunks as $chunk) { |
| 219 | 219 | $result = $conn->executeQuery( |
| 220 | - 'SELECT `category`, `categoryid`, `objid` ' . |
|
| 221 | - 'FROM `' . self::RELATION_TABLE . '` r, `' . self::TAG_TABLE . '` ' . |
|
| 220 | + 'SELECT `category`, `categoryid`, `objid` '. |
|
| 221 | + 'FROM `'.self::RELATION_TABLE.'` r, `'.self::TAG_TABLE.'` '. |
|
| 222 | 222 | 'WHERE `categoryid` = `id` AND `uid` = ? AND r.`type` = ? AND `objid` IN (?)', |
| 223 | 223 | [$this->user, $this->type, $chunk], |
| 224 | 224 | [null, null, IQueryBuilder::PARAM_INT_ARRAY] |
| 225 | 225 | ); |
| 226 | 226 | while ($row = $result->fetch()) { |
| 227 | - $objId = (int)$row['objid']; |
|
| 227 | + $objId = (int) $row['objid']; |
|
| 228 | 228 | if (!isset($entries[$objId])) { |
| 229 | 229 | $entries[$objId] = []; |
| 230 | 230 | } |
| 231 | 231 | $entries[$objId][] = $row['category']; |
| 232 | 232 | } |
| 233 | 233 | if ($result === null) { |
| 234 | - \OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR); |
|
| 234 | + \OCP\Util::writeLog('core', __METHOD__.'DB error: '.\OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR); |
|
| 235 | 235 | return false; |
| 236 | 236 | } |
| 237 | 237 | } |
@@ -278,14 +278,14 @@ discard block |
||
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | $ids = []; |
| 281 | - $sql = 'SELECT `objid` FROM `' . self::RELATION_TABLE |
|
| 281 | + $sql = 'SELECT `objid` FROM `'.self::RELATION_TABLE |
|
| 282 | 282 | . '` WHERE `categoryid` = ?'; |
| 283 | 283 | |
| 284 | 284 | try { |
| 285 | 285 | $stmt = \OC_DB::prepare($sql); |
| 286 | 286 | $result = $stmt->execute([$tagId]); |
| 287 | 287 | if ($result === null) { |
| 288 | - \OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR); |
|
| 288 | + \OCP\Util::writeLog('core', __METHOD__.'DB error: '.\OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR); |
|
| 289 | 289 | return false; |
| 290 | 290 | } |
| 291 | 291 | } catch (\Exception $e) { |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | |
| 300 | 300 | if (!is_null($result)) { |
| 301 | 301 | while ($row = $result->fetchRow()) { |
| 302 | - $ids[] = (int)$row['objid']; |
|
| 302 | + $ids[] = (int) $row['objid']; |
|
| 303 | 303 | } |
| 304 | 304 | } |
| 305 | 305 | |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | return false; |
| 344 | 344 | } |
| 345 | 345 | if ($this->userHasTag($name, $this->user)) { |
| 346 | - \OCP\Util::writeLog('core', __METHOD__.', name: ' . $name. ' exists already', ILogger::DEBUG); |
|
| 346 | + \OCP\Util::writeLog('core', __METHOD__.', name: '.$name.' exists already', ILogger::DEBUG); |
|
| 347 | 347 | return false; |
| 348 | 348 | } |
| 349 | 349 | try { |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | ]); |
| 359 | 359 | return false; |
| 360 | 360 | } |
| 361 | - \OCP\Util::writeLog('core', __METHOD__.', id: ' . $tag->getId(), ILogger::DEBUG); |
|
| 361 | + \OCP\Util::writeLog('core', __METHOD__.', id: '.$tag->getId(), ILogger::DEBUG); |
|
| 362 | 362 | return $tag->getId(); |
| 363 | 363 | } |
| 364 | 364 | |
@@ -384,13 +384,13 @@ discard block |
||
| 384 | 384 | $key = $this->getTagByName($from); |
| 385 | 385 | } |
| 386 | 386 | if ($key === false) { |
| 387 | - \OCP\Util::writeLog('core', __METHOD__.', tag: ' . $from. ' does not exist', ILogger::DEBUG); |
|
| 387 | + \OCP\Util::writeLog('core', __METHOD__.', tag: '.$from.' does not exist', ILogger::DEBUG); |
|
| 388 | 388 | return false; |
| 389 | 389 | } |
| 390 | 390 | $tag = $this->tags[$key]; |
| 391 | 391 | |
| 392 | 392 | if ($this->userHasTag($to, $tag->getOwner())) { |
| 393 | - \OCP\Util::writeLog('core', __METHOD__.', A tag named ' . $to. ' already exists for user ' . $tag->getOwner() . '.', ILogger::DEBUG); |
|
| 393 | + \OCP\Util::writeLog('core', __METHOD__.', A tag named '.$to.' already exists for user '.$tag->getOwner().'.', ILogger::DEBUG); |
|
| 394 | 394 | return false; |
| 395 | 395 | } |
| 396 | 396 | |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | * @param int|null $id int Optional object id to add to this|these tag(s) |
| 418 | 418 | * @return bool Returns false on error. |
| 419 | 419 | */ |
| 420 | - public function addMultiple($names, $sync=false, $id = null) { |
|
| 420 | + public function addMultiple($names, $sync = false, $id = null) { |
|
| 421 | 421 | if (!is_array($names)) { |
| 422 | 422 | $names = [$names]; |
| 423 | 423 | } |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | |
| 464 | 464 | // reload tags to get the proper ids. |
| 465 | 465 | $this->tags = $this->mapper->loadTags($this->owners, $this->type); |
| 466 | - \OCP\Util::writeLog('core', __METHOD__.', tags: ' . print_r($this->tags, true), |
|
| 466 | + \OCP\Util::writeLog('core', __METHOD__.', tags: '.print_r($this->tags, true), |
|
| 467 | 467 | ILogger::DEBUG); |
| 468 | 468 | // Loop through temporarily cached objectid/tagname pairs |
| 469 | 469 | // and save relations. |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | $dbConnection = \OC::$server->getDatabaseConnection(); |
| 474 | 474 | foreach (self::$relations as $relation) { |
| 475 | 475 | $tagId = $this->getTagId($relation['tag']); |
| 476 | - \OCP\Util::writeLog('core', __METHOD__ . 'catid, ' . $relation['tag'] . ' ' . $tagId, ILogger::DEBUG); |
|
| 476 | + \OCP\Util::writeLog('core', __METHOD__.'catid, '.$relation['tag'].' '.$tagId, ILogger::DEBUG); |
|
| 477 | 477 | if ($tagId) { |
| 478 | 478 | try { |
| 479 | 479 | $dbConnection->insertIfNotExist(self::RELATION_TABLE, |
@@ -509,11 +509,11 @@ discard block |
||
| 509 | 509 | // Find all objectid/tagId pairs. |
| 510 | 510 | $result = null; |
| 511 | 511 | try { |
| 512 | - $stmt = \OC_DB::prepare('SELECT `id` FROM `' . self::TAG_TABLE . '` ' |
|
| 512 | + $stmt = \OC_DB::prepare('SELECT `id` FROM `'.self::TAG_TABLE.'` ' |
|
| 513 | 513 | . 'WHERE `uid` = ?'); |
| 514 | 514 | $result = $stmt->execute([$arguments['uid']]); |
| 515 | 515 | if ($result === null) { |
| 516 | - \OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR); |
|
| 516 | + \OCP\Util::writeLog('core', __METHOD__.'DB error: '.\OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR); |
|
| 517 | 517 | } |
| 518 | 518 | } catch (\Exception $e) { |
| 519 | 519 | \OC::$server->getLogger()->logException($e, [ |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | |
| 526 | 526 | if (!is_null($result)) { |
| 527 | 527 | try { |
| 528 | - $stmt = \OC_DB::prepare('DELETE FROM `' . self::RELATION_TABLE . '` ' |
|
| 528 | + $stmt = \OC_DB::prepare('DELETE FROM `'.self::RELATION_TABLE.'` ' |
|
| 529 | 529 | . 'WHERE `categoryid` = ?'); |
| 530 | 530 | while ($row = $result->fetchRow()) { |
| 531 | 531 | try { |
@@ -547,11 +547,11 @@ discard block |
||
| 547 | 547 | } |
| 548 | 548 | } |
| 549 | 549 | try { |
| 550 | - $stmt = \OC_DB::prepare('DELETE FROM `' . self::TAG_TABLE . '` ' |
|
| 550 | + $stmt = \OC_DB::prepare('DELETE FROM `'.self::TAG_TABLE.'` ' |
|
| 551 | 551 | . 'WHERE `uid` = ?'); |
| 552 | 552 | $result = $stmt->execute([$arguments['uid']]); |
| 553 | 553 | if ($result === null) { |
| 554 | - \OCP\Util::writeLog('core', __METHOD__. ', DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR); |
|
| 554 | + \OCP\Util::writeLog('core', __METHOD__.', DB error: '.\OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR); |
|
| 555 | 555 | } |
| 556 | 556 | } catch (\Exception $e) { |
| 557 | 557 | \OC::$server->getLogger()->logException($e, [ |
@@ -575,14 +575,14 @@ discard block |
||
| 575 | 575 | } |
| 576 | 576 | $updates = $ids; |
| 577 | 577 | try { |
| 578 | - $query = 'DELETE FROM `' . self::RELATION_TABLE . '` '; |
|
| 579 | - $query .= 'WHERE `objid` IN (' . str_repeat('?,', count($ids)-1) . '?) '; |
|
| 578 | + $query = 'DELETE FROM `'.self::RELATION_TABLE.'` '; |
|
| 579 | + $query .= 'WHERE `objid` IN ('.str_repeat('?,', count($ids) - 1).'?) '; |
|
| 580 | 580 | $query .= 'AND `type`= ?'; |
| 581 | 581 | $updates[] = $this->type; |
| 582 | 582 | $stmt = \OC_DB::prepare($query); |
| 583 | 583 | $result = $stmt->execute($updates); |
| 584 | 584 | if ($result === null) { |
| 585 | - \OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR); |
|
| 585 | + \OCP\Util::writeLog('core', __METHOD__.'DB error: '.\OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR); |
|
| 586 | 586 | return false; |
| 587 | 587 | } |
| 588 | 588 | } catch (\Exception $e) { |
@@ -658,7 +658,7 @@ discard block |
||
| 658 | 658 | if (!$this->hasTag($tag)) { |
| 659 | 659 | $this->add($tag); |
| 660 | 660 | } |
| 661 | - $tagId = $this->getTagId($tag); |
|
| 661 | + $tagId = $this->getTagId($tag); |
|
| 662 | 662 | } else { |
| 663 | 663 | $tagId = $tag; |
| 664 | 664 | } |
@@ -694,13 +694,13 @@ discard block |
||
| 694 | 694 | \OCP\Util::writeLog('core', __METHOD__.', Tag name is empty', ILogger::DEBUG); |
| 695 | 695 | return false; |
| 696 | 696 | } |
| 697 | - $tagId = $this->getTagId($tag); |
|
| 697 | + $tagId = $this->getTagId($tag); |
|
| 698 | 698 | } else { |
| 699 | 699 | $tagId = $tag; |
| 700 | 700 | } |
| 701 | 701 | |
| 702 | 702 | try { |
| 703 | - $sql = 'DELETE FROM `' . self::RELATION_TABLE . '` ' |
|
| 703 | + $sql = 'DELETE FROM `'.self::RELATION_TABLE.'` ' |
|
| 704 | 704 | . 'WHERE `objid` = ? AND `categoryid` = ? AND `type` = ?'; |
| 705 | 705 | $stmt = \OC_DB::prepare($sql); |
| 706 | 706 | $stmt->execute([$objid, $tagId, $this->type]); |
@@ -729,7 +729,7 @@ discard block |
||
| 729 | 729 | $names = array_map('trim', $names); |
| 730 | 730 | array_filter($names); |
| 731 | 731 | |
| 732 | - \OCP\Util::writeLog('core', __METHOD__ . ', before: ' |
|
| 732 | + \OCP\Util::writeLog('core', __METHOD__.', before: ' |
|
| 733 | 733 | . print_r($this->tags, true), ILogger::DEBUG); |
| 734 | 734 | foreach ($names as $name) { |
| 735 | 735 | $id = null; |
@@ -745,18 +745,18 @@ discard block |
||
| 745 | 745 | unset($this->tags[$key]); |
| 746 | 746 | $this->mapper->delete($tag); |
| 747 | 747 | } else { |
| 748 | - \OCP\Util::writeLog('core', __METHOD__ . 'Cannot delete tag ' . $name |
|
| 748 | + \OCP\Util::writeLog('core', __METHOD__.'Cannot delete tag '.$name |
|
| 749 | 749 | . ': not found.', ILogger::ERROR); |
| 750 | 750 | } |
| 751 | 751 | if (!is_null($id) && $id !== false) { |
| 752 | 752 | try { |
| 753 | - $sql = 'DELETE FROM `' . self::RELATION_TABLE . '` ' |
|
| 753 | + $sql = 'DELETE FROM `'.self::RELATION_TABLE.'` ' |
|
| 754 | 754 | . 'WHERE `categoryid` = ?'; |
| 755 | 755 | $stmt = \OC_DB::prepare($sql); |
| 756 | 756 | $result = $stmt->execute([$id]); |
| 757 | 757 | if ($result === null) { |
| 758 | 758 | \OCP\Util::writeLog('core', |
| 759 | - __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), |
|
| 759 | + __METHOD__.'DB error: '.\OC::$server->getDatabaseConnection()->getError(), |
|
| 760 | 760 | ILogger::ERROR); |
| 761 | 761 | return false; |
| 762 | 762 | } |
@@ -774,12 +774,12 @@ discard block |
||
| 774 | 774 | } |
| 775 | 775 | |
| 776 | 776 | // case-insensitive array_search |
| 777 | - protected function array_searchi($needle, $haystack, $mem='getName') { |
|
| 777 | + protected function array_searchi($needle, $haystack, $mem = 'getName') { |
|
| 778 | 778 | if (!is_array($haystack)) { |
| 779 | 779 | return false; |
| 780 | 780 | } |
| 781 | 781 | return array_search(strtolower($needle), array_map( |
| 782 | - function ($tag) use ($mem) { |
|
| 782 | + function($tag) use ($mem) { |
|
| 783 | 783 | return strtolower(call_user_func([$tag, $mem])); |
| 784 | 784 | }, $haystack) |
| 785 | 785 | ); |