@@ -3,11 +3,11 @@ |
||
| 3 | 3 | /** @var $l \OCP\IL10N */ |
| 4 | 4 | /** @var $theme OCP\Defaults */ |
| 5 | 5 | // @codeCoverageIgnoreStart |
| 6 | -if(!isset($_)) {//standalone page is not supported anymore - redirect to / |
|
| 6 | +if (!isset($_)) {//standalone page is not supported anymore - redirect to / |
|
| 7 | 7 | require_once '../../lib/base.php'; |
| 8 | 8 | |
| 9 | 9 | $urlGenerator = \OC::$server->getURLGenerator(); |
| 10 | - header('Location: ' . $urlGenerator->getAbsoluteURL('/')); |
|
| 10 | + header('Location: '.$urlGenerator->getAbsoluteURL('/')); |
|
| 11 | 11 | exit; |
| 12 | 12 | } |
| 13 | 13 | // @codeCoverageIgnoreEnd |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | $config = \OC::$server->getConfig(); |
| 25 | 25 | $state = $config->getSystemValue('ldapIgnoreNamingRules', 'doSet'); |
| 26 | -if($state === 'doSet') { |
|
| 26 | +if ($state === 'doSet') { |
|
| 27 | 27 | OCP\Config::setSystemValue('ldapIgnoreNamingRules', false); |
| 28 | 28 | } |
| 29 | 29 | |
@@ -41,20 +41,20 @@ |
||
| 41 | 41 | |
| 42 | 42 | $tmpDir = \OC::$server->getTempManager()->getTempBaseDir(); |
| 43 | 43 | |
| 44 | - $defaultParameters = ' -env:UserInstallation=file://' . escapeshellarg($tmpDir . '/owncloud-' . \OC_Util::getInstanceId() . '/') . ' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to pdf --outdir '; |
|
| 44 | + $defaultParameters = ' -env:UserInstallation=file://'.escapeshellarg($tmpDir.'/owncloud-'.\OC_Util::getInstanceId().'/').' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to pdf --outdir '; |
|
| 45 | 45 | $clParameters = \OC::$server->getConfig()->getSystemValue('preview_office_cl_parameters', $defaultParameters); |
| 46 | 46 | |
| 47 | - $exec = $this->cmd . $clParameters . escapeshellarg($tmpDir) . ' ' . escapeshellarg($absPath); |
|
| 47 | + $exec = $this->cmd.$clParameters.escapeshellarg($tmpDir).' '.escapeshellarg($absPath); |
|
| 48 | 48 | |
| 49 | 49 | shell_exec($exec); |
| 50 | 50 | |
| 51 | 51 | //create imagick object from pdf |
| 52 | 52 | $pdfPreview = null; |
| 53 | 53 | try { |
| 54 | - list($dirname, , , $filename) = array_values(pathinfo($absPath)); |
|
| 55 | - $pdfPreview = $dirname . '/' . $filename . '.pdf'; |
|
| 54 | + list($dirname,,, $filename) = array_values(pathinfo($absPath)); |
|
| 55 | + $pdfPreview = $dirname.'/'.$filename.'.pdf'; |
|
| 56 | 56 | |
| 57 | - $pdf = new \imagick($pdfPreview . '[0]'); |
|
| 57 | + $pdf = new \imagick($pdfPreview.'[0]'); |
|
| 58 | 58 | $pdf->setImageFormat('jpg'); |
| 59 | 59 | } catch (\Exception $e) { |
| 60 | 60 | unlink($absPath); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | public function getKey(IUser $user) { |
| 124 | 124 | $uid = $user->getUID(); |
| 125 | - return $this->retrieveKey('user-' . $uid); |
|
| 125 | + return $this->retrieveKey('user-'.$uid); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /** |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | if ($instanceId === null) { |
| 137 | 137 | throw new \RuntimeException('no instance id!'); |
| 138 | 138 | } |
| 139 | - return $this->retrieveKey('system-' . $instanceId); |
|
| 139 | + return $this->retrieveKey('system-'.$instanceId); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | |
@@ -25,6 +25,6 @@ |
||
| 25 | 25 | |
| 26 | 26 | class PgSqlFunctionBuilder extends FunctionBuilder { |
| 27 | 27 | public function concat($x, $y) { |
| 28 | - return new QueryFunction('(' . $this->helper->quoteColumnName($x) . ' || ' . $this->helper->quoteColumnName($y) . ')'); |
|
| 28 | + return new QueryFunction('('.$this->helper->quoteColumnName($x).' || '.$this->helper->quoteColumnName($y).')'); |
|
| 29 | 29 | } |
| 30 | 30 | } |
@@ -25,6 +25,6 @@ |
||
| 25 | 25 | |
| 26 | 26 | class SqliteFunctionBuilder extends FunctionBuilder { |
| 27 | 27 | public function concat($x, $y) { |
| 28 | - return new QueryFunction('(' . $this->helper->quoteColumnName($x) . ' || ' . $this->helper->quoteColumnName($y) . ')'); |
|
| 28 | + return new QueryFunction('('.$this->helper->quoteColumnName($x).' || '.$this->helper->quoteColumnName($y).')'); |
|
| 29 | 29 | } |
| 30 | 30 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | Filesystem::initMountPoints($uid); |
| 98 | 98 | if ($uid !== User::getUser()) { |
| 99 | 99 | $info = Filesystem::getFileInfo($filename); |
| 100 | - $ownerView = new View('/' . $uid . '/files'); |
|
| 100 | + $ownerView = new View('/'.$uid.'/files'); |
|
| 101 | 101 | try { |
| 102 | 102 | $filename = $ownerView->getPath($info['fileid']); |
| 103 | 103 | } catch (NotFoundException $e) { |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | private static function setUpTrash($user) { |
| 151 | - $view = new View('/' . $user); |
|
| 151 | + $view = new View('/'.$user); |
|
| 152 | 152 | if (!$view->is_dir('files_trashbin')) { |
| 153 | 153 | $view->mkdir('files_trashbin'); |
| 154 | 154 | } |
@@ -183,8 +183,8 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | $view = new View('/'); |
| 185 | 185 | |
| 186 | - $target = $user . '/files_trashbin/files/' . $targetFilename . '.d' . $timestamp; |
|
| 187 | - $source = $owner . '/files_trashbin/files/' . $sourceFilename . '.d' . $timestamp; |
|
| 186 | + $target = $user.'/files_trashbin/files/'.$targetFilename.'.d'.$timestamp; |
|
| 187 | + $source = $owner.'/files_trashbin/files/'.$sourceFilename.'.d'.$timestamp; |
|
| 188 | 188 | self::copy_recursive($source, $target, $view); |
| 189 | 189 | |
| 190 | 190 | |
@@ -218,9 +218,9 @@ discard block |
||
| 218 | 218 | $ownerPath = $file_path; |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - $ownerView = new View('/' . $owner); |
|
| 221 | + $ownerView = new View('/'.$owner); |
|
| 222 | 222 | // file has been deleted in between |
| 223 | - if (is_null($ownerPath) || $ownerPath === '' || !$ownerView->file_exists('/files/' . $ownerPath)) { |
|
| 223 | + if (is_null($ownerPath) || $ownerPath === '' || !$ownerView->file_exists('/files/'.$ownerPath)) { |
|
| 224 | 224 | return true; |
| 225 | 225 | } |
| 226 | 226 | |
@@ -237,12 +237,12 @@ discard block |
||
| 237 | 237 | $timestamp = time(); |
| 238 | 238 | |
| 239 | 239 | // disable proxy to prevent recursive calls |
| 240 | - $trashPath = '/files_trashbin/files/' . $filename . '.d' . $timestamp; |
|
| 240 | + $trashPath = '/files_trashbin/files/'.$filename.'.d'.$timestamp; |
|
| 241 | 241 | |
| 242 | 242 | /** @var \OC\Files\Storage\Storage $trashStorage */ |
| 243 | 243 | list($trashStorage, $trashInternalPath) = $ownerView->resolvePath($trashPath); |
| 244 | 244 | /** @var \OC\Files\Storage\Storage $sourceStorage */ |
| 245 | - list($sourceStorage, $sourceInternalPath) = $ownerView->resolvePath('/files/' . $ownerPath); |
|
| 245 | + list($sourceStorage, $sourceInternalPath) = $ownerView->resolvePath('/files/'.$ownerPath); |
|
| 246 | 246 | try { |
| 247 | 247 | $moveSuccessful = true; |
| 248 | 248 | if ($trashStorage->file_exists($trashInternalPath)) { |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | if ($trashStorage->file_exists($trashInternalPath)) { |
| 255 | 255 | $trashStorage->unlink($trashInternalPath); |
| 256 | 256 | } |
| 257 | - \OCP\Util::writeLog('files_trashbin', 'Couldn\'t move ' . $file_path . ' to the trash bin', \OCP\Util::ERROR); |
|
| 257 | + \OCP\Util::writeLog('files_trashbin', 'Couldn\'t move '.$file_path.' to the trash bin', \OCP\Util::ERROR); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | if ($sourceStorage->file_exists($sourceInternalPath)) { // failed to delete the original file, abort |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | \OCP\Util::writeLog('files_trashbin', 'trash bin database couldn\'t be updated', \OCP\Util::ERROR); |
| 276 | 276 | } |
| 277 | 277 | \OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_moveToTrash', array('filePath' => Filesystem::normalizePath($file_path), |
| 278 | - 'trashPath' => Filesystem::normalizePath($filename . '.d' . $timestamp))); |
|
| 278 | + 'trashPath' => Filesystem::normalizePath($filename.'.d'.$timestamp))); |
|
| 279 | 279 | |
| 280 | 280 | self::retainVersions($filename, $owner, $ownerPath, $timestamp); |
| 281 | 281 | |
@@ -309,18 +309,18 @@ discard block |
||
| 309 | 309 | $user = User::getUser(); |
| 310 | 310 | $rootView = new View('/'); |
| 311 | 311 | |
| 312 | - if ($rootView->is_dir($owner . '/files_versions/' . $ownerPath)) { |
|
| 312 | + if ($rootView->is_dir($owner.'/files_versions/'.$ownerPath)) { |
|
| 313 | 313 | if ($owner !== $user) { |
| 314 | - self::copy_recursive($owner . '/files_versions/' . $ownerPath, $owner . '/files_trashbin/versions/' . basename($ownerPath) . '.d' . $timestamp, $rootView); |
|
| 314 | + self::copy_recursive($owner.'/files_versions/'.$ownerPath, $owner.'/files_trashbin/versions/'.basename($ownerPath).'.d'.$timestamp, $rootView); |
|
| 315 | 315 | } |
| 316 | - self::move($rootView, $owner . '/files_versions/' . $ownerPath, $user . '/files_trashbin/versions/' . $filename . '.d' . $timestamp); |
|
| 316 | + self::move($rootView, $owner.'/files_versions/'.$ownerPath, $user.'/files_trashbin/versions/'.$filename.'.d'.$timestamp); |
|
| 317 | 317 | } else if ($versions = \OCA\Files_Versions\Storage::getVersions($owner, $ownerPath)) { |
| 318 | 318 | |
| 319 | 319 | foreach ($versions as $v) { |
| 320 | 320 | if ($owner !== $user) { |
| 321 | - self::copy($rootView, $owner . '/files_versions' . $v['path'] . '.v' . $v['version'], $owner . '/files_trashbin/versions/' . $v['name'] . '.v' . $v['version'] . '.d' . $timestamp); |
|
| 321 | + self::copy($rootView, $owner.'/files_versions'.$v['path'].'.v'.$v['version'], $owner.'/files_trashbin/versions/'.$v['name'].'.v'.$v['version'].'.d'.$timestamp); |
|
| 322 | 322 | } |
| 323 | - self::move($rootView, $owner . '/files_versions' . $v['path'] . '.v' . $v['version'], $user . '/files_trashbin/versions/' . $filename . '.v' . $v['version'] . '.d' . $timestamp); |
|
| 323 | + self::move($rootView, $owner.'/files_versions'.$v['path'].'.v'.$v['version'], $user.'/files_trashbin/versions/'.$filename.'.v'.$v['version'].'.d'.$timestamp); |
|
| 324 | 324 | } |
| 325 | 325 | } |
| 326 | 326 | } |
@@ -382,18 +382,18 @@ discard block |
||
| 382 | 382 | */ |
| 383 | 383 | public static function restore($file, $filename, $timestamp) { |
| 384 | 384 | $user = User::getUser(); |
| 385 | - $view = new View('/' . $user); |
|
| 385 | + $view = new View('/'.$user); |
|
| 386 | 386 | |
| 387 | 387 | $location = ''; |
| 388 | 388 | if ($timestamp) { |
| 389 | 389 | $location = self::getLocation($user, $filename, $timestamp); |
| 390 | 390 | if ($location === false) { |
| 391 | - \OCP\Util::writeLog('files_trashbin', 'trash bin database inconsistent! ($user: ' . $user . ' $filename: ' . $filename . ', $timestamp: ' . $timestamp . ')', \OCP\Util::ERROR); |
|
| 391 | + \OCP\Util::writeLog('files_trashbin', 'trash bin database inconsistent! ($user: '.$user.' $filename: '.$filename.', $timestamp: '.$timestamp.')', \OCP\Util::ERROR); |
|
| 392 | 392 | } else { |
| 393 | 393 | // if location no longer exists, restore file in the root directory |
| 394 | 394 | if ($location !== '/' && |
| 395 | - (!$view->is_dir('files/' . $location) || |
|
| 396 | - !$view->isCreatable('files/' . $location)) |
|
| 395 | + (!$view->is_dir('files/'.$location) || |
|
| 396 | + !$view->isCreatable('files/'.$location)) |
|
| 397 | 397 | ) { |
| 398 | 398 | $location = ''; |
| 399 | 399 | } |
@@ -403,8 +403,8 @@ discard block |
||
| 403 | 403 | // we need a extension in case a file/dir with the same name already exists |
| 404 | 404 | $uniqueFilename = self::getUniqueFilename($location, $filename, $view); |
| 405 | 405 | |
| 406 | - $source = Filesystem::normalizePath('files_trashbin/files/' . $file); |
|
| 407 | - $target = Filesystem::normalizePath('files/' . $location . '/' . $uniqueFilename); |
|
| 406 | + $source = Filesystem::normalizePath('files_trashbin/files/'.$file); |
|
| 407 | + $target = Filesystem::normalizePath('files/'.$location.'/'.$uniqueFilename); |
|
| 408 | 408 | if (!$view->file_exists($source)) { |
| 409 | 409 | return false; |
| 410 | 410 | } |
@@ -416,10 +416,10 @@ discard block |
||
| 416 | 416 | // handle the restore result |
| 417 | 417 | if ($restoreResult) { |
| 418 | 418 | $fakeRoot = $view->getRoot(); |
| 419 | - $view->chroot('/' . $user . '/files'); |
|
| 420 | - $view->touch('/' . $location . '/' . $uniqueFilename, $mtime); |
|
| 419 | + $view->chroot('/'.$user.'/files'); |
|
| 420 | + $view->touch('/'.$location.'/'.$uniqueFilename, $mtime); |
|
| 421 | 421 | $view->chroot($fakeRoot); |
| 422 | - \OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', array('filePath' => Filesystem::normalizePath('/' . $location . '/' . $uniqueFilename), |
|
| 422 | + \OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', array('filePath' => Filesystem::normalizePath('/'.$location.'/'.$uniqueFilename), |
|
| 423 | 423 | 'trashPath' => Filesystem::normalizePath($file))); |
| 424 | 424 | |
| 425 | 425 | self::restoreVersions($view, $file, $filename, $uniqueFilename, $location, $timestamp); |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | $user = User::getUser(); |
| 454 | 454 | $rootView = new View('/'); |
| 455 | 455 | |
| 456 | - $target = Filesystem::normalizePath('/' . $location . '/' . $uniqueFilename); |
|
| 456 | + $target = Filesystem::normalizePath('/'.$location.'/'.$uniqueFilename); |
|
| 457 | 457 | |
| 458 | 458 | list($owner, $ownerPath) = self::getUidAndFilename($target); |
| 459 | 459 | |
@@ -468,14 +468,14 @@ discard block |
||
| 468 | 468 | $versionedFile = $file; |
| 469 | 469 | } |
| 470 | 470 | |
| 471 | - if ($view->is_dir('/files_trashbin/versions/' . $file)) { |
|
| 472 | - $rootView->rename(Filesystem::normalizePath($user . '/files_trashbin/versions/' . $file), Filesystem::normalizePath($owner . '/files_versions/' . $ownerPath)); |
|
| 471 | + if ($view->is_dir('/files_trashbin/versions/'.$file)) { |
|
| 472 | + $rootView->rename(Filesystem::normalizePath($user.'/files_trashbin/versions/'.$file), Filesystem::normalizePath($owner.'/files_versions/'.$ownerPath)); |
|
| 473 | 473 | } else if ($versions = self::getVersionsFromTrash($versionedFile, $timestamp, $user)) { |
| 474 | 474 | foreach ($versions as $v) { |
| 475 | 475 | if ($timestamp) { |
| 476 | - $rootView->rename($user . '/files_trashbin/versions/' . $versionedFile . '.v' . $v . '.d' . $timestamp, $owner . '/files_versions/' . $ownerPath . '.v' . $v); |
|
| 476 | + $rootView->rename($user.'/files_trashbin/versions/'.$versionedFile.'.v'.$v.'.d'.$timestamp, $owner.'/files_versions/'.$ownerPath.'.v'.$v); |
|
| 477 | 477 | } else { |
| 478 | - $rootView->rename($user . '/files_trashbin/versions/' . $versionedFile . '.v' . $v, $owner . '/files_versions/' . $ownerPath . '.v' . $v); |
|
| 478 | + $rootView->rename($user.'/files_trashbin/versions/'.$versionedFile.'.v'.$v, $owner.'/files_versions/'.$ownerPath.'.v'.$v); |
|
| 479 | 479 | } |
| 480 | 480 | } |
| 481 | 481 | } |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | public static function deleteAll() { |
| 489 | 489 | $user = User::getUser(); |
| 490 | 490 | $userRoot = \OC::$server->getUserFolder($user)->getParent(); |
| 491 | - $view = new View('/' . $user); |
|
| 491 | + $view = new View('/'.$user); |
|
| 492 | 492 | $fileInfos = $view->getDirectoryContent('files_trashbin/files'); |
| 493 | 493 | |
| 494 | 494 | try { |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | |
| 500 | 500 | // Array to store the relative path in (after the file is deleted, the view won't be able to relativise the path anymore) |
| 501 | 501 | $filePaths = array(); |
| 502 | - foreach($fileInfos as $fileInfo){ |
|
| 502 | + foreach ($fileInfos as $fileInfo) { |
|
| 503 | 503 | $filePaths[] = $view->getRelativePath($fileInfo->getPath()); |
| 504 | 504 | } |
| 505 | 505 | unset($fileInfos); // save memory |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | \OC_Hook::emit('\OCP\Trashbin', 'preDeleteAll', array('paths' => $filePaths)); |
| 509 | 509 | |
| 510 | 510 | // Single-File Hooks |
| 511 | - foreach($filePaths as $path){ |
|
| 511 | + foreach ($filePaths as $path) { |
|
| 512 | 512 | self::emitTrashbinPreDelete($path); |
| 513 | 513 | } |
| 514 | 514 | |
@@ -521,7 +521,7 @@ discard block |
||
| 521 | 521 | \OC_Hook::emit('\OCP\Trashbin', 'deleteAll', array('paths' => $filePaths)); |
| 522 | 522 | |
| 523 | 523 | // Single-File Hooks |
| 524 | - foreach($filePaths as $path){ |
|
| 524 | + foreach ($filePaths as $path) { |
|
| 525 | 525 | self::emitTrashbinPostDelete($path); |
| 526 | 526 | } |
| 527 | 527 | |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | * wrapper function to emit the 'preDelete' hook of \OCP\Trashbin before a file is deleted |
| 536 | 536 | * @param string $path |
| 537 | 537 | */ |
| 538 | - protected static function emitTrashbinPreDelete($path){ |
|
| 538 | + protected static function emitTrashbinPreDelete($path) { |
|
| 539 | 539 | \OC_Hook::emit('\OCP\Trashbin', 'preDelete', array('path' => $path)); |
| 540 | 540 | } |
| 541 | 541 | |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | * wrapper function to emit the 'delete' hook of \OCP\Trashbin after a file has been deleted |
| 544 | 544 | * @param string $path |
| 545 | 545 | */ |
| 546 | - protected static function emitTrashbinPostDelete($path){ |
|
| 546 | + protected static function emitTrashbinPostDelete($path) { |
|
| 547 | 547 | \OC_Hook::emit('\OCP\Trashbin', 'delete', array('path' => $path)); |
| 548 | 548 | } |
| 549 | 549 | |
@@ -558,13 +558,13 @@ discard block |
||
| 558 | 558 | */ |
| 559 | 559 | public static function delete($filename, $user, $timestamp = null) { |
| 560 | 560 | $userRoot = \OC::$server->getUserFolder($user)->getParent(); |
| 561 | - $view = new View('/' . $user); |
|
| 561 | + $view = new View('/'.$user); |
|
| 562 | 562 | $size = 0; |
| 563 | 563 | |
| 564 | 564 | if ($timestamp) { |
| 565 | 565 | $query = \OC_DB::prepare('DELETE FROM `*PREFIX*files_trash` WHERE `user`=? AND `id`=? AND `timestamp`=?'); |
| 566 | 566 | $query->execute(array($user, $filename, $timestamp)); |
| 567 | - $file = $filename . '.d' . $timestamp; |
|
| 567 | + $file = $filename.'.d'.$timestamp; |
|
| 568 | 568 | } else { |
| 569 | 569 | $file = $filename; |
| 570 | 570 | } |
@@ -572,20 +572,20 @@ discard block |
||
| 572 | 572 | $size += self::deleteVersions($view, $file, $filename, $timestamp, $user); |
| 573 | 573 | |
| 574 | 574 | try { |
| 575 | - $node = $userRoot->get('/files_trashbin/files/' . $file); |
|
| 575 | + $node = $userRoot->get('/files_trashbin/files/'.$file); |
|
| 576 | 576 | } catch (NotFoundException $e) { |
| 577 | 577 | return $size; |
| 578 | 578 | } |
| 579 | 579 | |
| 580 | 580 | if ($node instanceof Folder) { |
| 581 | - $size += self::calculateSize(new View('/' . $user . '/files_trashbin/files/' . $file)); |
|
| 581 | + $size += self::calculateSize(new View('/'.$user.'/files_trashbin/files/'.$file)); |
|
| 582 | 582 | } else if ($node instanceof File) { |
| 583 | - $size += $view->filesize('/files_trashbin/files/' . $file); |
|
| 583 | + $size += $view->filesize('/files_trashbin/files/'.$file); |
|
| 584 | 584 | } |
| 585 | 585 | |
| 586 | - self::emitTrashbinPreDelete('/files_trashbin/files/' . $file); |
|
| 586 | + self::emitTrashbinPreDelete('/files_trashbin/files/'.$file); |
|
| 587 | 587 | $node->delete(); |
| 588 | - self::emitTrashbinPostDelete('/files_trashbin/files/' . $file); |
|
| 588 | + self::emitTrashbinPostDelete('/files_trashbin/files/'.$file); |
|
| 589 | 589 | |
| 590 | 590 | return $size; |
| 591 | 591 | } |
@@ -601,17 +601,17 @@ discard block |
||
| 601 | 601 | private static function deleteVersions(View $view, $file, $filename, $timestamp, $user) { |
| 602 | 602 | $size = 0; |
| 603 | 603 | if (\OCP\App::isEnabled('files_versions')) { |
| 604 | - if ($view->is_dir('files_trashbin/versions/' . $file)) { |
|
| 605 | - $size += self::calculateSize(new View('/' . $user . '/files_trashbin/versions/' . $file)); |
|
| 606 | - $view->unlink('files_trashbin/versions/' . $file); |
|
| 604 | + if ($view->is_dir('files_trashbin/versions/'.$file)) { |
|
| 605 | + $size += self::calculateSize(new View('/'.$user.'/files_trashbin/versions/'.$file)); |
|
| 606 | + $view->unlink('files_trashbin/versions/'.$file); |
|
| 607 | 607 | } else if ($versions = self::getVersionsFromTrash($filename, $timestamp, $user)) { |
| 608 | 608 | foreach ($versions as $v) { |
| 609 | 609 | if ($timestamp) { |
| 610 | - $size += $view->filesize('/files_trashbin/versions/' . $filename . '.v' . $v . '.d' . $timestamp); |
|
| 611 | - $view->unlink('/files_trashbin/versions/' . $filename . '.v' . $v . '.d' . $timestamp); |
|
| 610 | + $size += $view->filesize('/files_trashbin/versions/'.$filename.'.v'.$v.'.d'.$timestamp); |
|
| 611 | + $view->unlink('/files_trashbin/versions/'.$filename.'.v'.$v.'.d'.$timestamp); |
|
| 612 | 612 | } else { |
| 613 | - $size += $view->filesize('/files_trashbin/versions/' . $filename . '.v' . $v); |
|
| 614 | - $view->unlink('/files_trashbin/versions/' . $filename . '.v' . $v); |
|
| 613 | + $size += $view->filesize('/files_trashbin/versions/'.$filename.'.v'.$v); |
|
| 614 | + $view->unlink('/files_trashbin/versions/'.$filename.'.v'.$v); |
|
| 615 | 615 | } |
| 616 | 616 | } |
| 617 | 617 | } |
@@ -628,15 +628,15 @@ discard block |
||
| 628 | 628 | */ |
| 629 | 629 | public static function file_exists($filename, $timestamp = null) { |
| 630 | 630 | $user = User::getUser(); |
| 631 | - $view = new View('/' . $user); |
|
| 631 | + $view = new View('/'.$user); |
|
| 632 | 632 | |
| 633 | 633 | if ($timestamp) { |
| 634 | - $filename = $filename . '.d' . $timestamp; |
|
| 634 | + $filename = $filename.'.d'.$timestamp; |
|
| 635 | 635 | } else { |
| 636 | 636 | $filename = $filename; |
| 637 | 637 | } |
| 638 | 638 | |
| 639 | - $target = Filesystem::normalizePath('files_trashbin/files/' . $filename); |
|
| 639 | + $target = Filesystem::normalizePath('files_trashbin/files/'.$filename); |
|
| 640 | 640 | return $view->file_exists($target); |
| 641 | 641 | } |
| 642 | 642 | |
@@ -661,7 +661,7 @@ discard block |
||
| 661 | 661 | private static function calculateFreeSpace($trashbinSize, $user) { |
| 662 | 662 | $softQuota = true; |
| 663 | 663 | $userObject = \OC::$server->getUserManager()->get($user); |
| 664 | - if(is_null($userObject)) { |
|
| 664 | + if (is_null($userObject)) { |
|
| 665 | 665 | return 0; |
| 666 | 666 | } |
| 667 | 667 | $quota = $userObject->getQuota(); |
@@ -680,7 +680,7 @@ discard block |
||
| 680 | 680 | // subtract size of files and current trash bin size from quota |
| 681 | 681 | if ($softQuota) { |
| 682 | 682 | $userFolder = \OC::$server->getUserFolder($user); |
| 683 | - if(is_null($userFolder)) { |
|
| 683 | + if (is_null($userFolder)) { |
|
| 684 | 684 | return 0; |
| 685 | 685 | } |
| 686 | 686 | $free = $quota - $userFolder->getSize(); // remaining free space for user |
@@ -762,7 +762,7 @@ discard block |
||
| 762 | 762 | foreach ($files as $file) { |
| 763 | 763 | if ($availableSpace < 0 && $expiration->isExpired($file['mtime'], true)) { |
| 764 | 764 | $tmp = self::delete($file['name'], $user, $file['mtime']); |
| 765 | - \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); |
|
| 765 | + \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); |
|
| 766 | 766 | $availableSpace += $tmp; |
| 767 | 767 | $size += $tmp; |
| 768 | 768 | } else { |
@@ -792,7 +792,7 @@ discard block |
||
| 792 | 792 | $count++; |
| 793 | 793 | $size += self::delete($filename, $user, $timestamp); |
| 794 | 794 | \OC::$server->getLogger()->info( |
| 795 | - 'Remove "' . $filename . '" from trashbin because it exceeds max retention obligation term.', |
|
| 795 | + 'Remove "'.$filename.'" from trashbin because it exceeds max retention obligation term.', |
|
| 796 | 796 | ['app' => 'files_trashbin'] |
| 797 | 797 | ); |
| 798 | 798 | } else { |
@@ -818,16 +818,16 @@ discard block |
||
| 818 | 818 | $view->mkdir($destination); |
| 819 | 819 | $view->touch($destination, $view->filemtime($source)); |
| 820 | 820 | foreach ($view->getDirectoryContent($source) as $i) { |
| 821 | - $pathDir = $source . '/' . $i['name']; |
|
| 821 | + $pathDir = $source.'/'.$i['name']; |
|
| 822 | 822 | if ($view->is_dir($pathDir)) { |
| 823 | - $size += self::copy_recursive($pathDir, $destination . '/' . $i['name'], $view); |
|
| 823 | + $size += self::copy_recursive($pathDir, $destination.'/'.$i['name'], $view); |
|
| 824 | 824 | } else { |
| 825 | 825 | $size += $view->filesize($pathDir); |
| 826 | - $result = $view->copy($pathDir, $destination . '/' . $i['name']); |
|
| 826 | + $result = $view->copy($pathDir, $destination.'/'.$i['name']); |
|
| 827 | 827 | if (!$result) { |
| 828 | 828 | throw new \OCA\Files_Trashbin\Exceptions\CopyRecursiveException(); |
| 829 | 829 | } |
| 830 | - $view->touch($destination . '/' . $i['name'], $view->filemtime($pathDir)); |
|
| 830 | + $view->touch($destination.'/'.$i['name'], $view->filemtime($pathDir)); |
|
| 831 | 831 | } |
| 832 | 832 | } |
| 833 | 833 | } else { |
@@ -849,7 +849,7 @@ discard block |
||
| 849 | 849 | * @return array |
| 850 | 850 | */ |
| 851 | 851 | private static function getVersionsFromTrash($filename, $timestamp, $user) { |
| 852 | - $view = new View('/' . $user . '/files_trashbin/versions'); |
|
| 852 | + $view = new View('/'.$user.'/files_trashbin/versions'); |
|
| 853 | 853 | $versions = array(); |
| 854 | 854 | |
| 855 | 855 | //force rescan of versions, local storage may not have updated the cache |
@@ -862,10 +862,10 @@ discard block |
||
| 862 | 862 | |
| 863 | 863 | if ($timestamp) { |
| 864 | 864 | // fetch for old versions |
| 865 | - $matches = $view->searchRaw($filename . '.v%.d' . $timestamp); |
|
| 865 | + $matches = $view->searchRaw($filename.'.v%.d'.$timestamp); |
|
| 866 | 866 | $offset = -strlen($timestamp) - 2; |
| 867 | 867 | } else { |
| 868 | - $matches = $view->searchRaw($filename . '.v%'); |
|
| 868 | + $matches = $view->searchRaw($filename.'.v%'); |
|
| 869 | 869 | } |
| 870 | 870 | |
| 871 | 871 | if (is_array($matches)) { |
@@ -895,18 +895,18 @@ discard block |
||
| 895 | 895 | $name = pathinfo($filename, PATHINFO_FILENAME); |
| 896 | 896 | $l = \OC::$server->getL10N('files_trashbin'); |
| 897 | 897 | |
| 898 | - $location = '/' . trim($location, '/'); |
|
| 898 | + $location = '/'.trim($location, '/'); |
|
| 899 | 899 | |
| 900 | 900 | // if extension is not empty we set a dot in front of it |
| 901 | 901 | if ($ext !== '') { |
| 902 | - $ext = '.' . $ext; |
|
| 902 | + $ext = '.'.$ext; |
|
| 903 | 903 | } |
| 904 | 904 | |
| 905 | - if ($view->file_exists('files' . $location . '/' . $filename)) { |
|
| 905 | + if ($view->file_exists('files'.$location.'/'.$filename)) { |
|
| 906 | 906 | $i = 2; |
| 907 | - $uniqueName = $name . " (" . $l->t("restored") . ")" . $ext; |
|
| 908 | - while ($view->file_exists('files' . $location . '/' . $uniqueName)) { |
|
| 909 | - $uniqueName = $name . " (" . $l->t("restored") . " " . $i . ")" . $ext; |
|
| 907 | + $uniqueName = $name." (".$l->t("restored").")".$ext; |
|
| 908 | + while ($view->file_exists('files'.$location.'/'.$uniqueName)) { |
|
| 909 | + $uniqueName = $name." (".$l->t("restored")." ".$i.")".$ext; |
|
| 910 | 910 | $i++; |
| 911 | 911 | } |
| 912 | 912 | |
@@ -923,7 +923,7 @@ discard block |
||
| 923 | 923 | * @return integer size of the folder |
| 924 | 924 | */ |
| 925 | 925 | private static function calculateSize($view) { |
| 926 | - $root = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . $view->getAbsolutePath(''); |
|
| 926 | + $root = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').$view->getAbsolutePath(''); |
|
| 927 | 927 | if (!file_exists($root)) { |
| 928 | 928 | return 0; |
| 929 | 929 | } |
@@ -954,7 +954,7 @@ discard block |
||
| 954 | 954 | * @return integer trash bin size |
| 955 | 955 | */ |
| 956 | 956 | private static function getTrashbinSize($user) { |
| 957 | - $view = new View('/' . $user); |
|
| 957 | + $view = new View('/'.$user); |
|
| 958 | 958 | $fileInfo = $view->getFileInfo('/files_trashbin'); |
| 959 | 959 | return isset($fileInfo['size']) ? $fileInfo['size'] : 0; |
| 960 | 960 | } |
@@ -983,7 +983,7 @@ discard block |
||
| 983 | 983 | */ |
| 984 | 984 | public static function isEmpty($user) { |
| 985 | 985 | |
| 986 | - $view = new View('/' . $user . '/files_trashbin'); |
|
| 986 | + $view = new View('/'.$user.'/files_trashbin'); |
|
| 987 | 987 | if ($view->is_dir('/files') && $dh = $view->opendir('/files')) { |
| 988 | 988 | while ($file = readdir($dh)) { |
| 989 | 989 | if (!Filesystem::isIgnoredDir($file)) { |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | protected function execute(InputInterface $input, OutputInterface $output) { |
| 64 | - if ($input->getOption('shipped') === 'true' || $input->getOption('shipped') === 'false'){ |
|
| 64 | + if ($input->getOption('shipped') === 'true' || $input->getOption('shipped') === 'false') { |
|
| 65 | 65 | $shippedFilter = $input->getOption('shipped') === 'true'; |
| 66 | 66 | } else { |
| 67 | 67 | $shippedFilter = null; |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | //sort enabled apps above disabled apps |
| 75 | 75 | foreach ($apps as $app) { |
| 76 | - if ($shippedFilter !== null && $this->manager->isShipped($app) !== $shippedFilter){ |
|
| 76 | + if ($shippedFilter !== null && $this->manager->isShipped($app) !== $shippedFilter) { |
|
| 77 | 77 | continue; |
| 78 | 78 | } |
| 79 | 79 | if ($this->manager->isInstalled($app)) { |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | <label for="release-channel"><?php p($l->t('Update channel:')) ?></label> |
| 47 | 47 | <select id="release-channel"> |
| 48 | 48 | <option value="<?php p($currentChannel); ?>"><?php p($currentChannel); ?></option> |
| 49 | - <?php foreach ($channels as $channel => $channelTitle){ ?> |
|
| 49 | + <?php foreach ($channels as $channel => $channelTitle) { ?> |
|
| 50 | 50 | <option value="<?php p($channelTitle) ?>"> |
| 51 | 51 | <?php p($channelTitle) ?> |
| 52 | 52 | </option> |