@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | return parent::connect(); |
| 59 | 59 | } catch (DBALException $e) { |
| 60 | 60 | // throw a new exception to prevent leaking info from the stacktrace |
| 61 | - throw new DBALException('Failed to connect to the database: ' . $e->getMessage(), $e->getCode()); |
|
| 61 | + throw new DBALException('Failed to connect to the database: '.$e->getMessage(), $e->getCode()); |
|
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | // 0 is the method where we use `getCallerBacktrace` |
| 111 | 111 | // 1 is the target method which uses the method we want to log |
| 112 | 112 | if (isset($traces[1])) { |
| 113 | - return $traces[1]['file'] . ':' . $traces[1]['line']; |
|
| 113 | + return $traces[1]['file'].':'.$traces[1]['line']; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | return ''; |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | * @param int $offset |
| 157 | 157 | * @return \Doctrine\DBAL\Driver\Statement The prepared statement. |
| 158 | 158 | */ |
| 159 | - public function prepare( $statement, $limit=null, $offset=null ) { |
|
| 159 | + public function prepare($statement, $limit = null, $offset = null) { |
|
| 160 | 160 | if ($limit === -1) { |
| 161 | 161 | $limit = null; |
| 162 | 162 | } |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | throw new \BadMethodCallException('Can not lock a new table until the previous lock is released.'); |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | - $tableName = $this->tablePrefix . $tableName; |
|
| 324 | + $tableName = $this->tablePrefix.$tableName; |
|
| 325 | 325 | $this->lockedTable = $tableName; |
| 326 | 326 | $this->adapter->lockTable($tableName); |
| 327 | 327 | } |
@@ -342,11 +342,11 @@ discard block |
||
| 342 | 342 | * @return string |
| 343 | 343 | */ |
| 344 | 344 | public function getError() { |
| 345 | - $msg = $this->errorCode() . ': '; |
|
| 345 | + $msg = $this->errorCode().': '; |
|
| 346 | 346 | $errorInfo = $this->errorInfo(); |
| 347 | 347 | if (is_array($errorInfo)) { |
| 348 | - $msg .= 'SQLSTATE = '.$errorInfo[0] . ', '; |
|
| 349 | - $msg .= 'Driver Code = '.$errorInfo[1] . ', '; |
|
| 348 | + $msg .= 'SQLSTATE = '.$errorInfo[0].', '; |
|
| 349 | + $msg .= 'Driver Code = '.$errorInfo[1].', '; |
|
| 350 | 350 | $msg .= 'Driver Message = '.$errorInfo[2]; |
| 351 | 351 | } |
| 352 | 352 | return $msg; |
@@ -358,9 +358,9 @@ discard block |
||
| 358 | 358 | * @param string $table table name without the prefix |
| 359 | 359 | */ |
| 360 | 360 | public function dropTable($table) { |
| 361 | - $table = $this->tablePrefix . trim($table); |
|
| 361 | + $table = $this->tablePrefix.trim($table); |
|
| 362 | 362 | $schema = $this->getSchemaManager(); |
| 363 | - if($schema->tablesExist(array($table))) { |
|
| 363 | + if ($schema->tablesExist(array($table))) { |
|
| 364 | 364 | $schema->dropTable($table); |
| 365 | 365 | } |
| 366 | 366 | } |
@@ -371,8 +371,8 @@ discard block |
||
| 371 | 371 | * @param string $table table name without the prefix |
| 372 | 372 | * @return bool |
| 373 | 373 | */ |
| 374 | - public function tableExists($table){ |
|
| 375 | - $table = $this->tablePrefix . trim($table); |
|
| 374 | + public function tableExists($table) { |
|
| 375 | + $table = $this->tablePrefix.trim($table); |
|
| 376 | 376 | $schema = $this->getSchemaManager(); |
| 377 | 377 | return $schema->tablesExist(array($table)); |
| 378 | 378 | } |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | * @return string |
| 384 | 384 | */ |
| 385 | 385 | protected function replaceTablePrefix($statement) { |
| 386 | - return str_replace( '*PREFIX*', $this->tablePrefix, $statement ); |
|
| 386 | + return str_replace('*PREFIX*', $this->tablePrefix, $statement); |
|
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | /** |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | * @inheritdoc |
| 43 | 43 | */ |
| 44 | 44 | public function start($id, $description) { |
| 45 | - if ($this->activated){ |
|
| 45 | + if ($this->activated) { |
|
| 46 | 46 | $this->events[$id] = new Event($id, $description, microtime(true)); |
| 47 | 47 | } |
| 48 | 48 | } |
@@ -118,17 +118,17 @@ discard block |
||
| 118 | 118 | protected function attachListener($mount) { |
| 119 | 119 | $scanner = $mount->getStorage()->getScanner(); |
| 120 | 120 | $emitter = $this; |
| 121 | - $scanner->listen('\OC\Files\Cache\Scanner', 'scanFile', function ($path) use ($mount, $emitter) { |
|
| 122 | - $emitter->emit('\OC\Files\Utils\Scanner', 'scanFile', array($mount->getMountPoint() . $path)); |
|
| 121 | + $scanner->listen('\OC\Files\Cache\Scanner', 'scanFile', function($path) use ($mount, $emitter) { |
|
| 122 | + $emitter->emit('\OC\Files\Utils\Scanner', 'scanFile', array($mount->getMountPoint().$path)); |
|
| 123 | 123 | }); |
| 124 | - $scanner->listen('\OC\Files\Cache\Scanner', 'scanFolder', function ($path) use ($mount, $emitter) { |
|
| 125 | - $emitter->emit('\OC\Files\Utils\Scanner', 'scanFolder', array($mount->getMountPoint() . $path)); |
|
| 124 | + $scanner->listen('\OC\Files\Cache\Scanner', 'scanFolder', function($path) use ($mount, $emitter) { |
|
| 125 | + $emitter->emit('\OC\Files\Utils\Scanner', 'scanFolder', array($mount->getMountPoint().$path)); |
|
| 126 | 126 | }); |
| 127 | - $scanner->listen('\OC\Files\Cache\Scanner', 'postScanFile', function ($path) use ($mount, $emitter) { |
|
| 128 | - $emitter->emit('\OC\Files\Utils\Scanner', 'postScanFile', array($mount->getMountPoint() . $path)); |
|
| 127 | + $scanner->listen('\OC\Files\Cache\Scanner', 'postScanFile', function($path) use ($mount, $emitter) { |
|
| 128 | + $emitter->emit('\OC\Files\Utils\Scanner', 'postScanFile', array($mount->getMountPoint().$path)); |
|
| 129 | 129 | }); |
| 130 | - $scanner->listen('\OC\Files\Cache\Scanner', 'postScanFolder', function ($path) use ($mount, $emitter) { |
|
| 131 | - $emitter->emit('\OC\Files\Utils\Scanner', 'postScanFolder', array($mount->getMountPoint() . $path)); |
|
| 130 | + $scanner->listen('\OC\Files\Cache\Scanner', 'postScanFolder', function($path) use ($mount, $emitter) { |
|
| 131 | + $emitter->emit('\OC\Files\Utils\Scanner', 'postScanFolder', array($mount->getMountPoint().$path)); |
|
| 132 | 132 | }); |
| 133 | 133 | } |
| 134 | 134 | |
@@ -160,13 +160,13 @@ discard block |
||
| 160 | 160 | $scanner = $storage->getScanner(); |
| 161 | 161 | $this->attachListener($mount); |
| 162 | 162 | |
| 163 | - $scanner->listen('\OC\Files\Cache\Scanner', 'removeFromCache', function ($path) use ($storage) { |
|
| 163 | + $scanner->listen('\OC\Files\Cache\Scanner', 'removeFromCache', function($path) use ($storage) { |
|
| 164 | 164 | $this->triggerPropagator($storage, $path); |
| 165 | 165 | }); |
| 166 | - $scanner->listen('\OC\Files\Cache\Scanner', 'updateCache', function ($path) use ($storage) { |
|
| 166 | + $scanner->listen('\OC\Files\Cache\Scanner', 'updateCache', function($path) use ($storage) { |
|
| 167 | 167 | $this->triggerPropagator($storage, $path); |
| 168 | 168 | }); |
| 169 | - $scanner->listen('\OC\Files\Cache\Scanner', 'addToCache', function ($path) use ($storage) { |
|
| 169 | + $scanner->listen('\OC\Files\Cache\Scanner', 'addToCache', function($path) use ($storage) { |
|
| 170 | 170 | $this->triggerPropagator($storage, $path); |
| 171 | 171 | }); |
| 172 | 172 | |
@@ -219,13 +219,13 @@ discard block |
||
| 219 | 219 | $scanner->setUseTransactions(false); |
| 220 | 220 | $this->attachListener($mount); |
| 221 | 221 | |
| 222 | - $scanner->listen('\OC\Files\Cache\Scanner', 'removeFromCache', function ($path) use ($storage) { |
|
| 222 | + $scanner->listen('\OC\Files\Cache\Scanner', 'removeFromCache', function($path) use ($storage) { |
|
| 223 | 223 | $this->postProcessEntry($storage, $path); |
| 224 | 224 | }); |
| 225 | - $scanner->listen('\OC\Files\Cache\Scanner', 'updateCache', function ($path) use ($storage) { |
|
| 225 | + $scanner->listen('\OC\Files\Cache\Scanner', 'updateCache', function($path) use ($storage) { |
|
| 226 | 226 | $this->postProcessEntry($storage, $path); |
| 227 | 227 | }); |
| 228 | - $scanner->listen('\OC\Files\Cache\Scanner', 'addToCache', function ($path) use ($storage) { |
|
| 228 | + $scanner->listen('\OC\Files\Cache\Scanner', 'addToCache', function($path) use ($storage) { |
|
| 229 | 229 | $this->postProcessEntry($storage, $path); |
| 230 | 230 | }); |
| 231 | 231 | |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | } |
| 248 | 248 | $propagator->commitBatch(); |
| 249 | 249 | } catch (StorageNotAvailableException $e) { |
| 250 | - $this->logger->error('Storage ' . $storage->getId() . ' not available'); |
|
| 250 | + $this->logger->error('Storage '.$storage->getId().' not available'); |
|
| 251 | 251 | $this->logger->logException($e); |
| 252 | 252 | $this->emit('\OC\Files\Utils\Scanner', 'StorageNotAvailable', [$e]); |
| 253 | 253 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | * {@inheritDoc} |
| 28 | 28 | */ |
| 29 | 29 | public function getName() { |
| 30 | - return (string)$this->l10n->t('Social sharing bundle'); |
|
| 30 | + return (string) $this->l10n->t('Social sharing bundle'); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | protected function run($argument) { |
| 65 | - if($argument['retryNo'] === 5) { |
|
| 65 | + if ($argument['retryNo'] === 5) { |
|
| 66 | 66 | return; |
| 67 | 67 | } |
| 68 | 68 | |
@@ -132,7 +132,7 @@ |
||
| 132 | 132 | if (isset($jsonBlob['ncversion']) && $jsonBlob['ncversion'] === $this->getVersion()) { |
| 133 | 133 | |
| 134 | 134 | // If the timestamp is older than 300 seconds request the files new |
| 135 | - if ((int)$jsonBlob['timestamp'] > ($this->timeFactory->getTime() - self::INVALIDATE_AFTER_SECONDS)) { |
|
| 135 | + if ((int) $jsonBlob['timestamp'] > ($this->timeFactory->getTime() - self::INVALIDATE_AFTER_SECONDS)) { |
|
| 136 | 136 | return $jsonBlob['data']; |
| 137 | 137 | } |
| 138 | 138 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $ext = 'gif'; |
| 82 | 82 | break; |
| 83 | 83 | } |
| 84 | - $file = $folder->newFile('photo.' . $ext); |
|
| 84 | + $file = $folder->newFile('photo.'.$ext); |
|
| 85 | 85 | $file->putContent($data['body']); |
| 86 | 86 | } |
| 87 | 87 | } |
@@ -94,9 +94,9 @@ discard block |
||
| 94 | 94 | $ext = $this->getExtension($folder); |
| 95 | 95 | |
| 96 | 96 | if ($size === -1) { |
| 97 | - $path = 'photo.' . $ext; |
|
| 97 | + $path = 'photo.'.$ext; |
|
| 98 | 98 | } else { |
| 99 | - $path = 'photo.' . $size . '.' . $ext; |
|
| 99 | + $path = 'photo.'.$size.'.'.$ext; |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | try { |
@@ -108,14 +108,14 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | $photo = new \OC_Image(); |
| 110 | 110 | /** @var ISimpleFile $file */ |
| 111 | - $file = $folder->getFile('photo.' . $ext); |
|
| 111 | + $file = $folder->getFile('photo.'.$ext); |
|
| 112 | 112 | $photo->loadFromData($file->getContent()); |
| 113 | 113 | |
| 114 | 114 | $ratio = $photo->width() / $photo->height(); |
| 115 | 115 | if ($ratio < 1) { |
| 116 | - $ratio = 1/$ratio; |
|
| 116 | + $ratio = 1 / $ratio; |
|
| 117 | 117 | } |
| 118 | - $size = (int)($size * $ratio); |
|
| 118 | + $size = (int) ($size * $ratio); |
|
| 119 | 119 | |
| 120 | 120 | if ($size !== -1) { |
| 121 | 121 | $photo->resize($size); |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | * @return ISimpleFolder |
| 139 | 139 | */ |
| 140 | 140 | private function getFolder($addressBookId, $cardUri) { |
| 141 | - $hash = md5($addressBookId . ' ' . $cardUri); |
|
| 141 | + $hash = md5($addressBookId.' '.$cardUri); |
|
| 142 | 142 | try { |
| 143 | 143 | return $this->appData->getFolder($hash); |
| 144 | 144 | } catch (NotFoundException $e) { |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | 'image/gif', |
| 194 | 194 | ]; |
| 195 | 195 | |
| 196 | - if(!in_array($type, $allowedContentTypes, true)) { |
|
| 196 | + if (!in_array($type, $allowedContentTypes, true)) { |
|
| 197 | 197 | $type = 'application/octet-stream'; |
| 198 | 198 | } |
| 199 | 199 | |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | 'Content-Type' => $type, |
| 202 | 202 | 'body' => $val |
| 203 | 203 | ]; |
| 204 | - } catch(\Exception $ex) { |
|
| 204 | + } catch (\Exception $ex) { |
|
| 205 | 205 | |
| 206 | 206 | } |
| 207 | 207 | return false; |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | if (strpos($type, 'image/') === 0) { |
| 230 | 230 | return $type; |
| 231 | 231 | } else { |
| 232 | - return 'image/' . strtolower($type); |
|
| 232 | + return 'image/'.strtolower($type); |
|
| 233 | 233 | } |
| 234 | 234 | } |
| 235 | 235 | return ''; |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | return true; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - $size = isset($queryParams['size']) ? (int)$queryParams['size'] : -1; |
|
| 75 | + $size = isset($queryParams['size']) ? (int) $queryParams['size'] : -1; |
|
| 76 | 76 | |
| 77 | 77 | $path = $request->getPath(); |
| 78 | 78 | $node = $this->server->tree->getNodeForPath($path); |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $addressbook = $this->server->tree->getNodeForPath($addressbookpath); |
| 98 | 98 | |
| 99 | 99 | $response->setHeader('Cache-Control', 'private, max-age=3600, must-revalidate'); |
| 100 | - $response->setHeader('Etag', $node->getETag() ); |
|
| 100 | + $response->setHeader('Etag', $node->getETag()); |
|
| 101 | 101 | $response->setHeader('Pragma', 'public'); |
| 102 | 102 | |
| 103 | 103 | try { |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * @return mixed the value or $default |
| 86 | 86 | */ |
| 87 | 87 | public function getValue($key, $default = null) { |
| 88 | - $envValue = getenv(self::ENV_PREFIX . $key); |
|
| 88 | + $envValue = getenv(self::ENV_PREFIX.$key); |
|
| 89 | 89 | if ($envValue !== false) { |
| 90 | 90 | return $envValue; |
| 91 | 91 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | foreach ($configFiles as $file) { |
| 198 | 198 | $fileExistsAndIsReadable = file_exists($file) && is_readable($file); |
| 199 | 199 | $filePointer = $fileExistsAndIsReadable ? fopen($file, 'r') : false; |
| 200 | - if($file === $this->configFilePath && |
|
| 200 | + if ($file === $this->configFilePath && |
|
| 201 | 201 | $filePointer === false) { |
| 202 | 202 | // Opening the main config might not be possible, e.g. if the wrong |
| 203 | 203 | // permissions are set (likely on a new installation) |
@@ -205,13 +205,13 @@ discard block |
||
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | // Try to acquire a file lock |
| 208 | - if(!flock($filePointer, LOCK_SH)) { |
|
| 208 | + if (!flock($filePointer, LOCK_SH)) { |
|
| 209 | 209 | throw new \Exception(sprintf('Could not acquire a shared lock on the config file %s', $file)); |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | unset($CONFIG); |
| 213 | 213 | include $file; |
| 214 | - if(isset($CONFIG) && is_array($CONFIG)) { |
|
| 214 | + if (isset($CONFIG) && is_array($CONFIG)) { |
|
| 215 | 215 | $this->cache = array_merge($this->cache, $CONFIG); |
| 216 | 216 | } |
| 217 | 217 | |
@@ -236,29 +236,29 @@ discard block |
||
| 236 | 236 | $content .= var_export($this->cache, true); |
| 237 | 237 | $content .= ";\n"; |
| 238 | 238 | |
| 239 | - touch ($this->configFilePath); |
|
| 239 | + touch($this->configFilePath); |
|
| 240 | 240 | $filePointer = fopen($this->configFilePath, 'r+'); |
| 241 | 241 | |
| 242 | 242 | // Prevent others not to read the config |
| 243 | 243 | chmod($this->configFilePath, 0640); |
| 244 | 244 | |
| 245 | 245 | // File does not exist, this can happen when doing a fresh install |
| 246 | - if(!is_resource ($filePointer)) { |
|
| 246 | + if (!is_resource($filePointer)) { |
|
| 247 | 247 | // TODO fix this via DI once it is very clear that this doesn't cause side effects due to initialization order |
| 248 | 248 | // currently this breaks app routes but also could have other side effects especially during setup and exception handling |
| 249 | 249 | $url = \OC::$server->getURLGenerator()->linkToDocs('admin-dir_permissions'); |
| 250 | 250 | throw new HintException( |
| 251 | 251 | "Can't write into config directory!", |
| 252 | - 'This can usually be fixed by giving the webserver write access to the config directory. See ' . $url); |
|
| 252 | + 'This can usually be fixed by giving the webserver write access to the config directory. See '.$url); |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | // Try to acquire a file lock |
| 256 | - if(!flock($filePointer, LOCK_EX)) { |
|
| 256 | + if (!flock($filePointer, LOCK_EX)) { |
|
| 257 | 257 | throw new \Exception(sprintf('Could not acquire an exclusive lock on the config file %s', $this->configFilePath)); |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | // Write the config and release the lock |
| 261 | - ftruncate ($filePointer, 0); |
|
| 261 | + ftruncate($filePointer, 0); |
|
| 262 | 262 | fwrite($filePointer, $content); |
| 263 | 263 | fflush($filePointer); |
| 264 | 264 | flock($filePointer, LOCK_UN); |