]> source.dussan.org Git - nextcloud-server.git/commitdiff
Disallow disabling of files app
authorMorris Jobke <hey@morrisjobke.de>
Mon, 2 Feb 2015 23:39:01 +0000 (00:39 +0100)
committerMorris Jobke <hey@morrisjobke.de>
Mon, 2 Feb 2015 23:39:01 +0000 (00:39 +0100)
core/command/app/disable.php
lib/private/app.php
lib/private/app/appmanager.php

index dcdee92349e26d9675783d99bee3d33e57c97b04..2e028d183bb99964306506a524bbad1e924debf5 100644 (file)
@@ -28,8 +28,12 @@ class Disable extends Command {
        protected function execute(InputInterface $input, OutputInterface $output) {
                $appId = $input->getArgument('app-id');
                if (\OC_App::isEnabled($appId)) {
-                       \OC_App::disable($appId);
-                       $output->writeln($appId . ' disabled');
+                       try {
+                               \OC_App::disable($appId);
+                               $output->writeln($appId . ' disabled');
+                       } catch(\Exception $e) {
+                               $output->writeln($e->getMessage());
+                       }
                } else {
                        $output->writeln('No such app enabled: ' . $appId);
                }
index 3a1f731d6210f828782a1cd115908a62b8d2596e..aa28e3605702ea37e78caa2fa27677f01b0c95dc 100644 (file)
@@ -321,6 +321,9 @@ class OC_App {
         * @param string $app app
         */
        public static function disable($app) {
+               if($app === 'files') {
+                       throw new \Exception("App 'files' can't be disabled.");
+               }
                self::$enabledAppsCache = array(); // flush
                // check if app is a shipped app or not. if not delete
                \OC_Hook::emit('OC_App', 'pre_disable', array('app' => $app));
index 6d9aa0bfe375339a6cf8068c846f01f12d7cf402..7527c93dae99a2952d328701a69ecd96bb38b950 100644 (file)
@@ -131,8 +131,12 @@ class AppManager implements IAppManager {
         * Disable an app for every user
         *
         * @param string $appId
+        * @throws \Exception if app can't be disabled
         */
        public function disableApp($appId) {
+               if($appId === 'files') {
+                       throw new \Exception("App 'files' can't be disabled.");
+               }
                $this->appConfig->setValue($appId, 'enabled', 'no');
        }
 }