diff options
author | Morris Jobke <hey@morrisjobke.de> | 2015-02-03 00:39:01 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-02-03 00:39:01 +0100 |
commit | a7eedf014933277ff392824e1a6e62b041da58f8 (patch) | |
tree | 7d723d2d5ed605d6ea6b953ca32df9de6cabf2ec | |
parent | 1bb8d5978cb6e05c81da7c1bb8cb5b33279e1667 (diff) | |
download | nextcloud-server-a7eedf014933277ff392824e1a6e62b041da58f8.tar.gz nextcloud-server-a7eedf014933277ff392824e1a6e62b041da58f8.zip |
Disallow disabling of files app
-rw-r--r-- | core/command/app/disable.php | 8 | ||||
-rw-r--r-- | lib/private/app.php | 3 | ||||
-rw-r--r-- | lib/private/app/appmanager.php | 4 |
3 files changed, 13 insertions, 2 deletions
diff --git a/core/command/app/disable.php b/core/command/app/disable.php index dcdee92349e..2e028d183bb 100644 --- a/core/command/app/disable.php +++ b/core/command/app/disable.php @@ -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); } diff --git a/lib/private/app.php b/lib/private/app.php index 3a1f731d621..aa28e360570 100644 --- a/lib/private/app.php +++ b/lib/private/app.php @@ -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)); diff --git a/lib/private/app/appmanager.php b/lib/private/app/appmanager.php index 6d9aa0bfe37..7527c93dae9 100644 --- a/lib/private/app/appmanager.php +++ b/lib/private/app/appmanager.php @@ -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'); } } |