summaryrefslogtreecommitdiffstats
path: root/lib/repair
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-02-03 00:52:04 +0100
committerMorris Jobke <hey@morrisjobke.de>2015-02-03 14:03:43 +0100
commitd70160c6077ca017d6cb7d61f066fe33e3b1e081 (patch)
treee30e0972bc535e5708ba0f12b24d6bd7d5e4ce8e /lib/repair
parenta7eedf014933277ff392824e1a6e62b041da58f8 (diff)
downloadnextcloud-server-d70160c6077ca017d6cb7d61f066fe33e3b1e081.tar.gz
nextcloud-server-d70160c6077ca017d6cb7d61f066fe33e3b1e081.zip
enabled disabled files app in repair step
Diffstat (limited to 'lib/repair')
-rw-r--r--lib/repair/enablefilesapp.php50
1 files changed, 50 insertions, 0 deletions
diff --git a/lib/repair/enablefilesapp.php b/lib/repair/enablefilesapp.php
new file mode 100644
index 00000000000..a3298cf76b3
--- /dev/null
+++ b/lib/repair/enablefilesapp.php
@@ -0,0 +1,50 @@
+<?php
+/**
+ * Copyright (c) 2015 Morris Jobke <hey@morrisjobke.de>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Repair;
+
+use OC\Hooks\BasicEmitter;
+use OC\RepairStep;
+use OCP\IConfig;
+
+/**
+ * Class EnableFilesApp - enables files app if disabled
+ *
+ * TODO: remove this with ownCloud 8.1 - this isn't possible anymore with 8.0
+ *
+ * @package OC\Repair
+ */
+class EnableFilesApp extends BasicEmitter implements RepairStep {
+
+ /** @var IConfig */
+ protected $config;
+
+ /**
+ * @param IConfig $config
+ */
+ public function __construct(IConfig $config) {
+ $this->config = $config;
+ }
+
+ /**
+ * @return string
+ */
+ public function getName() {
+ return 'Re-enable file app';
+ }
+
+ /**
+ * Enables the files app if it is disabled
+ */
+ public function run() {
+ if ($this->config->getAppValue('files', 'enabled', 'no') !== 'yes') {
+ $this->config->setAppValue('files', 'enabled', 'yes');
+ $this->emit('\OC\Repair', 'info', ['Files app was disabled - re-enabled']);
+ }
+ }
+}