summaryrefslogtreecommitdiffstats
path: root/apps/files_versions/command
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-03-23 13:07:40 +0100
committerRobin Appelman <icewind@owncloud.com>2015-03-26 17:07:01 +0100
commit7ec8f12ad4f8d05f540c02145eab641f69f8dc04 (patch)
tree9140061f0399a54fa6a73c81c6d762656d657591 /apps/files_versions/command
parent39dbf9509b1aa3988a14cb62402c437171dc213e (diff)
downloadnextcloud-server-7ec8f12ad4f8d05f540c02145eab641f69f8dc04.tar.gz
nextcloud-server-7ec8f12ad4f8d05f540c02145eab641f69f8dc04.zip
expire versions in a background command
Diffstat (limited to 'apps/files_versions/command')
-rw-r--r--apps/files_versions/command/expire.php48
1 files changed, 48 insertions, 0 deletions
diff --git a/apps/files_versions/command/expire.php b/apps/files_versions/command/expire.php
new file mode 100644
index 00000000000..1036741c791
--- /dev/null
+++ b/apps/files_versions/command/expire.php
@@ -0,0 +1,48 @@
+<?php
+/**
+ * Copyright (c) 2015 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OCA\Files_Versions\Command;
+
+use OC\Command\FileAccess;
+use OCA\Files_Versions\Storage;
+use OCP\Command\ICommand;
+
+class Expire implements ICommand {
+ use FileAccess;
+
+ /**
+ * @var string
+ */
+ private $fileName;
+
+ /**
+ * @var int|null
+ */
+ private $versionsSize;
+
+ /**
+ * @var int
+ */
+ private $neededSpace = 0;
+
+ /**
+ * @param string $fileName
+ * @param int|null $versionsSize
+ * @param int $neededSpace
+ */
+ function __construct($fileName, $versionsSize = null, $neededSpace = 0) {
+ $this->fileName = $fileName;
+ $this->versionsSize = $versionsSize;
+ $this->neededSpace = $neededSpace;
+ }
+
+
+ public function handle(){
+ Storage::expire($this->fileName, $this->versionsSize, $this->neededSpace);
+ }
+}