@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | $rootView = new View(); |
54 | 54 | $user = \OC::$server->getUserSession()->getUser(); |
55 | 55 | Filesystem::initMountPoints($user->getUID()); |
56 | - if (!$rootView->file_exists('/' . $user->getUID() . '/cache')) { |
|
57 | - $rootView->mkdir('/' . $user->getUID() . '/cache'); |
|
56 | + if (!$rootView->file_exists('/'.$user->getUID().'/cache')) { |
|
57 | + $rootView->mkdir('/'.$user->getUID().'/cache'); |
|
58 | 58 | } |
59 | - $this->storage = new View('/' . $user->getUID() . '/cache'); |
|
59 | + $this->storage = new View('/'.$user->getUID().'/cache'); |
|
60 | 60 | return $this->storage; |
61 | 61 | } else { |
62 | 62 | \OCP\Util::writeLog('core', 'Can\'t get cache storage, user not logged in', ILogger::ERROR); |
@@ -106,12 +106,12 @@ discard block |
||
106 | 106 | // unique id to avoid chunk collision, just in case |
107 | 107 | $uniqueId = \OC::$server->getSecureRandom()->generate( |
108 | 108 | 16, |
109 | - ISecureRandom::CHAR_DIGITS . ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER |
|
109 | + ISecureRandom::CHAR_DIGITS.ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_UPPER |
|
110 | 110 | ); |
111 | 111 | |
112 | 112 | // use part file to prevent hasKey() to find the key |
113 | 113 | // while it is being written |
114 | - $keyPart = $key . '.' . $uniqueId . '.part'; |
|
114 | + $keyPart = $key.'.'.$uniqueId.'.part'; |
|
115 | 115 | if ($storage and $storage->file_put_contents($keyPart, $value)) { |
116 | 116 | if ($ttl === 0) { |
117 | 117 | $ttl = 86400; // 60*60*24 |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | if (is_resource($dh)) { |
161 | 161 | while (($file = readdir($dh)) !== false) { |
162 | 162 | if ($file != '.' and $file != '..' and ($prefix === '' || strpos($file, $prefix) === 0)) { |
163 | - $storage->unlink('/' . $file); |
|
163 | + $storage->unlink('/'.$file); |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | } |
@@ -185,17 +185,17 @@ discard block |
||
185 | 185 | while (($file = readdir($dh)) !== false) { |
186 | 186 | if ($file != '.' and $file != '..') { |
187 | 187 | try { |
188 | - $mtime = $storage->filemtime('/' . $file); |
|
188 | + $mtime = $storage->filemtime('/'.$file); |
|
189 | 189 | if ($mtime < $now) { |
190 | - $storage->unlink('/' . $file); |
|
190 | + $storage->unlink('/'.$file); |
|
191 | 191 | } |
192 | 192 | } catch (\OCP\Lock\LockedException $e) { |
193 | 193 | // ignore locked chunks |
194 | - \OC::$server->getLogger()->debug('Could not cleanup locked chunk "' . $file . '"', array('app' => 'core')); |
|
194 | + \OC::$server->getLogger()->debug('Could not cleanup locked chunk "'.$file.'"', array('app' => 'core')); |
|
195 | 195 | } catch (\OCP\Files\ForbiddenException $e) { |
196 | - \OC::$server->getLogger()->debug('Could not cleanup forbidden chunk "' . $file . '"', array('app' => 'core')); |
|
196 | + \OC::$server->getLogger()->debug('Could not cleanup forbidden chunk "'.$file.'"', array('app' => 'core')); |
|
197 | 197 | } catch (\OCP\Files\LockNotAcquiredException $e) { |
198 | - \OC::$server->getLogger()->debug('Could not cleanup locked chunk "' . $file . '"', array('app' => 'core')); |
|
198 | + \OC::$server->getLogger()->debug('Could not cleanup locked chunk "'.$file.'"', array('app' => 'core')); |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 | } |
@@ -39,23 +39,23 @@ |
||
39 | 39 | /** |
40 | 40 | * @since 14.0.0 |
41 | 41 | */ |
42 | - const DEBUG=0; |
|
42 | + const DEBUG = 0; |
|
43 | 43 | /** |
44 | 44 | * @since 14.0.0 |
45 | 45 | */ |
46 | - const INFO=1; |
|
46 | + const INFO = 1; |
|
47 | 47 | /** |
48 | 48 | * @since 14.0.0 |
49 | 49 | */ |
50 | - const WARN=2; |
|
50 | + const WARN = 2; |
|
51 | 51 | /** |
52 | 52 | * @since 14.0.0 |
53 | 53 | */ |
54 | - const ERROR=3; |
|
54 | + const ERROR = 3; |
|
55 | 55 | /** |
56 | 56 | * @since 14.0.0 |
57 | 57 | */ |
58 | - const FATAL=4; |
|
58 | + const FATAL = 4; |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * System is unusable. |
@@ -39,5 +39,5 @@ |
||
39 | 39 | /** |
40 | 40 | * @since 14.0.0 |
41 | 41 | */ |
42 | - public function getEntries(int $limit=50, int $offset=0): array; |
|
42 | + public function getEntries(int $limit = 50, int $offset = 0): array; |
|
43 | 43 | } |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | protected function run($argument) { |
147 | 147 | $target = $argument['url']; |
148 | - $created = isset($argument['created']) ? (int)$argument['created'] : $this->timeFactory->getTime(); |
|
148 | + $created = isset($argument['created']) ? (int) $argument['created'] : $this->timeFactory->getTime(); |
|
149 | 149 | $currentTime = $this->timeFactory->getTime(); |
150 | 150 | $source = $this->urlGenerator->getAbsoluteURL('/'); |
151 | 151 | $source = rtrim($source, '/'); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $deadline = $currentTime - $this->maxLifespan; |
156 | 156 | if ($created < $deadline) { |
157 | 157 | $this->retainJob = false; |
158 | - $this->trustedServers->setServerStatus($target,TrustedServers::STATUS_FAILURE); |
|
158 | + $this->trustedServers->setServerStatus($target, TrustedServers::STATUS_FAILURE); |
|
159 | 159 | return; |
160 | 160 | } |
161 | 161 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $endPoint = isset($endPoints['shared-secret']) ? $endPoints['shared-secret'] : $this->defaultEndPoint; |
164 | 164 | |
165 | 165 | // make sure that we have a well formatted url |
166 | - $url = rtrim($target, '/') . '/' . trim($endPoint, '/'); |
|
166 | + $url = rtrim($target, '/').'/'.trim($endPoint, '/'); |
|
167 | 167 | |
168 | 168 | $result = null; |
169 | 169 | try { |
@@ -186,21 +186,21 @@ discard block |
||
186 | 186 | } catch (ClientException $e) { |
187 | 187 | $status = $e->getCode(); |
188 | 188 | if ($status === Http::STATUS_FORBIDDEN) { |
189 | - $this->logger->info($target . ' refused to exchange a shared secret with you.', ['app' => 'federation']); |
|
189 | + $this->logger->info($target.' refused to exchange a shared secret with you.', ['app' => 'federation']); |
|
190 | 190 | } else { |
191 | - $this->logger->info($target . ' responded with a ' . $status . ' containing: ' . $e->getMessage(), ['app' => 'federation']); |
|
191 | + $this->logger->info($target.' responded with a '.$status.' containing: '.$e->getMessage(), ['app' => 'federation']); |
|
192 | 192 | } |
193 | 193 | } catch (RequestException $e) { |
194 | 194 | $status = -1; // There is no status code if we could not connect |
195 | 195 | $this->logger->logException($e, [ |
196 | - 'message' => 'Could not connect to ' . $target, |
|
196 | + 'message' => 'Could not connect to '.$target, |
|
197 | 197 | 'level' => ILogger::INFO, |
198 | 198 | 'app' => 'federation', |
199 | 199 | ]); |
200 | 200 | } catch (RingException $e) { |
201 | 201 | $status = -1; // There is no status code if we could not connect |
202 | 202 | $this->logger->logException($e, [ |
203 | - 'message' => 'Could not connect to ' . $target, |
|
203 | + 'message' => 'Could not connect to '.$target, |
|
204 | 204 | 'level' => ILogger::INFO, |
205 | 205 | 'app' => 'federation', |
206 | 206 | ]); |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | ); |
228 | 228 | } else { |
229 | 229 | $this->logger->error( |
230 | - 'remote server "' . $target . '"" does not return a valid shared secret. Received data: ' . $body, |
|
230 | + 'remote server "'.$target.'"" does not return a valid shared secret. Received data: '.$body, |
|
231 | 231 | ['app' => 'federation'] |
232 | 232 | ); |
233 | 233 | $this->trustedServers->setServerStatus($target, TrustedServers::STATUS_FAILURE); |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | */ |
244 | 244 | protected function reAddJob(array $argument) { |
245 | 245 | $url = $argument['url']; |
246 | - $created = isset($argument['created']) ? (int)$argument['created'] : $this->timeFactory->getTime(); |
|
246 | + $created = isset($argument['created']) ? (int) $argument['created'] : $this->timeFactory->getTime(); |
|
247 | 247 | $token = $argument['token']; |
248 | 248 | $this->jobList->add( |
249 | 249 | GetSharedSecret::class, |
@@ -37,10 +37,10 @@ |
||
37 | 37 | |
38 | 38 | public function run($dummy) { |
39 | 39 | $systemConfig = \OC::$server->getSystemConfig(); |
40 | - $this->filePath = $systemConfig->getValue('logfile', $systemConfig->getValue('datadirectory', \OC::$SERVERROOT . '/data') . '/nextcloud.log'); |
|
40 | + $this->filePath = $systemConfig->getValue('logfile', $systemConfig->getValue('datadirectory', \OC::$SERVERROOT.'/data').'/nextcloud.log'); |
|
41 | 41 | |
42 | 42 | $this->maxSize = \OC::$server->getConfig()->getSystemValue('log_rotate_size', 100 * 1024 * 1024); |
43 | - if($this->shouldRotateBySize()) { |
|
43 | + if ($this->shouldRotateBySize()) { |
|
44 | 44 | $rotatedFile = $this->rotate(); |
45 | 45 | $msg = 'Log file "'.$this->filePath.'" was over '.$this->maxSize.' bytes, moved to "'.$rotatedFile.'"'; |
46 | 46 | \OC::$server->getLogger()->warning($msg, ['app' => Rotate::class]); |
@@ -59,9 +59,9 @@ |
||
59 | 59 | * @since 14.0.0 |
60 | 60 | */ |
61 | 61 | protected function shouldRotateBySize():bool { |
62 | - if ((int)$this->maxSize > 0) { |
|
62 | + if ((int) $this->maxSize > 0) { |
|
63 | 63 | $filesize = @filesize($this->filePath); |
64 | - if ($filesize >= (int)$this->maxSize) { |
|
64 | + if ($filesize >= (int) $this->maxSize) { |
|
65 | 65 | return true; |
66 | 66 | } |
67 | 67 | } |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | $c = $this->getContainer()->getServer(); |
66 | 66 | $config = $c->getConfig(); |
67 | 67 | |
68 | - $default = $config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/audit.log'; |
|
68 | + $default = $config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').'/audit.log'; |
|
69 | 69 | $logFile = $config->getAppValue('admin_audit', 'logfile', $default); |
70 | - if($logFile === null) { |
|
70 | + if ($logFile === null) { |
|
71 | 71 | $this->logger = $c->getLogger(); |
72 | 72 | return; |
73 | 73 | } |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | protected function userManagementHooks() { |
103 | 103 | $userActions = new UserManagement($this->logger); |
104 | 104 | |
105 | - Util::connectHook('OC_User', 'post_createUser', $userActions, 'create'); |
|
106 | - Util::connectHook('OC_User', 'post_deleteUser', $userActions, 'delete'); |
|
107 | - Util::connectHook('OC_User', 'changeUser', $userActions, 'change'); |
|
105 | + Util::connectHook('OC_User', 'post_createUser', $userActions, 'create'); |
|
106 | + Util::connectHook('OC_User', 'post_deleteUser', $userActions, 'delete'); |
|
107 | + Util::connectHook('OC_User', 'changeUser', $userActions, 'change'); |
|
108 | 108 | |
109 | 109 | /** @var IUserSession|Session $userSession */ |
110 | 110 | $userSession = $this->getContainer()->getServer()->getUserSession(); |
@@ -113,15 +113,15 @@ discard block |
||
113 | 113 | $userSession->listen('\OC\User', 'postUnassignedUserId', [$userActions, 'unassign']); |
114 | 114 | } |
115 | 115 | |
116 | - protected function groupHooks() { |
|
116 | + protected function groupHooks() { |
|
117 | 117 | $groupActions = new GroupManagement($this->logger); |
118 | 118 | |
119 | 119 | /** @var IGroupManager|Manager $groupManager */ |
120 | 120 | $groupManager = $this->getContainer()->getServer()->getGroupManager(); |
121 | - $groupManager->listen('\OC\Group', 'postRemoveUser', [$groupActions, 'removeUser']); |
|
122 | - $groupManager->listen('\OC\Group', 'postAddUser', [$groupActions, 'addUser']); |
|
123 | - $groupManager->listen('\OC\Group', 'postDelete', [$groupActions, 'deleteGroup']); |
|
124 | - $groupManager->listen('\OC\Group', 'postCreate', [$groupActions, 'createGroup']); |
|
121 | + $groupManager->listen('\OC\Group', 'postRemoveUser', [$groupActions, 'removeUser']); |
|
122 | + $groupManager->listen('\OC\Group', 'postAddUser', [$groupActions, 'addUser']); |
|
123 | + $groupManager->listen('\OC\Group', 'postDelete', [$groupActions, 'deleteGroup']); |
|
124 | + $groupManager->listen('\OC\Group', 'postCreate', [$groupActions, 'createGroup']); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | protected function sharingHooks() { |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | protected function versionsHooks() { |
235 | 235 | $versionsActions = new Versions($this->logger); |
236 | 236 | Util::connectHook('\OCP\Versions', 'rollback', $versionsActions, 'rollback'); |
237 | - Util::connectHook('\OCP\Versions', 'delete',$versionsActions, 'delete'); |
|
237 | + Util::connectHook('\OCP\Versions', 'delete', $versionsActions, 'delete'); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | protected function trashbinHooks() { |
@@ -30,22 +30,22 @@ |
||
30 | 30 | use RotationTrait; |
31 | 31 | |
32 | 32 | public function __construct() { |
33 | - $this->setInterval(60*60*3); |
|
33 | + $this->setInterval(60 * 60 * 3); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | protected function run($argument) { |
37 | 37 | $config = \OC::$server->getConfig(); |
38 | - $default = $config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/audit.log'; |
|
38 | + $default = $config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').'/audit.log'; |
|
39 | 39 | $this->filePath = $config->getAppValue('admin_audit', 'logfile', $default); |
40 | 40 | |
41 | - if($this->filePath === '') { |
|
41 | + if ($this->filePath === '') { |
|
42 | 42 | // default log file, nothing to do |
43 | 43 | return; |
44 | 44 | } |
45 | 45 | |
46 | 46 | $this->maxSize = $config->getSystemValue('log_rotate_size', 100 * 1024 * 1024); |
47 | 47 | |
48 | - if($this->shouldRotateBySize()) { |
|
48 | + if ($this->shouldRotateBySize()) { |
|
49 | 49 | $this->rotate(); |
50 | 50 | } |
51 | 51 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | private $mapper; |
37 | 37 | |
38 | 38 | public function __construct(ITimeFactory $timeFactory, DirectMapper $mapper) { |
39 | - $this->setInterval(60*60*24); |
|
39 | + $this->setInterval(60 * 60 * 24); |
|
40 | 40 | |
41 | 41 | $this->timeFactory = $timeFactory; |
42 | 42 | $this->mapper = $mapper; |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | protected function run($argument) { |
46 | 46 | // Delete all shares expired 24 hours ago |
47 | - $this->mapper->deleteExpired($this->timeFactory->getTime() - 60*60*24); |
|
47 | + $this->mapper->deleteExpired($this->timeFactory->getTime() - 60 * 60 * 24); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | } |