@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function check() { |
57 | 57 | // Look up the cache - it is invalidated all 30 minutes |
58 | - if (((int)$this->config->getAppValue('core', 'lastupdatedat') + 1800) > time()) { |
|
58 | + if (((int) $this->config->getAppValue('core', 'lastupdatedat') + 1800) > time()) { |
|
59 | 59 | return json_decode($this->config->getAppValue('core', 'lastupdateResult'), true); |
60 | 60 | } |
61 | 61 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $versionString = implode('x', $version); |
80 | 80 | |
81 | 81 | //fetch xml data from updater |
82 | - $url = $updaterUrl . '?version=' . $versionString; |
|
82 | + $url = $updaterUrl.'?version='.$versionString; |
|
83 | 83 | |
84 | 84 | $tmp = []; |
85 | 85 | try { |
@@ -93,11 +93,11 @@ discard block |
||
93 | 93 | $data = @simplexml_load_string($xml); |
94 | 94 | libxml_disable_entity_loader($loadEntities); |
95 | 95 | if ($data !== false) { |
96 | - $tmp['version'] = (string)$data->version; |
|
97 | - $tmp['versionstring'] = (string)$data->versionstring; |
|
98 | - $tmp['url'] = (string)$data->url; |
|
99 | - $tmp['web'] = (string)$data->web; |
|
100 | - $tmp['autoupdater'] = (string)$data->autoupdater; |
|
96 | + $tmp['version'] = (string) $data->version; |
|
97 | + $tmp['versionstring'] = (string) $data->versionstring; |
|
98 | + $tmp['url'] = (string) $data->url; |
|
99 | + $tmp['web'] = (string) $data->web; |
|
100 | + $tmp['autoupdater'] = (string) $data->autoupdater; |
|
101 | 101 | } else { |
102 | 102 | libxml_clear_errors(); |
103 | 103 | } |
@@ -33,10 +33,10 @@ |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | public function setupDatabase($username) { |
36 | - $datadir = $this->config->getValue('datadirectory', \OC::$SERVERROOT . '/data'); |
|
36 | + $datadir = $this->config->getValue('datadirectory', \OC::$SERVERROOT.'/data'); |
|
37 | 37 | |
38 | 38 | //delete the old sqlite database first, might cause infinte loops otherwise |
39 | - if(file_exists("$datadir/owncloud.db")) { |
|
39 | + if (file_exists("$datadir/owncloud.db")) { |
|
40 | 40 | unlink("$datadir/owncloud.db"); |
41 | 41 | } |
42 | 42 | //in case of sqlite, we can always fill the database |
@@ -57,9 +57,9 @@ |
||
57 | 57 | * @return false |
58 | 58 | */ |
59 | 59 | function httpGet(RequestInterface $request, ResponseInterface $response) { |
60 | - $string = 'This is the WebDAV interface. It can only be accessed by ' . |
|
60 | + $string = 'This is the WebDAV interface. It can only be accessed by '. |
|
61 | 61 | 'WebDAV clients such as the Nextcloud desktop sync client.'; |
62 | - $stream = fopen('php://memory','r+'); |
|
62 | + $stream = fopen('php://memory', 'r+'); |
|
63 | 63 | fwrite($stream, $string); |
64 | 64 | rewind($stream); |
65 | 65 |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | public function getPreview(File $file, $width = -1, $height = -1, $crop = false, $mode = IPreview::MODE_FILL, $mimeType = null) { |
89 | 89 | $this->eventDispatcher->dispatch( |
90 | 90 | IPreview::EVENT, |
91 | - new GenericEvent($file,[ |
|
91 | + new GenericEvent($file, [ |
|
92 | 92 | 'width' => $width, |
93 | 93 | 'height' => $height, |
94 | 94 | 'crop' => $crop, |
@@ -155,8 +155,8 @@ discard block |
||
155 | 155 | continue; |
156 | 156 | } |
157 | 157 | |
158 | - $maxWidth = (int)$this->config->getSystemValue('preview_max_x', 2048); |
|
159 | - $maxHeight = (int)$this->config->getSystemValue('preview_max_y', 2048); |
|
158 | + $maxWidth = (int) $this->config->getSystemValue('preview_max_x', 2048); |
|
159 | + $maxHeight = (int) $this->config->getSystemValue('preview_max_y', 2048); |
|
160 | 160 | |
161 | 161 | $preview = $this->helper->getThumbnail($provider, $file, $maxWidth, $maxHeight); |
162 | 162 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | continue; |
165 | 165 | } |
166 | 166 | |
167 | - $path = (string)$preview->width() . '-' . (string)$preview->height() . '-max.png'; |
|
167 | + $path = (string) $preview->width().'-'.(string) $preview->height().'-max.png'; |
|
168 | 168 | try { |
169 | 169 | $file = $previewFolder->newFile($path); |
170 | 170 | $file->putContent($preview->data()); |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | private function getPreviewSize(ISimpleFile $file) { |
187 | 187 | $size = explode('-', $file->getName()); |
188 | - return [(int)$size[0], (int)$size[1]]; |
|
188 | + return [(int) $size[0], (int) $size[1]]; |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | /** |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * @return string |
196 | 196 | */ |
197 | 197 | private function generatePath($width, $height, $crop) { |
198 | - $path = (string)$width . '-' . (string)$height; |
|
198 | + $path = (string) $width.'-'.(string) $height; |
|
199 | 199 | if ($crop) { |
200 | 200 | $path .= '-crop'; |
201 | 201 | } |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | $height /= $ratio; |
287 | 287 | } |
288 | 288 | |
289 | - return [(int)round($width), (int)round($height)]; |
|
289 | + return [(int) round($width), (int) round($height)]; |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | /** |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $tables = $this->getAllNonUTF8BinTables($this->connection); |
77 | 77 | foreach ($tables as $table) { |
78 | 78 | $output->info("Change row format for $table ..."); |
79 | - $query = $this->connection->prepare('ALTER TABLE `' . $table . '` ROW_FORMAT = DYNAMIC;'); |
|
79 | + $query = $this->connection->prepare('ALTER TABLE `'.$table.'` ROW_FORMAT = DYNAMIC;'); |
|
80 | 80 | try { |
81 | 81 | $query->execute(); |
82 | 82 | } catch (DriverException $e) { |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | $output->info("Change collation for $table ..."); |
91 | 91 | if ($characterSet === 'utf8mb4') { |
92 | 92 | // need to set row compression first |
93 | - $query = $this->connection->prepare('ALTER TABLE `' . $table . '` ROW_FORMAT=COMPRESSED;'); |
|
93 | + $query = $this->connection->prepare('ALTER TABLE `'.$table.'` ROW_FORMAT=COMPRESSED;'); |
|
94 | 94 | $query->execute(); |
95 | 95 | } |
96 | - $query = $this->connection->prepare('ALTER TABLE `' . $table . '` CONVERT TO CHARACTER SET ' . $characterSet . ' COLLATE ' . $characterSet . '_bin;'); |
|
96 | + $query = $this->connection->prepare('ALTER TABLE `'.$table.'` CONVERT TO CHARACTER SET '.$characterSet.' COLLATE '.$characterSet.'_bin;'); |
|
97 | 97 | try { |
98 | 98 | $query->execute(); |
99 | 99 | } catch (DriverException $e) { |
@@ -119,10 +119,10 @@ discard block |
||
119 | 119 | |
120 | 120 | // fetch tables by columns |
121 | 121 | $statement = $connection->executeQuery( |
122 | - "SELECT DISTINCT(TABLE_NAME) AS `table`" . |
|
123 | - " FROM INFORMATION_SCHEMA . COLUMNS" . |
|
124 | - " WHERE TABLE_SCHEMA = ?" . |
|
125 | - " AND (COLLATION_NAME <> '" . $characterSet . "_bin' OR CHARACTER_SET_NAME <> '" . $characterSet . "')" . |
|
122 | + "SELECT DISTINCT(TABLE_NAME) AS `table`". |
|
123 | + " FROM INFORMATION_SCHEMA . COLUMNS". |
|
124 | + " WHERE TABLE_SCHEMA = ?". |
|
125 | + " AND (COLLATION_NAME <> '".$characterSet."_bin' OR CHARACTER_SET_NAME <> '".$characterSet."')". |
|
126 | 126 | " AND TABLE_NAME LIKE \"*PREFIX*%\"", |
127 | 127 | array($dbName) |
128 | 128 | ); |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | |
135 | 135 | // fetch tables by collation |
136 | 136 | $statement = $connection->executeQuery( |
137 | - "SELECT DISTINCT(TABLE_NAME) AS `table`" . |
|
138 | - " FROM INFORMATION_SCHEMA . TABLES" . |
|
139 | - " WHERE TABLE_SCHEMA = ?" . |
|
140 | - " AND TABLE_COLLATION <> '" . $characterSet . "_bin'" . |
|
137 | + "SELECT DISTINCT(TABLE_NAME) AS `table`". |
|
138 | + " FROM INFORMATION_SCHEMA . TABLES". |
|
139 | + " WHERE TABLE_SCHEMA = ?". |
|
140 | + " AND TABLE_COLLATION <> '".$characterSet."_bin'". |
|
141 | 141 | " AND TABLE_NAME LIKE \"*PREFIX*%\"", |
142 | 142 | [$dbName] |
143 | 143 | ); |
@@ -253,10 +253,10 @@ discard block |
||
253 | 253 | */ |
254 | 254 | public function invalidateOldTokens() { |
255 | 255 | $olderThan = $this->time->getTime() - (int) $this->config->getSystemValue('session_lifetime', 60 * 60 * 24); |
256 | - $this->logger->debug('Invalidating session tokens older than ' . date('c', $olderThan), ['app' => 'cron']); |
|
256 | + $this->logger->debug('Invalidating session tokens older than '.date('c', $olderThan), ['app' => 'cron']); |
|
257 | 257 | $this->mapper->invalidateOld($olderThan, IToken::DO_NOT_REMEMBER); |
258 | 258 | $rememberThreshold = $this->time->getTime() - (int) $this->config->getSystemValue('remember_login_cookie_lifetime', 60 * 60 * 24 * 15); |
259 | - $this->logger->debug('Invalidating remembered session tokens older than ' . date('c', $rememberThreshold), ['app' => 'cron']); |
|
259 | + $this->logger->debug('Invalidating remembered session tokens older than '.date('c', $rememberThreshold), ['app' => 'cron']); |
|
260 | 260 | $this->mapper->invalidateOld($rememberThreshold, IToken::REMEMBER); |
261 | 261 | } |
262 | 262 | |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | */ |
267 | 267 | private function hashToken($token) { |
268 | 268 | $secret = $this->config->getSystemValue('secret'); |
269 | - return hash('sha512', $token . $secret); |
|
269 | + return hash('sha512', $token.$secret); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | /** |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | */ |
281 | 281 | private function encryptPassword($password, $token) { |
282 | 282 | $secret = $this->config->getSystemValue('secret'); |
283 | - return $this->crypto->encrypt($password, $token . $secret); |
|
283 | + return $this->crypto->encrypt($password, $token.$secret); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | private function decryptPassword($password, $token) { |
297 | 297 | $secret = $this->config->getSystemValue('secret'); |
298 | 298 | try { |
299 | - return $this->crypto->decrypt($password, $token . $secret); |
|
299 | + return $this->crypto->decrypt($password, $token.$secret); |
|
300 | 300 | } catch (Exception $ex) { |
301 | 301 | // Delete the invalid token |
302 | 302 | $this->invalidateToken($token); |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | $values = $this->appConfig->getValues(false, 'enabled'); |
107 | 107 | |
108 | 108 | $alwaysEnabledApps = $this->getAlwaysEnabledApps(); |
109 | - foreach($alwaysEnabledApps as $appId) { |
|
109 | + foreach ($alwaysEnabledApps as $appId) { |
|
110 | 110 | $values[$appId] = 'yes'; |
111 | 111 | } |
112 | 112 | |
113 | - $this->installedAppsCache = array_filter($values, function ($value) { |
|
113 | + $this->installedAppsCache = array_filter($values, function($value) { |
|
114 | 114 | return $value !== 'no'; |
115 | 115 | }); |
116 | 116 | ksort($this->installedAppsCache); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | public function getEnabledAppsForUser(IUser $user) { |
137 | 137 | $apps = $this->getInstalledAppsValues(); |
138 | - $appsForUser = array_filter($apps, function ($enabled) use ($user) { |
|
138 | + $appsForUser = array_filter($apps, function($enabled) use ($user) { |
|
139 | 139 | return $this->checkAppForUser($enabled, $user); |
140 | 140 | }); |
141 | 141 | return array_keys($appsForUser); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | } elseif ($user === null) { |
175 | 175 | return false; |
176 | 176 | } else { |
177 | - if(empty($enabled)){ |
|
177 | + if (empty($enabled)) { |
|
178 | 178 | return false; |
179 | 179 | } |
180 | 180 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | if (!is_array($groupIds)) { |
184 | 184 | $jsonError = json_last_error(); |
185 | - \OC::$server->getLogger()->warning('AppManger::checkAppForUser - can\'t decode group IDs: ' . print_r($enabled, true) . ' - json error code: ' . $jsonError, ['app' => 'lib']); |
|
185 | + \OC::$server->getLogger()->warning('AppManger::checkAppForUser - can\'t decode group IDs: '.print_r($enabled, true).' - json error code: '.$jsonError, ['app' => 'lib']); |
|
186 | 186 | return false; |
187 | 187 | } |
188 | 188 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | } |
257 | 257 | } |
258 | 258 | |
259 | - $groupIds = array_map(function ($group) { |
|
259 | + $groupIds = array_map(function($group) { |
|
260 | 260 | /** @var \OCP\IGroup $group */ |
261 | 261 | return $group->getGID(); |
262 | 262 | }, $groups); |
@@ -295,8 +295,8 @@ discard block |
||
295 | 295 | */ |
296 | 296 | public function getAppPath($appId) { |
297 | 297 | $appPath = \OC_App::getAppPath($appId); |
298 | - if($appPath === false) { |
|
299 | - throw new AppPathNotFoundException('Could not find path for ' . $appId); |
|
298 | + if ($appPath === false) { |
|
299 | + throw new AppPathNotFoundException('Could not find path for '.$appId); |
|
300 | 300 | } |
301 | 301 | return $appPath; |
302 | 302 | } |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | |
390 | 390 | private function loadShippedJson() { |
391 | 391 | if ($this->shippedApps === null) { |
392 | - $shippedJson = \OC::$SERVERROOT . '/core/shipped.json'; |
|
392 | + $shippedJson = \OC::$SERVERROOT.'/core/shipped.json'; |
|
393 | 393 | if (!file_exists($shippedJson)) { |
394 | 394 | throw new \Exception("File not found: $shippedJson"); |
395 | 395 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $shares = array_merge($shares, $this->shareManager->getSharedWith($user->getUID(), \OCP\Share::SHARE_TYPE_CIRCLE, null, -1)); |
75 | 75 | |
76 | 76 | // filter out excluded shares and group shares that includes self |
77 | - $shares = array_filter($shares, function (\OCP\Share\IShare $share) use ($user) { |
|
77 | + $shares = array_filter($shares, function(\OCP\Share\IShare $share) use ($user) { |
|
78 | 78 | return $share->getPermissions() > 0 && $share->getShareOwner() !== $user->getUID(); |
79 | 79 | }); |
80 | 80 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | // null groups which usually appear with group backend |
187 | 187 | // caching inconsistencies |
188 | 188 | $this->logger->debug( |
189 | - 'Could not adjust share target for share ' . $share->getId() . ' to make it consistent: ' . $e->getMessage(), |
|
189 | + 'Could not adjust share target for share '.$share->getId().' to make it consistent: '.$e->getMessage(), |
|
190 | 190 | ['app' => 'files_sharing'] |
191 | 191 | ); |
192 | 192 | } |
@@ -99,24 +99,24 @@ discard block |
||
99 | 99 | * Remove "apps/" from inclusion path for smooth migration to multi app dir |
100 | 100 | */ |
101 | 101 | if (strpos(\OC::$CLASSPATH[$class], 'apps/') === 0) { |
102 | - \OCP\Util::writeLog('core', 'include path for class "' . $class . '" starts with "apps/"', \OCP\Util::DEBUG); |
|
102 | + \OCP\Util::writeLog('core', 'include path for class "'.$class.'" starts with "apps/"', \OCP\Util::DEBUG); |
|
103 | 103 | $paths[] = str_replace('apps/', '', \OC::$CLASSPATH[$class]); |
104 | 104 | } |
105 | 105 | } elseif (strpos($class, 'OC_') === 0) { |
106 | - $paths[] = \OC::$SERVERROOT . '/lib/private/legacy/' . strtolower(str_replace('_', '/', substr($class, 3)) . '.php'); |
|
106 | + $paths[] = \OC::$SERVERROOT.'/lib/private/legacy/'.strtolower(str_replace('_', '/', substr($class, 3)).'.php'); |
|
107 | 107 | } elseif (strpos($class, 'OCA\\') === 0) { |
108 | 108 | list(, $app, $rest) = explode('\\', $class, 3); |
109 | 109 | $app = strtolower($app); |
110 | 110 | $appPath = \OC_App::getAppPath($app); |
111 | 111 | if ($appPath && stream_resolve_include_path($appPath)) { |
112 | - $paths[] = $appPath . '/' . strtolower(str_replace('\\', '/', $rest) . '.php'); |
|
112 | + $paths[] = $appPath.'/'.strtolower(str_replace('\\', '/', $rest).'.php'); |
|
113 | 113 | // If not found in the root of the app directory, insert '/lib' after app id and try again. |
114 | - $paths[] = $appPath . '/lib/' . strtolower(str_replace('\\', '/', $rest) . '.php'); |
|
114 | + $paths[] = $appPath.'/lib/'.strtolower(str_replace('\\', '/', $rest).'.php'); |
|
115 | 115 | } |
116 | 116 | } elseif ($class === 'Test\\TestCase') { |
117 | 117 | // This File is considered public API, so we make sure that the class |
118 | 118 | // can still be loaded, although the PSR-4 paths have not been loaded. |
119 | - $paths[] = \OC::$SERVERROOT . '/tests/lib/TestCase.php'; |
|
119 | + $paths[] = \OC::$SERVERROOT.'/tests/lib/TestCase.php'; |
|
120 | 120 | } |
121 | 121 | return $paths; |
122 | 122 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | protected function isValidPath($fullPath) { |
129 | 129 | foreach ($this->validRoots as $root => $true) { |
130 | - if (substr($fullPath, 0, strlen($root) + 1) === $root . '/') { |
|
130 | + if (substr($fullPath, 0, strlen($root) + 1) === $root.'/') { |
|
131 | 131 | return true; |
132 | 132 | } |
133 | 133 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | $pathsToRequire = $this->memoryCache->get($class); |
147 | 147 | } |
148 | 148 | |
149 | - if(class_exists($class, false)) { |
|
149 | + if (class_exists($class, false)) { |
|
150 | 150 | return false; |
151 | 151 | } |
152 | 152 |