From 7ec8f12ad4f8d05f540c02145eab641f69f8dc04 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 23 Mar 2015 13:07:40 +0100 Subject: expire versions in a background command --- apps/files_versions/command/expire.php | 48 ++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 apps/files_versions/command/expire.php (limited to 'apps/files_versions/command') 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 @@ + + * 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); + } +} -- cgit v1.2.3