@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | throw new \Exception('missing IObjectStore instance'); |
56 | 56 | } |
57 | 57 | if (isset($params['storageid'])) { |
58 | - $this->id = 'object::store:' . $params['storageid']; |
|
58 | + $this->id = 'object::store:'.$params['storageid']; |
|
59 | 59 | } else { |
60 | - $this->id = 'object::store:' . $this->objectStore->getStorageId(); |
|
60 | + $this->id = 'object::store:'.$this->objectStore->getStorageId(); |
|
61 | 61 | } |
62 | 62 | if (isset($params['objectPrefix'])) { |
63 | 63 | $this->objectPrefix = $params['objectPrefix']; |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | if ($ex->getCode() !== 404) { |
192 | 192 | $this->logger->logException($ex, [ |
193 | 193 | 'app' => 'objectstore', |
194 | - 'message' => 'Could not delete object ' . $this->getURN($stat['fileid']) . ' for ' . $path, |
|
194 | + 'message' => 'Could not delete object '.$this->getURN($stat['fileid']).' for '.$path, |
|
195 | 195 | ]); |
196 | 196 | return false; |
197 | 197 | } else { |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | */ |
225 | 225 | protected function getURN($fileId) { |
226 | 226 | if (is_numeric($fileId)) { |
227 | - return $this->objectPrefix . $fileId; |
|
227 | + return $this->objectPrefix.$fileId; |
|
228 | 228 | } |
229 | 229 | return null; |
230 | 230 | } |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | } catch (\Exception $ex) { |
273 | 273 | $this->logger->logException($ex, [ |
274 | 274 | 'app' => 'objectstore', |
275 | - 'message' => 'Count not get object ' . $this->getURN($stat['fileid']) . ' for file ' . $path, |
|
275 | + 'message' => 'Count not get object '.$this->getURN($stat['fileid']).' for file '.$path, |
|
276 | 276 | ]); |
277 | 277 | return false; |
278 | 278 | } |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | file_put_contents($tmpFile, $source); |
303 | 303 | } |
304 | 304 | $handle = fopen($tmpFile, $mode); |
305 | - return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) { |
|
305 | + return CallbackWrapper::wrap($handle, null, null, function() use ($path, $tmpFile) { |
|
306 | 306 | $this->writeBack($tmpFile, $path); |
307 | 307 | }); |
308 | 308 | } |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | |
312 | 312 | public function file_exists($path) { |
313 | 313 | $path = $this->normalizePath($path); |
314 | - return (bool)$this->stat($path); |
|
314 | + return (bool) $this->stat($path); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | public function rename($source, $target) { |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | $this->getCache()->remove($path); |
370 | 370 | $this->logger->logException($ex, [ |
371 | 371 | 'app' => 'objectstore', |
372 | - 'message' => 'Could not create object ' . $this->getURN($fileId) . ' for ' . $path, |
|
372 | + 'message' => 'Could not create object '.$this->getURN($fileId).' for '.$path, |
|
373 | 373 | ]); |
374 | 374 | return false; |
375 | 375 | } |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | $this->getCache()->remove($path); |
402 | 402 | $this->logger->logException($ex, [ |
403 | 403 | 'app' => 'objectstore', |
404 | - 'message' => 'Could not create object ' . $this->getURN($fileId) . ' for ' . $path, |
|
404 | + 'message' => 'Could not create object '.$this->getURN($fileId).' for '.$path, |
|
405 | 405 | ]); |
406 | 406 | throw $ex; // make this bubble up |
407 | 407 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | Filesystem::initMountPoints($uid); |
96 | 96 | if ($uid != User::getUser()) { |
97 | 97 | $info = Filesystem::getFileInfo($filename); |
98 | - $ownerView = new View('/' . $uid . '/files'); |
|
98 | + $ownerView = new View('/'.$uid.'/files'); |
|
99 | 99 | try { |
100 | 100 | $filename = $ownerView->getPath($info['fileid']); |
101 | 101 | } catch (NotFoundException $e) { |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | } |
147 | 147 | |
148 | 148 | private static function setUpTrash($user) { |
149 | - $view = new View('/' . $user); |
|
149 | + $view = new View('/'.$user); |
|
150 | 150 | if (!$view->is_dir('files_trashbin')) { |
151 | 151 | $view->mkdir('files_trashbin'); |
152 | 152 | } |
@@ -181,8 +181,8 @@ discard block |
||
181 | 181 | |
182 | 182 | $view = new View('/'); |
183 | 183 | |
184 | - $target = $user . '/files_trashbin/files/' . $targetFilename . '.d' . $timestamp; |
|
185 | - $source = $owner . '/files_trashbin/files/' . $sourceFilename . '.d' . $timestamp; |
|
184 | + $target = $user.'/files_trashbin/files/'.$targetFilename.'.d'.$timestamp; |
|
185 | + $source = $owner.'/files_trashbin/files/'.$sourceFilename.'.d'.$timestamp; |
|
186 | 186 | self::copy_recursive($source, $target, $view); |
187 | 187 | |
188 | 188 | |
@@ -216,9 +216,9 @@ discard block |
||
216 | 216 | $ownerPath = $file_path; |
217 | 217 | } |
218 | 218 | |
219 | - $ownerView = new View('/' . $owner); |
|
219 | + $ownerView = new View('/'.$owner); |
|
220 | 220 | // file has been deleted in between |
221 | - if (is_null($ownerPath) || $ownerPath === '' || !$ownerView->file_exists('/files/' . $ownerPath)) { |
|
221 | + if (is_null($ownerPath) || $ownerPath === '' || !$ownerView->file_exists('/files/'.$ownerPath)) { |
|
222 | 222 | return true; |
223 | 223 | } |
224 | 224 | |
@@ -235,12 +235,12 @@ discard block |
||
235 | 235 | $timestamp = time(); |
236 | 236 | |
237 | 237 | // disable proxy to prevent recursive calls |
238 | - $trashPath = '/files_trashbin/files/' . $filename . '.d' . $timestamp; |
|
238 | + $trashPath = '/files_trashbin/files/'.$filename.'.d'.$timestamp; |
|
239 | 239 | |
240 | 240 | /** @var \OC\Files\Storage\Storage $trashStorage */ |
241 | 241 | list($trashStorage, $trashInternalPath) = $ownerView->resolvePath($trashPath); |
242 | 242 | /** @var \OC\Files\Storage\Storage $sourceStorage */ |
243 | - list($sourceStorage, $sourceInternalPath) = $ownerView->resolvePath('/files/' . $ownerPath); |
|
243 | + list($sourceStorage, $sourceInternalPath) = $ownerView->resolvePath('/files/'.$ownerPath); |
|
244 | 244 | try { |
245 | 245 | $moveSuccessful = true; |
246 | 246 | if ($trashStorage->file_exists($trashInternalPath)) { |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | if ($trashStorage->file_exists($trashInternalPath)) { |
253 | 253 | $trashStorage->unlink($trashInternalPath); |
254 | 254 | } |
255 | - \OCP\Util::writeLog('files_trashbin', 'Couldn\'t move ' . $file_path . ' to the trash bin', \OCP\Util::ERROR); |
|
255 | + \OCP\Util::writeLog('files_trashbin', 'Couldn\'t move '.$file_path.' to the trash bin', \OCP\Util::ERROR); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | if ($sourceStorage->file_exists($sourceInternalPath)) { // failed to delete the original file, abort |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | \OCP\Util::writeLog('files_trashbin', 'trash bin database couldn\'t be updated', \OCP\Util::ERROR); |
274 | 274 | } |
275 | 275 | \OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_moveToTrash', array('filePath' => Filesystem::normalizePath($file_path), |
276 | - 'trashPath' => Filesystem::normalizePath($filename . '.d' . $timestamp))); |
|
276 | + 'trashPath' => Filesystem::normalizePath($filename.'.d'.$timestamp))); |
|
277 | 277 | |
278 | 278 | self::retainVersions($filename, $owner, $ownerPath, $timestamp); |
279 | 279 | |
@@ -307,18 +307,18 @@ discard block |
||
307 | 307 | $user = User::getUser(); |
308 | 308 | $rootView = new View('/'); |
309 | 309 | |
310 | - if ($rootView->is_dir($owner . '/files_versions/' . $ownerPath)) { |
|
310 | + if ($rootView->is_dir($owner.'/files_versions/'.$ownerPath)) { |
|
311 | 311 | if ($owner !== $user) { |
312 | - self::copy_recursive($owner . '/files_versions/' . $ownerPath, $owner . '/files_trashbin/versions/' . basename($ownerPath) . '.d' . $timestamp, $rootView); |
|
312 | + self::copy_recursive($owner.'/files_versions/'.$ownerPath, $owner.'/files_trashbin/versions/'.basename($ownerPath).'.d'.$timestamp, $rootView); |
|
313 | 313 | } |
314 | - self::move($rootView, $owner . '/files_versions/' . $ownerPath, $user . '/files_trashbin/versions/' . $filename . '.d' . $timestamp); |
|
314 | + self::move($rootView, $owner.'/files_versions/'.$ownerPath, $user.'/files_trashbin/versions/'.$filename.'.d'.$timestamp); |
|
315 | 315 | } else if ($versions = \OCA\Files_Versions\Storage::getVersions($owner, $ownerPath)) { |
316 | 316 | |
317 | 317 | foreach ($versions as $v) { |
318 | 318 | if ($owner !== $user) { |
319 | - self::copy($rootView, $owner . '/files_versions' . $v['path'] . '.v' . $v['version'], $owner . '/files_trashbin/versions/' . $v['name'] . '.v' . $v['version'] . '.d' . $timestamp); |
|
319 | + self::copy($rootView, $owner.'/files_versions'.$v['path'].'.v'.$v['version'], $owner.'/files_trashbin/versions/'.$v['name'].'.v'.$v['version'].'.d'.$timestamp); |
|
320 | 320 | } |
321 | - self::move($rootView, $owner . '/files_versions' . $v['path'] . '.v' . $v['version'], $user . '/files_trashbin/versions/' . $filename . '.v' . $v['version'] . '.d' . $timestamp); |
|
321 | + self::move($rootView, $owner.'/files_versions'.$v['path'].'.v'.$v['version'], $user.'/files_trashbin/versions/'.$filename.'.v'.$v['version'].'.d'.$timestamp); |
|
322 | 322 | } |
323 | 323 | } |
324 | 324 | } |
@@ -380,18 +380,18 @@ discard block |
||
380 | 380 | */ |
381 | 381 | public static function restore($file, $filename, $timestamp) { |
382 | 382 | $user = User::getUser(); |
383 | - $view = new View('/' . $user); |
|
383 | + $view = new View('/'.$user); |
|
384 | 384 | |
385 | 385 | $location = ''; |
386 | 386 | if ($timestamp) { |
387 | 387 | $location = self::getLocation($user, $filename, $timestamp); |
388 | 388 | if ($location === false) { |
389 | - \OCP\Util::writeLog('files_trashbin', 'trash bin database inconsistent! ($user: ' . $user . ' $filename: ' . $filename . ', $timestamp: ' . $timestamp . ')', \OCP\Util::ERROR); |
|
389 | + \OCP\Util::writeLog('files_trashbin', 'trash bin database inconsistent! ($user: '.$user.' $filename: '.$filename.', $timestamp: '.$timestamp.')', \OCP\Util::ERROR); |
|
390 | 390 | } else { |
391 | 391 | // if location no longer exists, restore file in the root directory |
392 | 392 | if ($location !== '/' && |
393 | - (!$view->is_dir('files/' . $location) || |
|
394 | - !$view->isCreatable('files/' . $location)) |
|
393 | + (!$view->is_dir('files/'.$location) || |
|
394 | + !$view->isCreatable('files/'.$location)) |
|
395 | 395 | ) { |
396 | 396 | $location = ''; |
397 | 397 | } |
@@ -401,8 +401,8 @@ discard block |
||
401 | 401 | // we need a extension in case a file/dir with the same name already exists |
402 | 402 | $uniqueFilename = self::getUniqueFilename($location, $filename, $view); |
403 | 403 | |
404 | - $source = Filesystem::normalizePath('files_trashbin/files/' . $file); |
|
405 | - $target = Filesystem::normalizePath('files/' . $location . '/' . $uniqueFilename); |
|
404 | + $source = Filesystem::normalizePath('files_trashbin/files/'.$file); |
|
405 | + $target = Filesystem::normalizePath('files/'.$location.'/'.$uniqueFilename); |
|
406 | 406 | if (!$view->file_exists($source)) { |
407 | 407 | return false; |
408 | 408 | } |
@@ -414,10 +414,10 @@ discard block |
||
414 | 414 | // handle the restore result |
415 | 415 | if ($restoreResult) { |
416 | 416 | $fakeRoot = $view->getRoot(); |
417 | - $view->chroot('/' . $user . '/files'); |
|
418 | - $view->touch('/' . $location . '/' . $uniqueFilename, $mtime); |
|
417 | + $view->chroot('/'.$user.'/files'); |
|
418 | + $view->touch('/'.$location.'/'.$uniqueFilename, $mtime); |
|
419 | 419 | $view->chroot($fakeRoot); |
420 | - \OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', array('filePath' => Filesystem::normalizePath('/' . $location . '/' . $uniqueFilename), |
|
420 | + \OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', array('filePath' => Filesystem::normalizePath('/'.$location.'/'.$uniqueFilename), |
|
421 | 421 | 'trashPath' => Filesystem::normalizePath($file))); |
422 | 422 | |
423 | 423 | self::restoreVersions($view, $file, $filename, $uniqueFilename, $location, $timestamp); |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | $user = User::getUser(); |
452 | 452 | $rootView = new View('/'); |
453 | 453 | |
454 | - $target = Filesystem::normalizePath('/' . $location . '/' . $uniqueFilename); |
|
454 | + $target = Filesystem::normalizePath('/'.$location.'/'.$uniqueFilename); |
|
455 | 455 | |
456 | 456 | list($owner, $ownerPath) = self::getUidAndFilename($target); |
457 | 457 | |
@@ -466,14 +466,14 @@ discard block |
||
466 | 466 | $versionedFile = $file; |
467 | 467 | } |
468 | 468 | |
469 | - if ($view->is_dir('/files_trashbin/versions/' . $file)) { |
|
470 | - $rootView->rename(Filesystem::normalizePath($user . '/files_trashbin/versions/' . $file), Filesystem::normalizePath($owner . '/files_versions/' . $ownerPath)); |
|
469 | + if ($view->is_dir('/files_trashbin/versions/'.$file)) { |
|
470 | + $rootView->rename(Filesystem::normalizePath($user.'/files_trashbin/versions/'.$file), Filesystem::normalizePath($owner.'/files_versions/'.$ownerPath)); |
|
471 | 471 | } else if ($versions = self::getVersionsFromTrash($versionedFile, $timestamp, $user)) { |
472 | 472 | foreach ($versions as $v) { |
473 | 473 | if ($timestamp) { |
474 | - $rootView->rename($user . '/files_trashbin/versions/' . $versionedFile . '.v' . $v . '.d' . $timestamp, $owner . '/files_versions/' . $ownerPath . '.v' . $v); |
|
474 | + $rootView->rename($user.'/files_trashbin/versions/'.$versionedFile.'.v'.$v.'.d'.$timestamp, $owner.'/files_versions/'.$ownerPath.'.v'.$v); |
|
475 | 475 | } else { |
476 | - $rootView->rename($user . '/files_trashbin/versions/' . $versionedFile . '.v' . $v, $owner . '/files_versions/' . $ownerPath . '.v' . $v); |
|
476 | + $rootView->rename($user.'/files_trashbin/versions/'.$versionedFile.'.v'.$v, $owner.'/files_versions/'.$ownerPath.'.v'.$v); |
|
477 | 477 | } |
478 | 478 | } |
479 | 479 | } |
@@ -485,12 +485,12 @@ discard block |
||
485 | 485 | */ |
486 | 486 | public static function deleteAll() { |
487 | 487 | $user = User::getUser(); |
488 | - $view = new View('/' . $user); |
|
488 | + $view = new View('/'.$user); |
|
489 | 489 | $fileInfos = $view->getDirectoryContent('files_trashbin/files'); |
490 | 490 | |
491 | 491 | // Array to store the relative path in (after the file is deleted, the view won't be able to relativise the path anymore) |
492 | 492 | $filePaths = array(); |
493 | - foreach($fileInfos as $fileInfo){ |
|
493 | + foreach ($fileInfos as $fileInfo) { |
|
494 | 494 | $filePaths[] = $view->getRelativePath($fileInfo->getPath()); |
495 | 495 | } |
496 | 496 | unset($fileInfos); // save memory |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | \OC_Hook::emit('\OCP\Trashbin', 'preDeleteAll', array('paths' => $filePaths)); |
500 | 500 | |
501 | 501 | // Single-File Hooks |
502 | - foreach($filePaths as $path){ |
|
502 | + foreach ($filePaths as $path) { |
|
503 | 503 | self::emitTrashbinPreDelete($path); |
504 | 504 | } |
505 | 505 | |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | \OC_Hook::emit('\OCP\Trashbin', 'deleteAll', array('paths' => $filePaths)); |
513 | 513 | |
514 | 514 | // Single-File Hooks |
515 | - foreach($filePaths as $path){ |
|
515 | + foreach ($filePaths as $path) { |
|
516 | 516 | self::emitTrashbinPostDelete($path); |
517 | 517 | } |
518 | 518 | |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | * wrapper function to emit the 'preDelete' hook of \OCP\Trashbin before a file is deleted |
527 | 527 | * @param string $path |
528 | 528 | */ |
529 | - protected static function emitTrashbinPreDelete($path){ |
|
529 | + protected static function emitTrashbinPreDelete($path) { |
|
530 | 530 | \OC_Hook::emit('\OCP\Trashbin', 'preDelete', array('path' => $path)); |
531 | 531 | } |
532 | 532 | |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | * wrapper function to emit the 'delete' hook of \OCP\Trashbin after a file has been deleted |
535 | 535 | * @param string $path |
536 | 536 | */ |
537 | - protected static function emitTrashbinPostDelete($path){ |
|
537 | + protected static function emitTrashbinPostDelete($path) { |
|
538 | 538 | \OC_Hook::emit('\OCP\Trashbin', 'delete', array('path' => $path)); |
539 | 539 | } |
540 | 540 | |
@@ -548,27 +548,27 @@ discard block |
||
548 | 548 | * @return int size of deleted files |
549 | 549 | */ |
550 | 550 | public static function delete($filename, $user, $timestamp = null) { |
551 | - $view = new View('/' . $user); |
|
551 | + $view = new View('/'.$user); |
|
552 | 552 | $size = 0; |
553 | 553 | |
554 | 554 | if ($timestamp) { |
555 | 555 | $query = \OC_DB::prepare('DELETE FROM `*PREFIX*files_trash` WHERE `user`=? AND `id`=? AND `timestamp`=?'); |
556 | 556 | $query->execute(array($user, $filename, $timestamp)); |
557 | - $file = $filename . '.d' . $timestamp; |
|
557 | + $file = $filename.'.d'.$timestamp; |
|
558 | 558 | } else { |
559 | 559 | $file = $filename; |
560 | 560 | } |
561 | 561 | |
562 | 562 | $size += self::deleteVersions($view, $file, $filename, $timestamp, $user); |
563 | 563 | |
564 | - if ($view->is_dir('/files_trashbin/files/' . $file)) { |
|
565 | - $size += self::calculateSize(new View('/' . $user . '/files_trashbin/files/' . $file)); |
|
564 | + if ($view->is_dir('/files_trashbin/files/'.$file)) { |
|
565 | + $size += self::calculateSize(new View('/'.$user.'/files_trashbin/files/'.$file)); |
|
566 | 566 | } else { |
567 | - $size += $view->filesize('/files_trashbin/files/' . $file); |
|
567 | + $size += $view->filesize('/files_trashbin/files/'.$file); |
|
568 | 568 | } |
569 | - self::emitTrashbinPreDelete('/files_trashbin/files/' . $file); |
|
570 | - $view->unlink('/files_trashbin/files/' . $file); |
|
571 | - self::emitTrashbinPostDelete('/files_trashbin/files/' . $file); |
|
569 | + self::emitTrashbinPreDelete('/files_trashbin/files/'.$file); |
|
570 | + $view->unlink('/files_trashbin/files/'.$file); |
|
571 | + self::emitTrashbinPostDelete('/files_trashbin/files/'.$file); |
|
572 | 572 | |
573 | 573 | return $size; |
574 | 574 | } |
@@ -584,17 +584,17 @@ discard block |
||
584 | 584 | private static function deleteVersions(View $view, $file, $filename, $timestamp, $user) { |
585 | 585 | $size = 0; |
586 | 586 | if (\OCP\App::isEnabled('files_versions')) { |
587 | - if ($view->is_dir('files_trashbin/versions/' . $file)) { |
|
588 | - $size += self::calculateSize(new View('/' . $user . '/files_trashbin/versions/' . $file)); |
|
589 | - $view->unlink('files_trashbin/versions/' . $file); |
|
587 | + if ($view->is_dir('files_trashbin/versions/'.$file)) { |
|
588 | + $size += self::calculateSize(new View('/'.$user.'/files_trashbin/versions/'.$file)); |
|
589 | + $view->unlink('files_trashbin/versions/'.$file); |
|
590 | 590 | } else if ($versions = self::getVersionsFromTrash($filename, $timestamp, $user)) { |
591 | 591 | foreach ($versions as $v) { |
592 | 592 | if ($timestamp) { |
593 | - $size += $view->filesize('/files_trashbin/versions/' . $filename . '.v' . $v . '.d' . $timestamp); |
|
594 | - $view->unlink('/files_trashbin/versions/' . $filename . '.v' . $v . '.d' . $timestamp); |
|
593 | + $size += $view->filesize('/files_trashbin/versions/'.$filename.'.v'.$v.'.d'.$timestamp); |
|
594 | + $view->unlink('/files_trashbin/versions/'.$filename.'.v'.$v.'.d'.$timestamp); |
|
595 | 595 | } else { |
596 | - $size += $view->filesize('/files_trashbin/versions/' . $filename . '.v' . $v); |
|
597 | - $view->unlink('/files_trashbin/versions/' . $filename . '.v' . $v); |
|
596 | + $size += $view->filesize('/files_trashbin/versions/'.$filename.'.v'.$v); |
|
597 | + $view->unlink('/files_trashbin/versions/'.$filename.'.v'.$v); |
|
598 | 598 | } |
599 | 599 | } |
600 | 600 | } |
@@ -611,15 +611,15 @@ discard block |
||
611 | 611 | */ |
612 | 612 | public static function file_exists($filename, $timestamp = null) { |
613 | 613 | $user = User::getUser(); |
614 | - $view = new View('/' . $user); |
|
614 | + $view = new View('/'.$user); |
|
615 | 615 | |
616 | 616 | if ($timestamp) { |
617 | - $filename = $filename . '.d' . $timestamp; |
|
617 | + $filename = $filename.'.d'.$timestamp; |
|
618 | 618 | } else { |
619 | 619 | $filename = $filename; |
620 | 620 | } |
621 | 621 | |
622 | - $target = Filesystem::normalizePath('files_trashbin/files/' . $filename); |
|
622 | + $target = Filesystem::normalizePath('files_trashbin/files/'.$filename); |
|
623 | 623 | return $view->file_exists($target); |
624 | 624 | } |
625 | 625 | |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | private static function calculateFreeSpace($trashbinSize, $user) { |
645 | 645 | $softQuota = true; |
646 | 646 | $userObject = \OC::$server->getUserManager()->get($user); |
647 | - if(is_null($userObject)) { |
|
647 | + if (is_null($userObject)) { |
|
648 | 648 | return 0; |
649 | 649 | } |
650 | 650 | $quota = $userObject->getQuota(); |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | // subtract size of files and current trash bin size from quota |
664 | 664 | if ($softQuota) { |
665 | 665 | $userFolder = \OC::$server->getUserFolder($user); |
666 | - if(is_null($userFolder)) { |
|
666 | + if (is_null($userFolder)) { |
|
667 | 667 | return 0; |
668 | 668 | } |
669 | 669 | $free = $quota - $userFolder->getSize(); // remaining free space for user |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | foreach ($files as $file) { |
746 | 746 | if ($availableSpace < 0 && $expiration->isExpired($file['mtime'], true)) { |
747 | 747 | $tmp = self::delete($file['name'], $user, $file['mtime']); |
748 | - \OCP\Util::writeLog('files_trashbin', 'remove "' . $file['name'] . '" (' . $tmp . 'B) to meet the limit of trash bin size (50% of available quota)', \OCP\Util::INFO); |
|
748 | + \OCP\Util::writeLog('files_trashbin', 'remove "'.$file['name'].'" ('.$tmp.'B) to meet the limit of trash bin size (50% of available quota)', \OCP\Util::INFO); |
|
749 | 749 | $availableSpace += $tmp; |
750 | 750 | $size += $tmp; |
751 | 751 | } else { |
@@ -775,7 +775,7 @@ discard block |
||
775 | 775 | $count++; |
776 | 776 | $size += self::delete($filename, $user, $timestamp); |
777 | 777 | \OC::$server->getLogger()->info( |
778 | - 'Remove "' . $filename . '" from trashbin because it exceeds max retention obligation term.', |
|
778 | + 'Remove "'.$filename.'" from trashbin because it exceeds max retention obligation term.', |
|
779 | 779 | ['app' => 'files_trashbin'] |
780 | 780 | ); |
781 | 781 | } else { |
@@ -801,16 +801,16 @@ discard block |
||
801 | 801 | $view->mkdir($destination); |
802 | 802 | $view->touch($destination, $view->filemtime($source)); |
803 | 803 | foreach ($view->getDirectoryContent($source) as $i) { |
804 | - $pathDir = $source . '/' . $i['name']; |
|
804 | + $pathDir = $source.'/'.$i['name']; |
|
805 | 805 | if ($view->is_dir($pathDir)) { |
806 | - $size += self::copy_recursive($pathDir, $destination . '/' . $i['name'], $view); |
|
806 | + $size += self::copy_recursive($pathDir, $destination.'/'.$i['name'], $view); |
|
807 | 807 | } else { |
808 | 808 | $size += $view->filesize($pathDir); |
809 | - $result = $view->copy($pathDir, $destination . '/' . $i['name']); |
|
809 | + $result = $view->copy($pathDir, $destination.'/'.$i['name']); |
|
810 | 810 | if (!$result) { |
811 | 811 | throw new \OCA\Files_Trashbin\Exceptions\CopyRecursiveException(); |
812 | 812 | } |
813 | - $view->touch($destination . '/' . $i['name'], $view->filemtime($pathDir)); |
|
813 | + $view->touch($destination.'/'.$i['name'], $view->filemtime($pathDir)); |
|
814 | 814 | } |
815 | 815 | } |
816 | 816 | } else { |
@@ -832,7 +832,7 @@ discard block |
||
832 | 832 | * @return array |
833 | 833 | */ |
834 | 834 | private static function getVersionsFromTrash($filename, $timestamp, $user) { |
835 | - $view = new View('/' . $user . '/files_trashbin/versions'); |
|
835 | + $view = new View('/'.$user.'/files_trashbin/versions'); |
|
836 | 836 | $versions = array(); |
837 | 837 | |
838 | 838 | //force rescan of versions, local storage may not have updated the cache |
@@ -845,10 +845,10 @@ discard block |
||
845 | 845 | |
846 | 846 | if ($timestamp) { |
847 | 847 | // fetch for old versions |
848 | - $matches = $view->searchRaw($filename . '.v%.d' . $timestamp); |
|
848 | + $matches = $view->searchRaw($filename.'.v%.d'.$timestamp); |
|
849 | 849 | $offset = -strlen($timestamp) - 2; |
850 | 850 | } else { |
851 | - $matches = $view->searchRaw($filename . '.v%'); |
|
851 | + $matches = $view->searchRaw($filename.'.v%'); |
|
852 | 852 | } |
853 | 853 | |
854 | 854 | if (is_array($matches)) { |
@@ -878,18 +878,18 @@ discard block |
||
878 | 878 | $name = pathinfo($filename, PATHINFO_FILENAME); |
879 | 879 | $l = \OC::$server->getL10N('files_trashbin'); |
880 | 880 | |
881 | - $location = '/' . trim($location, '/'); |
|
881 | + $location = '/'.trim($location, '/'); |
|
882 | 882 | |
883 | 883 | // if extension is not empty we set a dot in front of it |
884 | 884 | if ($ext !== '') { |
885 | - $ext = '.' . $ext; |
|
885 | + $ext = '.'.$ext; |
|
886 | 886 | } |
887 | 887 | |
888 | - if ($view->file_exists('files' . $location . '/' . $filename)) { |
|
888 | + if ($view->file_exists('files'.$location.'/'.$filename)) { |
|
889 | 889 | $i = 2; |
890 | - $uniqueName = $name . " (" . $l->t("restored") . ")" . $ext; |
|
891 | - while ($view->file_exists('files' . $location . '/' . $uniqueName)) { |
|
892 | - $uniqueName = $name . " (" . $l->t("restored") . " " . $i . ")" . $ext; |
|
890 | + $uniqueName = $name." (".$l->t("restored").")".$ext; |
|
891 | + while ($view->file_exists('files'.$location.'/'.$uniqueName)) { |
|
892 | + $uniqueName = $name." (".$l->t("restored")." ".$i.")".$ext; |
|
893 | 893 | $i++; |
894 | 894 | } |
895 | 895 | |
@@ -906,7 +906,7 @@ discard block |
||
906 | 906 | * @return integer size of the folder |
907 | 907 | */ |
908 | 908 | private static function calculateSize($view) { |
909 | - $root = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . $view->getAbsolutePath(''); |
|
909 | + $root = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').$view->getAbsolutePath(''); |
|
910 | 910 | if (!file_exists($root)) { |
911 | 911 | return 0; |
912 | 912 | } |
@@ -937,7 +937,7 @@ discard block |
||
937 | 937 | * @return integer trash bin size |
938 | 938 | */ |
939 | 939 | private static function getTrashbinSize($user) { |
940 | - $view = new View('/' . $user); |
|
940 | + $view = new View('/'.$user); |
|
941 | 941 | $fileInfo = $view->getFileInfo('/files_trashbin'); |
942 | 942 | return isset($fileInfo['size']) ? $fileInfo['size'] : 0; |
943 | 943 | } |
@@ -966,7 +966,7 @@ discard block |
||
966 | 966 | */ |
967 | 967 | public static function isEmpty($user) { |
968 | 968 | |
969 | - $view = new View('/' . $user . '/files_trashbin'); |
|
969 | + $view = new View('/'.$user.'/files_trashbin'); |
|
970 | 970 | if ($view->is_dir('/files') && $dh = $view->opendir('/files')) { |
971 | 971 | while ($file = readdir($dh)) { |
972 | 972 | if (!Filesystem::isIgnoredDir($file)) { |