aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_versions/lib/Storage.php
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-04-10 14:19:56 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-04-10 14:19:56 +0200
commitcaff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch)
tree186d494c2aea5dea7255d3584ef5d595fc6e6194 /apps/files_versions/lib/Storage.php
parentedf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff)
downloadnextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.tar.gz
nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.zip
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds unified formatting for control structures like if and loops as well as classes, their methods and anonymous functions. This basically forces the constructs to start on the same line. This is not exactly what PSR2 wants, but I think we can have a few exceptions with "our" style. The starting of braces on the same line is pracrically standard for our code. This also removes and empty lines from method/function bodies at the beginning and end. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/files_versions/lib/Storage.php')
-rw-r--r--apps/files_versions/lib/Storage.php13
1 files changed, 2 insertions, 11 deletions
diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php
index a149e352e3d..f62650e539d 100644
--- a/apps/files_versions/lib/Storage.php
+++ b/apps/files_versions/lib/Storage.php
@@ -57,7 +57,6 @@ use OCP\Lock\ILockingProvider;
use OCP\User;
class Storage {
-
const DEFAULTENABLED=true;
const DEFAULTMAXSIZE=50; // unit: percentage; 50% of available disk space/quota
const VERSIONS_ROOT = 'files_versions/';
@@ -139,7 +138,6 @@ class Storage {
* @return array with user id and path
*/
public static function getSourcePathAndUser($source) {
-
if (isset(self::$sourcePathAndUser[$source])) {
$uid = self::$sourcePathAndUser[$source]['uid'];
$path = self::$sourcePathAndUser[$source]['path'];
@@ -241,13 +239,11 @@ class Storage {
* Delete versions of a file
*/
public static function delete($path) {
-
$deletedFile = self::$deletedFiles[$path];
$uid = $deletedFile['uid'];
$filename = $deletedFile['filename'];
if (!Filesystem::file_exists($path)) {
-
$view = new View('/' . $uid . '/files_versions');
$versions = self::getVersions($uid, $filename);
@@ -318,7 +314,6 @@ class Storage {
if (!$rootView->is_dir('/' . $targetOwner . '/files/' . $targetPath)) {
self::scheduleExpire($targetOwner, $targetPath);
}
-
}
/**
@@ -389,7 +384,6 @@ class Storage {
}
return false;
-
}
/**
@@ -531,7 +525,6 @@ class Storage {
* @return string for example "5 days ago"
*/
private static function getHumanReadableTimestamp($timestamp) {
-
$diff = time() - $timestamp;
if ($diff < 60) { // first minute
@@ -549,7 +542,6 @@ class Storage {
} else {
return round($diff / 29030400) . " years ago";
}
-
}
/**
@@ -750,7 +742,7 @@ class Storage {
if ($quota >= 0) {
if ($softQuota) {
$userFolder = \OC::$server->getUserFolder($uid);
- if(is_null($userFolder)) {
+ if (is_null($userFolder)) {
$availableSpace = 0;
} else {
$free = $quota - $userFolder->getSize(false); // remaining free space for user
@@ -790,7 +782,7 @@ class Storage {
}
$logger = \OC::$server->getLogger();
- foreach($toDelete as $key => $path) {
+ foreach ($toDelete as $key => $path) {
\OC_Hook::emit('\OCP\Versions', 'preDelete', ['path' => $path, 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED]);
self::deleteVersion($versionsFileview, $path);
\OC_Hook::emit('\OCP\Versions', 'delete', ['path' => $path, 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED]);
@@ -854,5 +846,4 @@ class Storage {
}
return self::$application->getContainer()->query(Expiration::class);
}
-
}