summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_trashbin')
-rw-r--r--apps/files_trashbin/lib/AppInfo/Application.php4
-rw-r--r--apps/files_trashbin/lib/Capabilities.php1
-rw-r--r--apps/files_trashbin/lib/Command/CleanUp.php1
-rw-r--r--apps/files_trashbin/lib/Command/ExpireTrash.php1
-rw-r--r--apps/files_trashbin/lib/Controller/PreviewController.php1
-rw-r--r--apps/files_trashbin/lib/Helper.php1
-rw-r--r--apps/files_trashbin/lib/Sabre/AbstractTrashFile.php2
-rw-r--r--apps/files_trashbin/lib/Sabre/PropfindPlugin.php2
-rw-r--r--apps/files_trashbin/lib/Sabre/RestoreFolder.php1
-rw-r--r--apps/files_trashbin/lib/Sabre/RootCollection.php1
-rw-r--r--apps/files_trashbin/lib/Trash/BackendNotFoundException.php1
-rw-r--r--apps/files_trashbin/lib/Trash/LegacyTrashBackend.php1
-rw-r--r--apps/files_trashbin/lib/Trashbin.php16
-rw-r--r--apps/files_trashbin/tests/Command/CleanUpTest.php4
-rw-r--r--apps/files_trashbin/tests/StorageTest.php5
-rw-r--r--apps/files_trashbin/tests/TrashbinTest.php3
16 files changed, 12 insertions, 33 deletions
diff --git a/apps/files_trashbin/lib/AppInfo/Application.php b/apps/files_trashbin/lib/AppInfo/Application.php
index 6a810e9218e..e86a401d2fd 100644
--- a/apps/files_trashbin/lib/AppInfo/Application.php
+++ b/apps/files_trashbin/lib/AppInfo/Application.php
@@ -78,11 +78,11 @@ class Application extends App {
$appManager = $server->getAppManager();
/** @var ITrashManager $trashManager */
$trashManager = $this->getContainer()->getServer()->query(ITrashManager::class);
- foreach($appManager->getInstalledApps() as $app) {
+ foreach ($appManager->getInstalledApps() as $app) {
$appInfo = $appManager->getAppInfo($app);
if (isset($appInfo['trash'])) {
$backends = $appInfo['trash'];
- foreach($backends as $backend) {
+ foreach ($backends as $backend) {
$class = $backend['@value'];
$for = $backend['@attributes']['for'];
diff --git a/apps/files_trashbin/lib/Capabilities.php b/apps/files_trashbin/lib/Capabilities.php
index 0051df5c4ea..988c4ec815f 100644
--- a/apps/files_trashbin/lib/Capabilities.php
+++ b/apps/files_trashbin/lib/Capabilities.php
@@ -45,5 +45,4 @@ class Capabilities implements ICapability {
]
];
}
-
}
diff --git a/apps/files_trashbin/lib/Command/CleanUp.php b/apps/files_trashbin/lib/Command/CleanUp.php
index b4e04f56fb4..59acbdcd000 100644
--- a/apps/files_trashbin/lib/Command/CleanUp.php
+++ b/apps/files_trashbin/lib/Command/CleanUp.php
@@ -130,5 +130,4 @@ class CleanUp extends Command {
$query->execute();
}
}
-
}
diff --git a/apps/files_trashbin/lib/Command/ExpireTrash.php b/apps/files_trashbin/lib/Command/ExpireTrash.php
index 46d2de46e36..fdf7f89b2ce 100644
--- a/apps/files_trashbin/lib/Command/ExpireTrash.php
+++ b/apps/files_trashbin/lib/Command/ExpireTrash.php
@@ -71,7 +71,6 @@ class ExpireTrash extends Command {
}
protected function execute(InputInterface $input, OutputInterface $output) {
-
$maxAge = $this->expiration->getMaxAgeAsTimestamp();
if (!$maxAge) {
$output->writeln("No expiry configured.");
diff --git a/apps/files_trashbin/lib/Controller/PreviewController.php b/apps/files_trashbin/lib/Controller/PreviewController.php
index f06265ec371..4195d584c8e 100644
--- a/apps/files_trashbin/lib/Controller/PreviewController.php
+++ b/apps/files_trashbin/lib/Controller/PreviewController.php
@@ -93,7 +93,6 @@ class PreviewController extends Controller {
int $x = 128,
int $y = 128
) {
-
if ($fileId === -1 || $x === 0 || $y === 0) {
return new DataResponse([], Http::STATUS_BAD_REQUEST);
}
diff --git a/apps/files_trashbin/lib/Helper.php b/apps/files_trashbin/lib/Helper.php
index 2e47abbae7b..31ebdfa265e 100644
--- a/apps/files_trashbin/lib/Helper.php
+++ b/apps/files_trashbin/lib/Helper.php
@@ -70,7 +70,6 @@ class Helper {
$pathparts = pathinfo($entryName);
$timestamp = substr($pathparts['extension'], 1);
$name = $pathparts['filename'];
-
} elseif ($timestamp === null) {
// for subfolders we need to calculate the timestamp only once
$parts = explode('/', ltrim($dir, '/'));
diff --git a/apps/files_trashbin/lib/Sabre/AbstractTrashFile.php b/apps/files_trashbin/lib/Sabre/AbstractTrashFile.php
index b21579e9e34..ad80711ff1d 100644
--- a/apps/files_trashbin/lib/Sabre/AbstractTrashFile.php
+++ b/apps/files_trashbin/lib/Sabre/AbstractTrashFile.php
@@ -29,7 +29,7 @@ namespace OCA\Files_Trashbin\Sabre;
use Sabre\DAV\Exception\Forbidden;
use Sabre\DAV\IFile;
-abstract class AbstractTrashFile extends AbstractTrash implements IFile , ITrash{
+abstract class AbstractTrashFile extends AbstractTrash implements IFile , ITrash {
public function put($data) {
throw new Forbidden();
}
diff --git a/apps/files_trashbin/lib/Sabre/PropfindPlugin.php b/apps/files_trashbin/lib/Sabre/PropfindPlugin.php
index 53619c6e85c..1920ed17863 100644
--- a/apps/files_trashbin/lib/Sabre/PropfindPlugin.php
+++ b/apps/files_trashbin/lib/Sabre/PropfindPlugin.php
@@ -35,7 +35,6 @@ use Sabre\DAV\Server;
use Sabre\DAV\ServerPlugin;
class PropfindPlugin extends ServerPlugin {
-
const TRASHBIN_FILENAME = '{http://nextcloud.org/ns}trashbin-filename';
const TRASHBIN_ORIGINAL_LOCATION = '{http://nextcloud.org/ns}trashbin-original-location';
const TRASHBIN_DELETION_TIME = '{http://nextcloud.org/ns}trashbin-deletion-time';
@@ -111,5 +110,4 @@ class PropfindPlugin extends ServerPlugin {
return '';
});
}
-
}
diff --git a/apps/files_trashbin/lib/Sabre/RestoreFolder.php b/apps/files_trashbin/lib/Sabre/RestoreFolder.php
index 9b9c07f1c52..c31e7dfb492 100644
--- a/apps/files_trashbin/lib/Sabre/RestoreFolder.php
+++ b/apps/files_trashbin/lib/Sabre/RestoreFolder.php
@@ -75,5 +75,4 @@ class RestoreFolder implements ICollection, IMoveTarget {
return $sourceNode->restore();
}
-
}
diff --git a/apps/files_trashbin/lib/Sabre/RootCollection.php b/apps/files_trashbin/lib/Sabre/RootCollection.php
index 95300f923ff..55fd0bc7d5b 100644
--- a/apps/files_trashbin/lib/Sabre/RootCollection.php
+++ b/apps/files_trashbin/lib/Sabre/RootCollection.php
@@ -70,5 +70,4 @@ class RootCollection extends AbstractPrincipalCollection {
public function getName(): string {
return 'trashbin';
}
-
}
diff --git a/apps/files_trashbin/lib/Trash/BackendNotFoundException.php b/apps/files_trashbin/lib/Trash/BackendNotFoundException.php
index 798b55dbd8c..2554faade4d 100644
--- a/apps/files_trashbin/lib/Trash/BackendNotFoundException.php
+++ b/apps/files_trashbin/lib/Trash/BackendNotFoundException.php
@@ -24,5 +24,4 @@
namespace OCA\Files_Trashbin\Trash;
class BackendNotFoundException extends \Exception {
-
}
diff --git a/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php b/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php
index d6f8a07746f..68ee8c1c517 100644
--- a/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php
+++ b/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php
@@ -93,7 +93,6 @@ class LegacyTrashBackend implements ITrashBackend {
} else {
Trashbin::delete($item->getTrashPath(), $user->getUID(), null);
}
-
}
public function moveToTrash(IStorage $storage, string $internalPath): bool {
diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php
index a308ec78532..adfdf1364be 100644
--- a/apps/files_trashbin/lib/Trashbin.php
+++ b/apps/files_trashbin/lib/Trashbin.php
@@ -316,7 +316,6 @@ class Trashbin {
*/
private static function retainVersions($filename, $owner, $ownerPath, $timestamp) {
if (\OCP\App::isEnabled('files_versions') && !empty($ownerPath)) {
-
$user = User::getUser();
$rootView = new View('/');
@@ -326,7 +325,6 @@ class Trashbin {
}
self::move($rootView, $owner . '/files_versions/' . $ownerPath, $user . '/files_trashbin/versions/' . $filename . '.d' . $timestamp);
} elseif ($versions = \OCA\Files_Versions\Storage::getVersions($owner, $ownerPath)) {
-
foreach ($versions as $v) {
if ($owner !== $user) {
self::copy($rootView, $owner . '/files_versions' . $v['path'] . '.v' . $v['version'], $owner . '/files_trashbin/versions/' . $v['name'] . '.v' . $v['version'] . '.d' . $timestamp);
@@ -461,9 +459,7 @@ class Trashbin {
* @return false|null
*/
private static function restoreVersions(View $view, $file, $filename, $uniqueFilename, $location, $timestamp) {
-
if (\OCP\App::isEnabled('files_versions')) {
-
$user = User::getUser();
$rootView = new View('/');
@@ -513,7 +509,7 @@ class Trashbin {
// Array to store the relative path in (after the file is deleted, the view won't be able to relativise the path anymore)
$filePaths = [];
- foreach($fileInfos as $fileInfo){
+ foreach ($fileInfos as $fileInfo) {
$filePaths[] = $view->getRelativePath($fileInfo->getPath());
}
unset($fileInfos); // save memory
@@ -522,7 +518,7 @@ class Trashbin {
\OC_Hook::emit('\OCP\Trashbin', 'preDeleteAll', ['paths' => $filePaths]);
// Single-File Hooks
- foreach($filePaths as $path){
+ foreach ($filePaths as $path) {
self::emitTrashbinPreDelete($path);
}
@@ -535,7 +531,7 @@ class Trashbin {
\OC_Hook::emit('\OCP\Trashbin', 'deleteAll', ['paths' => $filePaths]);
// Single-File Hooks
- foreach($filePaths as $path){
+ foreach ($filePaths as $path) {
self::emitTrashbinPostDelete($path);
}
@@ -673,7 +669,7 @@ class Trashbin {
private static function calculateFreeSpace($trashbinSize, $user) {
$softQuota = true;
$userObject = \OC::$server->getUserManager()->get($user);
- if(is_null($userObject)) {
+ if (is_null($userObject)) {
return 0;
}
$quota = $userObject->getQuota();
@@ -692,7 +688,7 @@ class Trashbin {
// subtract size of files and current trash bin size from quota
if ($softQuota) {
$userFolder = \OC::$server->getUserFolder($user);
- if(is_null($userFolder)) {
+ if (is_null($userFolder)) {
return 0;
}
$free = $quota - $userFolder->getSize(false); // remaining free space for user
@@ -714,7 +710,6 @@ class Trashbin {
* @param string $user user id
*/
public static function resizeTrash($user) {
-
$size = self::getTrashbinSize($user);
$freeSpace = self::calculateFreeSpace($size, $user);
@@ -998,7 +993,6 @@ class Trashbin {
* @return bool
*/
public static function isEmpty($user) {
-
$view = new View('/' . $user . '/files_trashbin');
if ($view->is_dir('/files') && $dh = $view->opendir('/files')) {
while ($file = readdir($dh)) {
diff --git a/apps/files_trashbin/tests/Command/CleanUpTest.php b/apps/files_trashbin/tests/Command/CleanUpTest.php
index 71391f5288d..18ea42e78cc 100644
--- a/apps/files_trashbin/tests/Command/CleanUpTest.php
+++ b/apps/files_trashbin/tests/Command/CleanUpTest.php
@@ -106,7 +106,7 @@ class CleanUpTest extends TestCase {
->method('nodeExists')
->with('/' . $this->user0 . '/files_trashbin')
->willReturn($nodeExists);
- if($nodeExists) {
+ if ($nodeExists) {
$this->rootFolder->expects($this->once())
->method('get')
->with('/' . $this->user0 . '/files_trashbin')
@@ -140,7 +140,6 @@ class CleanUpTest extends TestCase {
->fetchAll();
$this->assertSame(10, count($result));
}
-
}
public function dataTestRemoveDeletedFiles() {
return [
@@ -239,5 +238,4 @@ class CleanUpTest extends TestCase {
$this->invokePrivate($this->cleanup, 'execute', [$inputInterface, $outputInterface]);
}
-
}
diff --git a/apps/files_trashbin/tests/StorageTest.php b/apps/files_trashbin/tests/StorageTest.php
index 6047e488a77..3b27e13e88f 100644
--- a/apps/files_trashbin/tests/StorageTest.php
+++ b/apps/files_trashbin/tests/StorageTest.php
@@ -94,7 +94,9 @@ class StorageTest extends \Test\TestCase {
\OC\Files\Filesystem::getLoader()->removeStorageWrapper('oc_trashbin');
$this->logout();
$user = \OC::$server->getUserManager()->get($this->user);
- if ($user !== null) { $user->delete(); }
+ if ($user !== null) {
+ $user->delete();
+ }
\OC_Hook::clear();
parent::tearDown();
}
@@ -577,7 +579,6 @@ class StorageTest extends \Test\TestCase {
$this->assertSame($expected,
$this->invokePrivate($storage, 'shouldMoveToTrash', [$path])
);
-
}
public function dataTestShouldMoveToTrash() {
diff --git a/apps/files_trashbin/tests/TrashbinTest.php b/apps/files_trashbin/tests/TrashbinTest.php
index 2e9e130244c..fbf1b1c1c13 100644
--- a/apps/files_trashbin/tests/TrashbinTest.php
+++ b/apps/files_trashbin/tests/TrashbinTest.php
@@ -37,7 +37,6 @@ use OCA\Files_Sharing\AppInfo\Application;
* @group DB
*/
class TrashbinTest extends \Test\TestCase {
-
const TEST_TRASHBIN_USER1 = "test-trashbin-user1";
const TEST_TRASHBIN_USER2 = "test-trashbin-user2";
@@ -210,7 +209,6 @@ class TrashbinTest extends \Test\TestCase {
* correctly
*/
public function testExpireOldFilesShared() {
-
$currentTime = time();
$folder = "trashTest-" . $currentTime . '/';
$expiredDate = $currentTime - 3 * 24 * 60 * 60;
@@ -673,7 +671,6 @@ class TrashbinTest extends \Test\TestCase {
try {
\OC::$server->getUserManager()->createUser($user, $user);
} catch (\Exception $e) { // catch username is already being used from previous aborted runs
-
}
}