Skip to content
Snippets Groups Projects
Commit a7eedf01 authored by Morris Jobke's avatar Morris Jobke
Browse files

Disallow disabling of files app

parent 1bb8d597
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......
......@@ -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));
......
......@@ -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');
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment