summaryrefslogtreecommitdiffstats
path: root/lib/private/Repair
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-06-13 17:43:29 +0200
committerMorris Jobke <hey@morrisjobke.de>2018-06-13 17:43:29 +0200
commitdc4c158ea732b3aefbc8bedb2e61236a62fa24d5 (patch)
tree2eb586c38b992e199d44c6b39de11c4c6b9a13ec /lib/private/Repair
parentcd87a40eb3a2b7026dfd1822e6e43e131edd3423 (diff)
downloadnextcloud-server-dc4c158ea732b3aefbc8bedb2e61236a62fa24d5.tar.gz
nextcloud-server-dc4c158ea732b3aefbc8bedb2e61236a62fa24d5.zip
Background job to clean up old backups of the updater
* a one-time job gets scheduled after each update via a repair job * the job remove all directories inside data/updater-INSTANCEID/backups except the 3 most recent ones (determined by mtime of the folder) Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'lib/private/Repair')
-rw-r--r--lib/private/Repair/AddCleanupUpdaterBackupsJob.php48
1 files changed, 48 insertions, 0 deletions
diff --git a/lib/private/Repair/AddCleanupUpdaterBackupsJob.php b/lib/private/Repair/AddCleanupUpdaterBackupsJob.php
new file mode 100644
index 00000000000..1574e665fb6
--- /dev/null
+++ b/lib/private/Repair/AddCleanupUpdaterBackupsJob.php
@@ -0,0 +1,48 @@
+<?php
+/**
+ * @copyright Copyright (c) 2018 Morris Jobke <hey@morrisjobke.de>
+ *
+ * @author Morris Jobke <hey@morrisjobke.de>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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 program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OC\Repair;
+
+use OC\Core\BackgroundJobs\BackgroundCleanupUpdaterBackupsJob;
+use OCP\BackgroundJob\IJobList;
+use OCP\Migration\IOutput;
+use OCP\Migration\IRepairStep;
+
+class AddCleanupUpdaterBackupsJob implements IRepairStep {
+
+ /** @var IJobList */
+ protected $jobList;
+
+ public function __construct(IJobList $jobList) {
+ $this->jobList = $jobList;
+ }
+
+ public function getName() {
+ return 'Queue a one-time job to cleanup old backups of the updater';
+ }
+
+ public function run(IOutput $output) {
+ $this->jobList->add(BackgroundCleanupUpdaterBackupsJob::class);
+ }
+}
+