summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/command
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-03-02 15:25:50 +0100
committerRobin Appelman <icewind@owncloud.com>2015-03-02 15:25:50 +0100
commitc80522ed63e3225ce1f1353581220c3296ed0590 (patch)
tree1c95536318918ac24332672d00162b2fb1e7d3e9 /apps/files_trashbin/command
parent00568af74d8b392ea9f991e3d4069cd50e030030 (diff)
downloadnextcloud-server-c80522ed63e3225ce1f1353581220c3296ed0590.tar.gz
nextcloud-server-c80522ed63e3225ce1f1353581220c3296ed0590.zip
Expire files from the trash in the background
Diffstat (limited to 'apps/files_trashbin/command')
-rw-r--r--apps/files_trashbin/command/expire.php55
1 files changed, 55 insertions, 0 deletions
diff --git a/apps/files_trashbin/command/expire.php b/apps/files_trashbin/command/expire.php
new file mode 100644
index 00000000000..842e061eeb9
--- /dev/null
+++ b/apps/files_trashbin/command/expire.php
@@ -0,0 +1,55 @@
+<?php
+/**
+ * ownCloud - trash bin
+ *
+ * @author Robin Appelman
+ * @copyright 2015 Robin Appelman icewind@owncloud.com
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCA\Files_Trashbin\Command;
+
+use OC\Command\FileAccess;
+use OCA\Files_Trashbin\Trashbin;
+use OCP\Command\ICommand;
+
+class Expire implements ICommand {
+ use FileAccess;
+
+ /**
+ * @var string
+ */
+ private $user;
+
+ /**
+ * @var int
+ */
+ private $trashBinSize;
+
+ /**
+ * @param string $user
+ * @param int $trashBinSize
+ */
+ function __construct($user, $trashBinSize) {
+ $this->user = $user;
+ $this->trashBinSize = $trashBinSize;
+ }
+
+ public function handle() {
+ \OC_Util::setupFS($this->user);
+ Trashbin::expire($this->trashBinSize, $this->user);
+ }
+}