]> source.dussan.org Git - nextcloud-server.git/commitdiff
enabled disabled files app in repair step
authorMorris Jobke <hey@morrisjobke.de>
Mon, 2 Feb 2015 23:52:04 +0000 (00:52 +0100)
committerMorris Jobke <hey@morrisjobke.de>
Tue, 3 Feb 2015 13:03:43 +0000 (14:03 +0100)
lib/private/app.php
lib/private/app/appmanager.php
lib/private/repair.php
lib/repair/enablefilesapp.php [new file with mode: 0644]

index aa28e3605702ea37e78caa2fa27677f01b0c95dc..60b644e58e2bf2217ec73e9a10fa931631555a1b 100644 (file)
@@ -322,7 +322,7 @@ class OC_App {
         */
        public static function disable($app) {
                if($app === 'files') {
-                       throw new \Exception("App 'files' can't be disabled.");
+                       throw new \Exception("files can't be disabled.");
                }
                self::$enabledAppsCache = array(); // flush
                // check if app is a shipped app or not. if not delete
index 7527c93dae99a2952d328701a69ecd96bb38b950..20a765e3434e18a9b10fa1b0fa5dc2a4f1477945 100644 (file)
@@ -135,7 +135,7 @@ class AppManager implements IAppManager {
         */
        public function disableApp($appId) {
                if($appId === 'files') {
-                       throw new \Exception("App 'files' can't be disabled.");
+                       throw new \Exception("files can't be disabled.");
                }
                $this->appConfig->setValue($appId, 'enabled', 'no');
        }
index d9fd99707e8f2c5a59de352c6b52f29c82317b03..c74283896fdd3da0cc0a77a61570c9aab0749603 100644 (file)
@@ -13,6 +13,7 @@ use OC\Hooks\Emitter;
 use OC\Repair\AssetCache;
 use OC\Repair\CleanTags;
 use OC\Repair\Collation;
+use OC\Repair\EnableFilesApp;
 use OC\Repair\FillETags;
 use OC\Repair\InnoDB;
 use OC\Repair\RepairConfig;
@@ -84,6 +85,7 @@ class Repair extends BasicEmitter {
                        new AssetCache(),
                        new FillETags(\OC_DB::getConnection()),
                        new CleanTags(\OC_DB::getConnection()),
+                       new EnableFilesApp(\OC::$server->getConfig()),
                );
        }
 
diff --git a/lib/repair/enablefilesapp.php b/lib/repair/enablefilesapp.php
new file mode 100644 (file)
index 0000000..a3298cf
--- /dev/null
@@ -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']);
+               }
+       }
+}