@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $this->input = $input; |
136 | 136 | $this->output = $output; |
137 | 137 | |
138 | - $headline = 'Encrypt all files with the ' . Encryption::DISPLAY_NAME; |
|
138 | + $headline = 'Encrypt all files with the '.Encryption::DISPLAY_NAME; |
|
139 | 139 | $this->output->writeln("\n"); |
140 | 140 | $this->output->writeln($headline); |
141 | 141 | $this->output->writeln(str_pad('', strlen($headline), '=')); |
@@ -184,14 +184,14 @@ discard block |
||
184 | 184 | $progress->setFormat(" %message% \n [%bar%]"); |
185 | 185 | $progress->start(); |
186 | 186 | |
187 | - foreach($this->userManager->getBackends() as $backend) { |
|
187 | + foreach ($this->userManager->getBackends() as $backend) { |
|
188 | 188 | $limit = 500; |
189 | 189 | $offset = 0; |
190 | 190 | do { |
191 | 191 | $users = $backend->getUsers('', $limit, $offset); |
192 | 192 | foreach ($users as $user) { |
193 | 193 | if ($this->keyManager->userHasKeys($user) === false) { |
194 | - $progress->setMessage('Create key-pair for ' . $user); |
|
194 | + $progress->setMessage('Create key-pair for '.$user); |
|
195 | 195 | $progress->advance(); |
196 | 196 | $this->setupUserFS($user); |
197 | 197 | $password = $this->generateOneTimePassword($user); |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | } |
204 | 204 | } |
205 | 205 | $offset += $limit; |
206 | - } while(count($users) >= $limit); |
|
206 | + } while (count($users) >= $limit); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | $progress->setMessage('Key-pair created for all users'); |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | */ |
242 | 242 | protected function encryptAllUserFilesWithMasterKey(ProgressBar $progress) { |
243 | 243 | $userNo = 1; |
244 | - foreach($this->userManager->getBackends() as $backend) { |
|
244 | + foreach ($this->userManager->getBackends() as $backend) { |
|
245 | 245 | $limit = 500; |
246 | 246 | $offset = 0; |
247 | 247 | do { |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | $userNo++; |
253 | 253 | } |
254 | 254 | $offset += $limit; |
255 | - } while(count($users) >= $limit); |
|
255 | + } while (count($users) >= $limit); |
|
256 | 256 | } |
257 | 257 | } |
258 | 258 | |
@@ -267,19 +267,19 @@ discard block |
||
267 | 267 | |
268 | 268 | $this->setupUserFS($uid); |
269 | 269 | $directories = []; |
270 | - $directories[] = '/' . $uid . '/files'; |
|
270 | + $directories[] = '/'.$uid.'/files'; |
|
271 | 271 | |
272 | - while($root = array_pop($directories)) { |
|
272 | + while ($root = array_pop($directories)) { |
|
273 | 273 | $content = $this->rootView->getDirectoryContent($root); |
274 | 274 | foreach ($content as $file) { |
275 | - $path = $root . '/' . $file['name']; |
|
275 | + $path = $root.'/'.$file['name']; |
|
276 | 276 | if ($this->rootView->is_dir($path)) { |
277 | 277 | $directories[] = $path; |
278 | 278 | continue; |
279 | 279 | } else { |
280 | 280 | $progress->setMessage("encrypt files for user $userCount: $path"); |
281 | 281 | $progress->advance(); |
282 | - if($this->encryptFile($path) === false) { |
|
282 | + if ($this->encryptFile($path) === false) { |
|
283 | 283 | $progress->setMessage("encrypt files for user $userCount: $path (already encrypted)"); |
284 | 284 | $progress->advance(); |
285 | 285 | } |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | } |
304 | 304 | |
305 | 305 | $source = $path; |
306 | - $target = $path . '.encrypted.' . time(); |
|
306 | + $target = $path.'.encrypted.'.time(); |
|
307 | 307 | |
308 | 308 | try { |
309 | 309 | $this->rootView->copy($source, $target); |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | continue; |
426 | 426 | } |
427 | 427 | |
428 | - $subject = (string)$this->l->t('one-time password for server-side-encryption'); |
|
428 | + $subject = (string) $this->l->t('one-time password for server-side-encryption'); |
|
429 | 429 | list($htmlBody, $textBody) = $this->createMailBody($password); |
430 | 430 | |
431 | 431 | // send it out now |
@@ -74,36 +74,36 @@ discard block |
||
74 | 74 | public function adminRecovery($recoveryPassword, $confirmPassword, $adminEnableRecovery) { |
75 | 75 | // Check if both passwords are the same |
76 | 76 | if (empty($recoveryPassword)) { |
77 | - $errorMessage = (string)$this->l->t('Missing recovery key password'); |
|
77 | + $errorMessage = (string) $this->l->t('Missing recovery key password'); |
|
78 | 78 | return new DataResponse(['data' => ['message' => $errorMessage]], |
79 | 79 | Http::STATUS_BAD_REQUEST); |
80 | 80 | } |
81 | 81 | |
82 | 82 | if (empty($confirmPassword)) { |
83 | - $errorMessage = (string)$this->l->t('Please repeat the recovery key password'); |
|
83 | + $errorMessage = (string) $this->l->t('Please repeat the recovery key password'); |
|
84 | 84 | return new DataResponse(['data' => ['message' => $errorMessage]], |
85 | 85 | Http::STATUS_BAD_REQUEST); |
86 | 86 | } |
87 | 87 | |
88 | 88 | if ($recoveryPassword !== $confirmPassword) { |
89 | - $errorMessage = (string)$this->l->t('Repeated recovery key password does not match the provided recovery key password'); |
|
89 | + $errorMessage = (string) $this->l->t('Repeated recovery key password does not match the provided recovery key password'); |
|
90 | 90 | return new DataResponse(['data' => ['message' => $errorMessage]], |
91 | 91 | Http::STATUS_BAD_REQUEST); |
92 | 92 | } |
93 | 93 | |
94 | 94 | if (isset($adminEnableRecovery) && $adminEnableRecovery === '1') { |
95 | 95 | if ($this->recovery->enableAdminRecovery($recoveryPassword)) { |
96 | - return new DataResponse(['data' => ['message' => (string)$this->l->t('Recovery key successfully enabled')]]); |
|
96 | + return new DataResponse(['data' => ['message' => (string) $this->l->t('Recovery key successfully enabled')]]); |
|
97 | 97 | } |
98 | - return new DataResponse(['data' => ['message' => (string)$this->l->t('Could not enable recovery key. Please check your recovery key password!')]], Http::STATUS_BAD_REQUEST); |
|
98 | + return new DataResponse(['data' => ['message' => (string) $this->l->t('Could not enable recovery key. Please check your recovery key password!')]], Http::STATUS_BAD_REQUEST); |
|
99 | 99 | } elseif (isset($adminEnableRecovery) && $adminEnableRecovery === '0') { |
100 | 100 | if ($this->recovery->disableAdminRecovery($recoveryPassword)) { |
101 | - return new DataResponse(['data' => ['message' => (string)$this->l->t('Recovery key successfully disabled')]]); |
|
101 | + return new DataResponse(['data' => ['message' => (string) $this->l->t('Recovery key successfully disabled')]]); |
|
102 | 102 | } |
103 | - return new DataResponse(['data' => ['message' => (string)$this->l->t('Could not disable recovery key. Please check your recovery key password!')]], Http::STATUS_BAD_REQUEST); |
|
103 | + return new DataResponse(['data' => ['message' => (string) $this->l->t('Could not disable recovery key. Please check your recovery key password!')]], Http::STATUS_BAD_REQUEST); |
|
104 | 104 | } |
105 | 105 | // this response should never be sent but just in case. |
106 | - return new DataResponse(['data' => ['message' => (string)$this->l->t('Missing parameters')]], Http::STATUS_BAD_REQUEST); |
|
106 | + return new DataResponse(['data' => ['message' => (string) $this->l->t('Missing parameters')]], Http::STATUS_BAD_REQUEST); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -115,22 +115,22 @@ discard block |
||
115 | 115 | public function changeRecoveryPassword($newPassword, $oldPassword, $confirmPassword) { |
116 | 116 | //check if both passwords are the same |
117 | 117 | if (empty($oldPassword)) { |
118 | - $errorMessage = (string)$this->l->t('Please provide the old recovery password'); |
|
118 | + $errorMessage = (string) $this->l->t('Please provide the old recovery password'); |
|
119 | 119 | return new DataResponse(['data' => ['message' => $errorMessage]], Http::STATUS_BAD_REQUEST); |
120 | 120 | } |
121 | 121 | |
122 | 122 | if (empty($newPassword)) { |
123 | - $errorMessage = (string)$this->l->t('Please provide a new recovery password'); |
|
123 | + $errorMessage = (string) $this->l->t('Please provide a new recovery password'); |
|
124 | 124 | return new DataResponse(['data' => ['message' => $errorMessage]], Http::STATUS_BAD_REQUEST); |
125 | 125 | } |
126 | 126 | |
127 | 127 | if (empty($confirmPassword)) { |
128 | - $errorMessage = (string)$this->l->t('Please repeat the new recovery password'); |
|
128 | + $errorMessage = (string) $this->l->t('Please repeat the new recovery password'); |
|
129 | 129 | return new DataResponse(['data' => ['message' => $errorMessage]], Http::STATUS_BAD_REQUEST); |
130 | 130 | } |
131 | 131 | |
132 | 132 | if ($newPassword !== $confirmPassword) { |
133 | - $errorMessage = (string)$this->l->t('Repeated recovery key password does not match the provided recovery key password'); |
|
133 | + $errorMessage = (string) $this->l->t('Repeated recovery key password does not match the provided recovery key password'); |
|
134 | 134 | return new DataResponse(['data' => ['message' => $errorMessage]], Http::STATUS_BAD_REQUEST); |
135 | 135 | } |
136 | 136 | |
@@ -141,14 +141,14 @@ discard block |
||
141 | 141 | return new DataResponse( |
142 | 142 | [ |
143 | 143 | 'data' => [ |
144 | - 'message' => (string)$this->l->t('Password successfully changed.')] |
|
144 | + 'message' => (string) $this->l->t('Password successfully changed.')] |
|
145 | 145 | ] |
146 | 146 | ); |
147 | 147 | } |
148 | 148 | return new DataResponse( |
149 | 149 | [ |
150 | 150 | 'data' => [ |
151 | - 'message' => (string)$this->l->t('Could not change the password. Maybe the old password was not correct.') |
|
151 | + 'message' => (string) $this->l->t('Could not change the password. Maybe the old password was not correct.') |
|
152 | 152 | ] |
153 | 153 | ], Http::STATUS_BAD_REQUEST); |
154 | 154 | } |
@@ -169,14 +169,14 @@ discard block |
||
169 | 169 | return new DataResponse( |
170 | 170 | [ |
171 | 171 | 'data' => [ |
172 | - 'message' => (string)$this->l->t('Recovery Key disabled')] |
|
172 | + 'message' => (string) $this->l->t('Recovery Key disabled')] |
|
173 | 173 | ] |
174 | 174 | ); |
175 | 175 | } |
176 | 176 | return new DataResponse( |
177 | 177 | [ |
178 | 178 | 'data' => [ |
179 | - 'message' => (string)$this->l->t('Recovery Key enabled')] |
|
179 | + 'message' => (string) $this->l->t('Recovery Key enabled')] |
|
180 | 180 | ] |
181 | 181 | ); |
182 | 182 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | return new DataResponse( |
186 | 186 | [ |
187 | 187 | 'data' => [ |
188 | - 'message' => (string)$this->l->t('Could not enable the recovery key, please try again or contact your administrator') |
|
188 | + 'message' => (string) $this->l->t('Could not enable the recovery key, please try again or contact your administrator') |
|
189 | 189 | ] |
190 | 190 | ], Http::STATUS_BAD_REQUEST); |
191 | 191 | } |
@@ -70,28 +70,28 @@ |
||
70 | 70 | |
71 | 71 | $status = 'error'; |
72 | 72 | $message = 'no valid init status'; |
73 | - switch($this->session->getStatus()) { |
|
73 | + switch ($this->session->getStatus()) { |
|
74 | 74 | case Session::INIT_EXECUTED: |
75 | 75 | $status = 'interactionNeeded'; |
76 | - $message = (string)$this->l->t( |
|
76 | + $message = (string) $this->l->t( |
|
77 | 77 | 'Invalid private key for encryption app. Please update your private key password in your personal settings to recover access to your encrypted files.' |
78 | 78 | ); |
79 | 79 | break; |
80 | 80 | case Session::NOT_INITIALIZED: |
81 | 81 | $status = 'interactionNeeded'; |
82 | 82 | if ($this->encryptionManager->isEnabled()) { |
83 | - $message = (string)$this->l->t( |
|
83 | + $message = (string) $this->l->t( |
|
84 | 84 | 'Encryption App is enabled, but your keys are not initialized. Please log-out and log-in again.' |
85 | 85 | ); |
86 | 86 | } else { |
87 | - $message = (string)$this->l->t( |
|
87 | + $message = (string) $this->l->t( |
|
88 | 88 | 'Please enable server side encryption in the admin settings in order to use the encryption module.' |
89 | 89 | ); |
90 | 90 | } |
91 | 91 | break; |
92 | 92 | case Session::INIT_SUCCESSFUL: |
93 | 93 | $status = 'success'; |
94 | - $message = (string)$this->l->t('Encryption app is enabled and ready'); |
|
94 | + $message = (string) $this->l->t('Encryption app is enabled and ready'); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | return new DataResponse( |
@@ -57,15 +57,15 @@ discard block |
||
57 | 57 | $comment = $event->getComment(); |
58 | 58 | |
59 | 59 | $mentions = $this->extractMentions($comment->getMentions()); |
60 | - if(empty($mentions)) { |
|
60 | + if (empty($mentions)) { |
|
61 | 61 | // no one to notify |
62 | 62 | return; |
63 | 63 | } |
64 | 64 | |
65 | 65 | $notification = $this->instantiateNotification($comment); |
66 | 66 | |
67 | - foreach($mentions as $uid) { |
|
68 | - if(($comment->getActorType() === 'users' && $uid === $comment->getActorId()) |
|
67 | + foreach ($mentions as $uid) { |
|
68 | + if (($comment->getActorType() === 'users' && $uid === $comment->getActorId()) |
|
69 | 69 | || !$this->userManager->userExists($uid) |
70 | 70 | ) { |
71 | 71 | // do not notify unknown users or yourself |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | $notification->setUser($uid); |
76 | - if($event->getEvent() === CommentsEvent::EVENT_DELETE |
|
76 | + if ($event->getEvent() === CommentsEvent::EVENT_DELETE |
|
77 | 77 | || $event->getEvent() === CommentsEvent::EVENT_PRE_UPDATE) |
78 | 78 | { |
79 | 79 | $this->notificationManager->markProcessed($notification); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $notification |
95 | 95 | ->setApp('comments') |
96 | 96 | ->setObject('comment', $comment->getId()) |
97 | - ->setSubject('mention', [ $comment->getObjectType(), $comment->getObjectId() ]) |
|
97 | + ->setSubject('mention', [$comment->getObjectType(), $comment->getObjectId()]) |
|
98 | 98 | ->setDateTime($comment->getCreationDateTime()); |
99 | 99 | |
100 | 100 | return $notification; |
@@ -107,12 +107,12 @@ discard block |
||
107 | 107 | * @return string[] containing the mentions, e.g. ['alice', 'bob'] |
108 | 108 | */ |
109 | 109 | public function extractMentions(array $mentions) { |
110 | - if(empty($mentions)) { |
|
110 | + if (empty($mentions)) { |
|
111 | 111 | return []; |
112 | 112 | } |
113 | 113 | $uids = []; |
114 | - foreach($mentions as $mention) { |
|
115 | - if($mention['type'] === 'user') { |
|
114 | + foreach ($mentions as $mention) { |
|
115 | + if ($mention['type'] === 'user') { |
|
116 | 116 | $uids[] = $mention['id']; |
117 | 117 | } |
118 | 118 | } |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | * @param CommentsEvent $event |
50 | 50 | */ |
51 | 51 | public function handle(CommentsEvent $event) { |
52 | - if($event->getComment()->getObjectType() !== 'files') { |
|
52 | + if ($event->getComment()->getObjectType() !== 'files') { |
|
53 | 53 | // this is a 'files'-specific Handler |
54 | 54 | return; |
55 | 55 | } |
56 | 56 | |
57 | 57 | $eventType = $event->getEvent(); |
58 | - if($eventType === CommentsEvent::EVENT_ADD |
|
58 | + if ($eventType === CommentsEvent::EVENT_ADD |
|
59 | 59 | ) { |
60 | 60 | $this->notificationHandler($event); |
61 | 61 | $this->activityHandler($event); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | CommentsEvent::EVENT_UPDATE, |
68 | 68 | CommentsEvent::EVENT_DELETE, |
69 | 69 | ]; |
70 | - if(in_array($eventType, $applicableEvents)) { |
|
70 | + if (in_array($eventType, $applicableEvents)) { |
|
71 | 71 | $this->notificationHandler($event); |
72 | 72 | return; |
73 | 73 | } |
@@ -194,7 +194,7 @@ |
||
194 | 194 | $httpClient = $this->clientService->newClient(); |
195 | 195 | |
196 | 196 | try { |
197 | - $response = $httpClient->post($remote . '/index.php/apps/federatedfilesharing/createFederatedShare', |
|
197 | + $response = $httpClient->post($remote.'/index.php/apps/federatedfilesharing/createFederatedShare', |
|
198 | 198 | [ |
199 | 199 | 'body' => |
200 | 200 | [ |
@@ -150,37 +150,37 @@ discard block |
||
150 | 150 | } |
151 | 151 | |
152 | 152 | public function getImprintUrl() { |
153 | - return (string)$this->config->getAppValue('theming', 'imprintUrl', ''); |
|
153 | + return (string) $this->config->getAppValue('theming', 'imprintUrl', ''); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | public function getPrivacyUrl() { |
157 | - return (string)$this->config->getAppValue('theming', 'privacyUrl', ''); |
|
157 | + return (string) $this->config->getAppValue('theming', 'privacyUrl', ''); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | public function getShortFooter() { |
161 | 161 | $slogan = $this->getSlogan(); |
162 | 162 | $baseUrl = $this->getBaseUrl(); |
163 | 163 | if ($baseUrl !== '') { |
164 | - $footer = '<a href="' . $baseUrl . '" target="_blank"' . |
|
165 | - ' rel="noreferrer noopener" class="entity-name">' . $this->getEntity() . '</a>'; |
|
164 | + $footer = '<a href="'.$baseUrl.'" target="_blank"'. |
|
165 | + ' rel="noreferrer noopener" class="entity-name">'.$this->getEntity().'</a>'; |
|
166 | 166 | } else { |
167 | - $footer = '<span class="entity-name">' .$this->getEntity() . '</span>'; |
|
167 | + $footer = '<span class="entity-name">'.$this->getEntity().'</span>'; |
|
168 | 168 | } |
169 | - $footer .= ($slogan !== '' ? ' – ' . $slogan : ''); |
|
169 | + $footer .= ($slogan !== '' ? ' – '.$slogan : ''); |
|
170 | 170 | |
171 | 171 | $links = [ |
172 | 172 | [ |
173 | 173 | 'text' => $this->l->t('Legal notice'), |
174 | - 'url' => (string)$this->getImprintUrl() |
|
174 | + 'url' => (string) $this->getImprintUrl() |
|
175 | 175 | ], |
176 | 176 | [ |
177 | 177 | 'text' => $this->l->t('Privacy policy'), |
178 | - 'url' => (string)$this->getPrivacyUrl() |
|
178 | + 'url' => (string) $this->getPrivacyUrl() |
|
179 | 179 | ], |
180 | 180 | ]; |
181 | 181 | |
182 | 182 | $navigation = $this->navigationManager->getAll(INavigationManager::TYPE_GUEST); |
183 | - $guestNavigation = array_map(function ($nav) { |
|
183 | + $guestNavigation = array_map(function($nav) { |
|
184 | 184 | return [ |
185 | 185 | 'text' => $nav['name'], |
186 | 186 | 'url' => $nav['href'] |
@@ -189,17 +189,17 @@ discard block |
||
189 | 189 | $links = array_merge($links, $guestNavigation); |
190 | 190 | |
191 | 191 | $legalLinks = ''; $divider = ''; |
192 | - foreach($links as $link) { |
|
193 | - if($link['url'] !== '' |
|
192 | + foreach ($links as $link) { |
|
193 | + if ($link['url'] !== '' |
|
194 | 194 | && filter_var($link['url'], FILTER_VALIDATE_URL) |
195 | 195 | ) { |
196 | - $legalLinks .= $divider . '<a href="' . $link['url'] . '" class="legal" target="_blank"' . |
|
197 | - ' rel="noreferrer noopener">' . $link['text'] . '</a>'; |
|
196 | + $legalLinks .= $divider.'<a href="'.$link['url'].'" class="legal" target="_blank"'. |
|
197 | + ' rel="noreferrer noopener">'.$link['text'].'</a>'; |
|
198 | 198 | $divider = ' · '; |
199 | 199 | } |
200 | 200 | } |
201 | - if($legalLinks !== '') { |
|
202 | - $footer .= '<br/>' . $legalLinks; |
|
201 | + if ($legalLinks !== '') { |
|
202 | + $footer .= '<br/>'.$legalLinks; |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | return $footer; |
@@ -232,16 +232,16 @@ discard block |
||
232 | 232 | |
233 | 233 | $cacheBusterCounter = $this->config->getAppValue('theming', 'cachebuster', '0'); |
234 | 234 | |
235 | - if(!$logo || !$logoExists) { |
|
236 | - if($useSvg) { |
|
235 | + if (!$logo || !$logoExists) { |
|
236 | + if ($useSvg) { |
|
237 | 237 | $logo = $this->urlGenerator->imagePath('core', 'logo/logo.svg'); |
238 | 238 | } else { |
239 | 239 | $logo = $this->urlGenerator->imagePath('core', 'logo/logo.png'); |
240 | 240 | } |
241 | - return $logo . '?v=' . $cacheBusterCounter; |
|
241 | + return $logo.'?v='.$cacheBusterCounter; |
|
242 | 242 | } |
243 | 243 | |
244 | - return $this->urlGenerator->linkToRoute('theming.Theming.getImage', [ 'key' => 'logo', 'useSvg' => $useSvg, 'v' => $cacheBusterCounter ]); |
|
244 | + return $this->urlGenerator->linkToRoute('theming.Theming.getImage', ['key' => 'logo', 'useSvg' => $useSvg, 'v' => $cacheBusterCounter]); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | /** |
@@ -279,17 +279,17 @@ discard block |
||
279 | 279 | * @return array scss variables to overwrite |
280 | 280 | */ |
281 | 281 | public function getScssVariables() { |
282 | - $cache = $this->cacheFactory->createDistributed('theming-' . $this->urlGenerator->getBaseUrl()); |
|
282 | + $cache = $this->cacheFactory->createDistributed('theming-'.$this->urlGenerator->getBaseUrl()); |
|
283 | 283 | if ($value = $cache->get('getScssVariables')) { |
284 | 284 | return $value; |
285 | 285 | } |
286 | 286 | |
287 | 287 | $variables = [ |
288 | - 'theming-cachebuster' => "'" . $this->config->getAppValue('theming', 'cachebuster', '0') . "'", |
|
289 | - 'theming-logo-mime' => "'" . $this->config->getAppValue('theming', 'logoMime') . "'", |
|
290 | - 'theming-background-mime' => "'" . $this->config->getAppValue('theming', 'backgroundMime') . "'", |
|
291 | - 'theming-logoheader-mime' => "'" . $this->config->getAppValue('theming', 'logoheaderMime') . "'", |
|
292 | - 'theming-favicon-mime' => "'" . $this->config->getAppValue('theming', 'faviconMime') . "'" |
|
288 | + 'theming-cachebuster' => "'".$this->config->getAppValue('theming', 'cachebuster', '0')."'", |
|
289 | + 'theming-logo-mime' => "'".$this->config->getAppValue('theming', 'logoMime')."'", |
|
290 | + 'theming-background-mime' => "'".$this->config->getAppValue('theming', 'backgroundMime')."'", |
|
291 | + 'theming-logoheader-mime' => "'".$this->config->getAppValue('theming', 'logoheaderMime')."'", |
|
292 | + 'theming-favicon-mime' => "'".$this->config->getAppValue('theming', 'faviconMime')."'" |
|
293 | 293 | ]; |
294 | 294 | |
295 | 295 | $variables['image-logo'] = "url('".$this->imageManager->getImageUrl('logo')."')"; |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | } |
310 | 310 | |
311 | 311 | $variables['has-legal-links'] = 'false'; |
312 | - if($this->getImprintUrl() !== '' || $this->getPrivacyUrl() !== '') { |
|
312 | + if ($this->getImprintUrl() !== '' || $this->getPrivacyUrl() !== '') { |
|
313 | 313 | $variables['has-legal-links'] = 'true'; |
314 | 314 | } |
315 | 315 | |
@@ -347,18 +347,18 @@ discard block |
||
347 | 347 | if ($image === 'manifest.json') { |
348 | 348 | try { |
349 | 349 | $appPath = $this->appManager->getAppPath($app); |
350 | - if (file_exists($appPath . '/img/manifest.json')) { |
|
350 | + if (file_exists($appPath.'/img/manifest.json')) { |
|
351 | 351 | return false; |
352 | 352 | } |
353 | 353 | } catch (AppPathNotFoundException $e) {} |
354 | 354 | $route = $this->urlGenerator->linkToRoute('theming.Theming.getManifest'); |
355 | 355 | } |
356 | - if (strpos($image, 'filetypes/') === 0 && file_exists(\OC::$SERVERROOT . '/core/img/' . $image)) { |
|
356 | + if (strpos($image, 'filetypes/') === 0 && file_exists(\OC::$SERVERROOT.'/core/img/'.$image)) { |
|
357 | 357 | $route = $this->urlGenerator->linkToRoute('theming.Icon.getThemedIcon', ['app' => $app, 'image' => $image]); |
358 | 358 | } |
359 | 359 | |
360 | 360 | if ($route) { |
361 | - return $route . '?v=' . $cacheBusterValue; |
|
361 | + return $route.'?v='.$cacheBusterValue; |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | return false; |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | */ |
370 | 370 | private function increaseCacheBuster() { |
371 | 371 | $cacheBusterKey = $this->config->getAppValue('theming', 'cachebuster', '0'); |
372 | - $this->config->setAppValue('theming', 'cachebuster', (int)$cacheBusterKey+1); |
|
372 | + $this->config->setAppValue('theming', 'cachebuster', (int) $cacheBusterKey + 1); |
|
373 | 373 | $this->cacheFactory->createDistributed('theming-')->clear(); |
374 | 374 | $this->cacheFactory->createDistributed('imagePath')->clear(); |
375 | 375 |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | |
59 | 59 | class Storage { |
60 | 60 | |
61 | - const DEFAULTENABLED=true; |
|
62 | - const DEFAULTMAXSIZE=50; // unit: percentage; 50% of available disk space/quota |
|
61 | + const DEFAULTENABLED = true; |
|
62 | + const DEFAULTMAXSIZE = 50; // unit: percentage; 50% of available disk space/quota |
|
63 | 63 | const VERSIONS_ROOT = 'files_versions/'; |
64 | 64 | |
65 | 65 | const DELETE_TRIGGER_MASTER_REMOVED = 0; |
@@ -73,17 +73,17 @@ discard block |
||
73 | 73 | |
74 | 74 | private static $max_versions_per_interval = [ |
75 | 75 | //first 10sec, one version every 2sec |
76 | - 1 => ['intervalEndsAfter' => 10, 'step' => 2], |
|
76 | + 1 => ['intervalEndsAfter' => 10, 'step' => 2], |
|
77 | 77 | //next minute, one version every 10sec |
78 | - 2 => ['intervalEndsAfter' => 60, 'step' => 10], |
|
78 | + 2 => ['intervalEndsAfter' => 60, 'step' => 10], |
|
79 | 79 | //next hour, one version every minute |
80 | - 3 => ['intervalEndsAfter' => 3600, 'step' => 60], |
|
80 | + 3 => ['intervalEndsAfter' => 3600, 'step' => 60], |
|
81 | 81 | //next 24h, one version every hour |
82 | - 4 => ['intervalEndsAfter' => 86400, 'step' => 3600], |
|
82 | + 4 => ['intervalEndsAfter' => 86400, 'step' => 3600], |
|
83 | 83 | //next 30days, one version per day |
84 | 84 | 5 => ['intervalEndsAfter' => 2592000, 'step' => 86400], |
85 | 85 | //until the end one version per week |
86 | - 6 => ['intervalEndsAfter' => -1, 'step' => 604800], |
|
86 | + 6 => ['intervalEndsAfter' => -1, 'step' => 604800], |
|
87 | 87 | ]; |
88 | 88 | |
89 | 89 | /** @var \OCA\Files_Versions\AppInfo\Application */ |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @return int versions size |
158 | 158 | */ |
159 | 159 | private static function getVersionsSize($user) { |
160 | - $view = new View('/' . $user); |
|
160 | + $view = new View('/'.$user); |
|
161 | 161 | $fileInfo = $view->getFileInfo('/files_versions'); |
162 | 162 | return isset($fileInfo['size']) ? $fileInfo['size'] : 0; |
163 | 163 | } |
@@ -175,13 +175,13 @@ discard block |
||
175 | 175 | } |
176 | 176 | |
177 | 177 | // we only handle existing files |
178 | - if (! Filesystem::file_exists($filename) || Filesystem::is_dir($filename)) { |
|
178 | + if (!Filesystem::file_exists($filename) || Filesystem::is_dir($filename)) { |
|
179 | 179 | return false; |
180 | 180 | } |
181 | 181 | |
182 | 182 | list($uid, $filename) = self::getUidAndFilename($filename); |
183 | 183 | |
184 | - $files_view = new View('/'.$uid .'/files'); |
|
184 | + $files_view = new View('/'.$uid.'/files'); |
|
185 | 185 | |
186 | 186 | $eventDispatcher = \OC::$server->getEventDispatcher(); |
187 | 187 | $fileInfo = $files_view->getFileInfo($filename); |
@@ -248,14 +248,14 @@ discard block |
||
248 | 248 | |
249 | 249 | if (!Filesystem::file_exists($path)) { |
250 | 250 | |
251 | - $view = new View('/' . $uid . '/files_versions'); |
|
251 | + $view = new View('/'.$uid.'/files_versions'); |
|
252 | 252 | |
253 | 253 | $versions = self::getVersions($uid, $filename); |
254 | 254 | if (!empty($versions)) { |
255 | 255 | foreach ($versions as $v) { |
256 | - \OC_Hook::emit('\OCP\Versions', 'preDelete', ['path' => $path . $v['version'], 'trigger' => self::DELETE_TRIGGER_MASTER_REMOVED]); |
|
257 | - self::deleteVersion($view, $filename . '.v' . $v['version']); |
|
258 | - \OC_Hook::emit('\OCP\Versions', 'delete', ['path' => $path . $v['version'], 'trigger' => self::DELETE_TRIGGER_MASTER_REMOVED]); |
|
256 | + \OC_Hook::emit('\OCP\Versions', 'preDelete', ['path' => $path.$v['version'], 'trigger' => self::DELETE_TRIGGER_MASTER_REMOVED]); |
|
257 | + self::deleteVersion($view, $filename.'.v'.$v['version']); |
|
258 | + \OC_Hook::emit('\OCP\Versions', 'delete', ['path' => $path.$v['version'], 'trigger' => self::DELETE_TRIGGER_MASTER_REMOVED]); |
|
259 | 259 | } |
260 | 260 | } |
261 | 261 | } |
@@ -289,33 +289,33 @@ discard block |
||
289 | 289 | $rootView = new View(''); |
290 | 290 | |
291 | 291 | // did we move a directory ? |
292 | - if ($rootView->is_dir('/' . $targetOwner . '/files/' . $targetPath)) { |
|
292 | + if ($rootView->is_dir('/'.$targetOwner.'/files/'.$targetPath)) { |
|
293 | 293 | // does the directory exists for versions too ? |
294 | - if ($rootView->is_dir('/' . $sourceOwner . '/files_versions/' . $sourcePath)) { |
|
294 | + if ($rootView->is_dir('/'.$sourceOwner.'/files_versions/'.$sourcePath)) { |
|
295 | 295 | // create missing dirs if necessary |
296 | - self::createMissingDirectories($targetPath, new View('/'. $targetOwner)); |
|
296 | + self::createMissingDirectories($targetPath, new View('/'.$targetOwner)); |
|
297 | 297 | |
298 | 298 | // move the directory containing the versions |
299 | 299 | $rootView->$operation( |
300 | - '/' . $sourceOwner . '/files_versions/' . $sourcePath, |
|
301 | - '/' . $targetOwner . '/files_versions/' . $targetPath |
|
300 | + '/'.$sourceOwner.'/files_versions/'.$sourcePath, |
|
301 | + '/'.$targetOwner.'/files_versions/'.$targetPath |
|
302 | 302 | ); |
303 | 303 | } |
304 | - } else if ($versions = Storage::getVersions($sourceOwner, '/' . $sourcePath)) { |
|
304 | + } else if ($versions = Storage::getVersions($sourceOwner, '/'.$sourcePath)) { |
|
305 | 305 | // create missing dirs if necessary |
306 | - self::createMissingDirectories($targetPath, new View('/'. $targetOwner)); |
|
306 | + self::createMissingDirectories($targetPath, new View('/'.$targetOwner)); |
|
307 | 307 | |
308 | 308 | foreach ($versions as $v) { |
309 | 309 | // move each version one by one to the target directory |
310 | 310 | $rootView->$operation( |
311 | - '/' . $sourceOwner . '/files_versions/' . $sourcePath.'.v' . $v['version'], |
|
312 | - '/' . $targetOwner . '/files_versions/' . $targetPath.'.v'.$v['version'] |
|
311 | + '/'.$sourceOwner.'/files_versions/'.$sourcePath.'.v'.$v['version'], |
|
312 | + '/'.$targetOwner.'/files_versions/'.$targetPath.'.v'.$v['version'] |
|
313 | 313 | ); |
314 | 314 | } |
315 | 315 | } |
316 | 316 | |
317 | 317 | // if we moved versions directly for a file, schedule expiration check for that file |
318 | - if (!$rootView->is_dir('/' . $targetOwner . '/files/' . $targetPath)) { |
|
318 | + if (!$rootView->is_dir('/'.$targetOwner.'/files/'.$targetPath)) { |
|
319 | 319 | self::scheduleExpire($targetOwner, $targetPath); |
320 | 320 | } |
321 | 321 | |
@@ -331,13 +331,13 @@ discard block |
||
331 | 331 | public static function rollback(string $file, int $revision, IUser $user) { |
332 | 332 | |
333 | 333 | // add expected leading slash |
334 | - $filename = '/' . ltrim($file, '/'); |
|
334 | + $filename = '/'.ltrim($file, '/'); |
|
335 | 335 | |
336 | 336 | // Fetch the userfolder to trigger view hooks |
337 | 337 | $userFolder = \OC::$server->getUserFolder($user->getUID()); |
338 | 338 | |
339 | 339 | $users_view = new View('/'.$user->getUID()); |
340 | - $files_view = new View('/'. $user->getUID().'/files'); |
|
340 | + $files_view = new View('/'.$user->getUID().'/files'); |
|
341 | 341 | |
342 | 342 | $versionCreated = false; |
343 | 343 | |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | $versionCreated = true; |
356 | 356 | } |
357 | 357 | |
358 | - $fileToRestore = 'files_versions' . $filename . '.v' . $revision; |
|
358 | + $fileToRestore = 'files_versions'.$filename.'.v'.$revision; |
|
359 | 359 | |
360 | 360 | // Restore encrypted version of the old file for the newly restored file |
361 | 361 | // This has to happen manually here since the file is manually copied below |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | ); |
372 | 372 | |
373 | 373 | // rollback |
374 | - if (self::copyFileContents($users_view, $fileToRestore, 'files' . $filename)) { |
|
374 | + if (self::copyFileContents($users_view, $fileToRestore, 'files'.$filename)) { |
|
375 | 375 | $files_view->touch($file, $revision); |
376 | 376 | Storage::scheduleExpire($user->getUID(), $file); |
377 | 377 | |
@@ -444,12 +444,12 @@ discard block |
||
444 | 444 | return $versions; |
445 | 445 | } |
446 | 446 | // fetch for old versions |
447 | - $view = new View('/' . $uid . '/'); |
|
447 | + $view = new View('/'.$uid.'/'); |
|
448 | 448 | |
449 | 449 | $pathinfo = pathinfo($filename); |
450 | 450 | $versionedFile = $pathinfo['basename']; |
451 | 451 | |
452 | - $dir = Filesystem::normalizePath(self::VERSIONS_ROOT . '/' . $pathinfo['dirname']); |
|
452 | + $dir = Filesystem::normalizePath(self::VERSIONS_ROOT.'/'.$pathinfo['dirname']); |
|
453 | 453 | |
454 | 454 | $dirContent = false; |
455 | 455 | if ($view->is_dir($dir)) { |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | $pathparts = pathinfo($entryName); |
470 | 470 | $timestamp = substr($pathparts['extension'], 1); |
471 | 471 | $filename = $pathparts['filename']; |
472 | - $key = $timestamp . '#' . $filename; |
|
472 | + $key = $timestamp.'#'.$filename; |
|
473 | 473 | $versions[$key]['version'] = $timestamp; |
474 | 474 | $versions[$key]['humanReadableTimestamp'] = self::getHumanReadableTimestamp($timestamp); |
475 | 475 | if (empty($userFullPath)) { |
@@ -477,9 +477,9 @@ discard block |
||
477 | 477 | } else { |
478 | 478 | $versions[$key]['preview'] = \OC::$server->getURLGenerator('files_version.Preview.getPreview', ['file' => $userFullPath, 'version' => $timestamp]); |
479 | 479 | } |
480 | - $versions[$key]['path'] = Filesystem::normalizePath($pathinfo['dirname'] . '/' . $filename); |
|
480 | + $versions[$key]['path'] = Filesystem::normalizePath($pathinfo['dirname'].'/'.$filename); |
|
481 | 481 | $versions[$key]['name'] = $versionedFile; |
482 | - $versions[$key]['size'] = $view->filesize($dir . '/' . $entryName); |
|
482 | + $versions[$key]['size'] = $view->filesize($dir.'/'.$entryName); |
|
483 | 483 | $versions[$key]['mimetype'] = \OC::$server->getMimeTypeDetector()->detectPath($versionedFile); |
484 | 484 | } |
485 | 485 | } |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | |
508 | 508 | $toDelete = []; |
509 | 509 | foreach (array_reverse($versions['all']) as $key => $version) { |
510 | - if ((int)$version['version'] <$threshold) { |
|
510 | + if ((int) $version['version'] < $threshold) { |
|
511 | 511 | $toDelete[$key] = $version; |
512 | 512 | } else { |
513 | 513 | //Versions are sorted by time - nothing mo to iterate. |
@@ -515,11 +515,11 @@ discard block |
||
515 | 515 | } |
516 | 516 | } |
517 | 517 | |
518 | - $view = new View('/' . $uid . '/files_versions'); |
|
518 | + $view = new View('/'.$uid.'/files_versions'); |
|
519 | 519 | if (!empty($toDelete)) { |
520 | 520 | foreach ($toDelete as $version) { |
521 | 521 | \OC_Hook::emit('\OCP\Versions', 'preDelete', ['path' => $version['path'].'.v'.$version['version'], 'trigger' => self::DELETE_TRIGGER_RETENTION_CONSTRAINT]); |
522 | - self::deleteVersion($view, $version['path'] . '.v' . $version['version']); |
|
522 | + self::deleteVersion($view, $version['path'].'.v'.$version['version']); |
|
523 | 523 | \OC_Hook::emit('\OCP\Versions', 'delete', ['path' => $version['path'].'.v'.$version['version'], 'trigger' => self::DELETE_TRIGGER_RETENTION_CONSTRAINT]); |
524 | 524 | } |
525 | 525 | } |
@@ -535,19 +535,19 @@ discard block |
||
535 | 535 | $diff = time() - $timestamp; |
536 | 536 | |
537 | 537 | if ($diff < 60) { // first minute |
538 | - return $diff . " seconds ago"; |
|
538 | + return $diff." seconds ago"; |
|
539 | 539 | } elseif ($diff < 3600) { //first hour |
540 | - return round($diff / 60) . " minutes ago"; |
|
540 | + return round($diff / 60)." minutes ago"; |
|
541 | 541 | } elseif ($diff < 86400) { // first day |
542 | - return round($diff / 3600) . " hours ago"; |
|
542 | + return round($diff / 3600)." hours ago"; |
|
543 | 543 | } elseif ($diff < 604800) { //first week |
544 | - return round($diff / 86400) . " days ago"; |
|
544 | + return round($diff / 86400)." days ago"; |
|
545 | 545 | } elseif ($diff < 2419200) { //first month |
546 | - return round($diff / 604800) . " weeks ago"; |
|
546 | + return round($diff / 604800)." weeks ago"; |
|
547 | 547 | } elseif ($diff < 29030400) { // first year |
548 | - return round($diff / 2419200) . " months ago"; |
|
548 | + return round($diff / 2419200)." months ago"; |
|
549 | 549 | } else { |
550 | - return round($diff / 29030400) . " years ago"; |
|
550 | + return round($diff / 29030400)." years ago"; |
|
551 | 551 | } |
552 | 552 | |
553 | 553 | } |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | * @return array with contains two arrays 'all' which contains all versions sorted by age and 'by_file' which contains all versions sorted by filename |
559 | 559 | */ |
560 | 560 | private static function getAllVersions($uid) { |
561 | - $view = new View('/' . $uid . '/'); |
|
561 | + $view = new View('/'.$uid.'/'); |
|
562 | 562 | $dirs = [self::VERSIONS_ROOT]; |
563 | 563 | $versions = []; |
564 | 564 | |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | |
569 | 569 | foreach ($files as $file) { |
570 | 570 | $fileData = $file->getData(); |
571 | - $filePath = $dir . '/' . $fileData['name']; |
|
571 | + $filePath = $dir.'/'.$fileData['name']; |
|
572 | 572 | if ($file['type'] === 'dir') { |
573 | 573 | $dirs[] = $filePath; |
574 | 574 | } else { |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | $relPathStart = strlen(self::VERSIONS_ROOT); |
577 | 577 | $version = substr($filePath, $versionsBegin + 2); |
578 | 578 | $relpath = substr($filePath, $relPathStart, $versionsBegin - $relPathStart); |
579 | - $key = $version . '#' . $relpath; |
|
579 | + $key = $version.'#'.$relpath; |
|
580 | 580 | $versions[$key] = ['path' => $relpath, 'timestamp' => $version]; |
581 | 581 | } |
582 | 582 | } |
@@ -617,13 +617,13 @@ discard block |
||
617 | 617 | list($toDelete, $size) = self::getAutoExpireList($time, $versions); |
618 | 618 | } else { |
619 | 619 | $size = 0; |
620 | - $toDelete = []; // versions we want to delete |
|
620 | + $toDelete = []; // versions we want to delete |
|
621 | 621 | } |
622 | 622 | |
623 | 623 | foreach ($versions as $key => $version) { |
624 | 624 | if ($expiration->isExpired($version['version'], $quotaExceeded) && !isset($toDelete[$key])) { |
625 | 625 | $size += $version['size']; |
626 | - $toDelete[$key] = $version['path'] . '.v' . $version['version']; |
|
626 | + $toDelete[$key] = $version['path'].'.v'.$version['version']; |
|
627 | 627 | } |
628 | 628 | } |
629 | 629 | |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | */ |
639 | 639 | protected static function getAutoExpireList($time, $versions) { |
640 | 640 | $size = 0; |
641 | - $toDelete = []; // versions we want to delete |
|
641 | + $toDelete = []; // versions we want to delete |
|
642 | 642 | |
643 | 643 | $interval = 1; |
644 | 644 | $step = Storage::$max_versions_per_interval[$interval]['step']; |
@@ -660,9 +660,9 @@ discard block |
||
660 | 660 | if ($nextInterval === -1 || $prevTimestamp > $nextInterval) { |
661 | 661 | if ($version['version'] > $nextVersion) { |
662 | 662 | //distance between two version too small, mark to delete |
663 | - $toDelete[$key] = $version['path'] . '.v' . $version['version']; |
|
663 | + $toDelete[$key] = $version['path'].'.v'.$version['version']; |
|
664 | 664 | $size += $version['size']; |
665 | - \OC::$server->getLogger()->info('Mark to expire '. $version['path'] .' next version should be ' . $nextVersion . " or smaller. (prevTimestamp: " . $prevTimestamp . "; step: " . $step, ['app' => 'files_versions']); |
|
665 | + \OC::$server->getLogger()->info('Mark to expire '.$version['path'].' next version should be '.$nextVersion." or smaller. (prevTimestamp: ".$prevTimestamp."; step: ".$step, ['app' => 'files_versions']); |
|
666 | 666 | } else { |
667 | 667 | $nextVersion = $version['version'] - $step; |
668 | 668 | $prevTimestamp = $version['version']; |
@@ -717,8 +717,8 @@ discard block |
||
717 | 717 | // get available disk space for user |
718 | 718 | $user = \OC::$server->getUserManager()->get($uid); |
719 | 719 | if (is_null($user)) { |
720 | - \OC::$server->getLogger()->error('Backends provided no user object for ' . $uid, ['app' => 'files_versions']); |
|
721 | - throw new \OC\User\NoUserException('Backends provided no user object for ' . $uid); |
|
720 | + \OC::$server->getLogger()->error('Backends provided no user object for '.$uid, ['app' => 'files_versions']); |
|
721 | + throw new \OC\User\NoUserException('Backends provided no user object for '.$uid); |
|
722 | 722 | } |
723 | 723 | |
724 | 724 | \OC_Util::setupFS($uid); |
@@ -750,7 +750,7 @@ discard block |
||
750 | 750 | if ($quota >= 0) { |
751 | 751 | if ($softQuota) { |
752 | 752 | $userFolder = \OC::$server->getUserFolder($uid); |
753 | - if(is_null($userFolder)) { |
|
753 | + if (is_null($userFolder)) { |
|
754 | 754 | $availableSpace = 0; |
755 | 755 | } else { |
756 | 756 | $free = $quota - $userFolder->getSize(false); // remaining free space for user |
@@ -790,18 +790,18 @@ discard block |
||
790 | 790 | } |
791 | 791 | |
792 | 792 | $logger = \OC::$server->getLogger(); |
793 | - foreach($toDelete as $key => $path) { |
|
793 | + foreach ($toDelete as $key => $path) { |
|
794 | 794 | \OC_Hook::emit('\OCP\Versions', 'preDelete', ['path' => $path, 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED]); |
795 | 795 | self::deleteVersion($versionsFileview, $path); |
796 | 796 | \OC_Hook::emit('\OCP\Versions', 'delete', ['path' => $path, 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED]); |
797 | 797 | unset($allVersions[$key]); // update array with the versions we keep |
798 | - $logger->info('Expire: ' . $path, ['app' => 'files_versions']); |
|
798 | + $logger->info('Expire: '.$path, ['app' => 'files_versions']); |
|
799 | 799 | } |
800 | 800 | |
801 | 801 | // Check if enough space is available after versions are rearranged. |
802 | 802 | // If not we delete the oldest versions until we meet the size limit for versions, |
803 | 803 | // but always keep the two latest versions |
804 | - $numOfVersions = count($allVersions) -2 ; |
|
804 | + $numOfVersions = count($allVersions) - 2; |
|
805 | 805 | $i = 0; |
806 | 806 | // sort oldest first and make sure that we start at the first element |
807 | 807 | ksort($allVersions); |
@@ -809,9 +809,9 @@ discard block |
||
809 | 809 | while ($availableSpace < 0 && $i < $numOfVersions) { |
810 | 810 | $version = current($allVersions); |
811 | 811 | \OC_Hook::emit('\OCP\Versions', 'preDelete', ['path' => $version['path'].'.v'.$version['version'], 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED]); |
812 | - self::deleteVersion($versionsFileview, $version['path'] . '.v' . $version['version']); |
|
812 | + self::deleteVersion($versionsFileview, $version['path'].'.v'.$version['version']); |
|
813 | 813 | \OC_Hook::emit('\OCP\Versions', 'delete', ['path' => $version['path'].'.v'.$version['version'], 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED]); |
814 | - \OC::$server->getLogger()->info('running out of space! Delete oldest version: ' . $version['path'].'.v'.$version['version'], ['app' => 'files_versions']); |
|
814 | + \OC::$server->getLogger()->info('running out of space! Delete oldest version: '.$version['path'].'.v'.$version['version'], ['app' => 'files_versions']); |
|
815 | 815 | $versionsSize -= $version['size']; |
816 | 816 | $availableSpace += $version['size']; |
817 | 817 | next($allVersions); |
@@ -837,7 +837,7 @@ discard block |
||
837 | 837 | $dirParts = explode('/', $dirname); |
838 | 838 | $dir = "/files_versions"; |
839 | 839 | foreach ($dirParts as $part) { |
840 | - $dir = $dir . '/' . $part; |
|
840 | + $dir = $dir.'/'.$part; |
|
841 | 841 | if (!$view->file_exists($dir)) { |
842 | 842 | $view->mkdir($dir); |
843 | 843 | } |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | |
230 | 230 | protected function authSucceeded() { |
231 | 231 | // For share this was always set so it is still used in other apps |
232 | - $this->session->set('public_link_authenticated', (string)$this->share->getId()); |
|
232 | + $this->session->set('public_link_authenticated', (string) $this->share->getId()); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | protected function authFailed() { |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $itemType = $itemSource = $uidOwner = ''; |
251 | 251 | $token = $share; |
252 | 252 | $exception = null; |
253 | - if($share instanceof \OCP\Share\IShare) { |
|
253 | + if ($share instanceof \OCP\Share\IShare) { |
|
254 | 254 | try { |
255 | 255 | $token = $share->getToken(); |
256 | 256 | $uidOwner = $share->getSharedBy(); |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | 'errorCode' => $errorCode, |
270 | 270 | 'errorMessage' => $errorMessage, |
271 | 271 | ]); |
272 | - if(!is_null($exception)) { |
|
272 | + if (!is_null($exception)) { |
|
273 | 273 | throw $exception; |
274 | 274 | } |
275 | 275 | } |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | |
484 | 484 | // OpenGraph Support: http://ogp.me/ |
485 | 485 | \OCP\Util::addHeader('meta', ['property' => "og:title", 'content' => $shareTmpl['filename']]); |
486 | - \OCP\Util::addHeader('meta', ['property' => "og:description", 'content' => $this->defaults->getName() . ($this->defaults->getSlogan() !== '' ? ' - ' . $this->defaults->getSlogan() : '')]); |
|
486 | + \OCP\Util::addHeader('meta', ['property' => "og:description", 'content' => $this->defaults->getName().($this->defaults->getSlogan() !== '' ? ' - '.$this->defaults->getSlogan() : '')]); |
|
487 | 487 | \OCP\Util::addHeader('meta', ['property' => "og:site_name", 'content' => $this->defaults->getName()]); |
488 | 488 | \OCP\Util::addHeader('meta', ['property' => "og:url", 'content' => $shareTmpl['shareUrl']]); |
489 | 489 | \OCP\Util::addHeader('meta', ['property' => "og:type", 'content' => "object"]); |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | |
554 | 554 | $share = $this->shareManager->getShareByToken($token); |
555 | 555 | |
556 | - if(!($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) { |
|
556 | + if (!($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) { |
|
557 | 557 | return new \OCP\AppFramework\Http\DataResponse('Share is read-only'); |
558 | 558 | } |
559 | 559 | |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | |
637 | 637 | $this->emitAccessShareHook($share); |
638 | 638 | |
639 | - $server_params = [ 'head' => $this->request->getMethod() === 'HEAD' ]; |
|
639 | + $server_params = ['head' => $this->request->getMethod() === 'HEAD']; |
|
640 | 640 | |
641 | 641 | /** |
642 | 642 | * Http range requests support |