Disallow disabling of files app
This commit is contained in:
parent
1bb8d5978c
commit
a7eedf0149
|
@ -28,8 +28,12 @@ class Disable extends Command {
|
||||||
protected function execute(InputInterface $input, OutputInterface $output) {
|
protected function execute(InputInterface $input, OutputInterface $output) {
|
||||||
$appId = $input->getArgument('app-id');
|
$appId = $input->getArgument('app-id');
|
||||||
if (\OC_App::isEnabled($appId)) {
|
if (\OC_App::isEnabled($appId)) {
|
||||||
\OC_App::disable($appId);
|
try {
|
||||||
$output->writeln($appId . ' disabled');
|
\OC_App::disable($appId);
|
||||||
|
$output->writeln($appId . ' disabled');
|
||||||
|
} catch(\Exception $e) {
|
||||||
|
$output->writeln($e->getMessage());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$output->writeln('No such app enabled: ' . $appId);
|
$output->writeln('No such app enabled: ' . $appId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -321,6 +321,9 @@ class OC_App {
|
||||||
* @param string $app app
|
* @param string $app app
|
||||||
*/
|
*/
|
||||||
public static function disable($app) {
|
public static function disable($app) {
|
||||||
|
if($app === 'files') {
|
||||||
|
throw new \Exception("App 'files' can't be disabled.");
|
||||||
|
}
|
||||||
self::$enabledAppsCache = array(); // flush
|
self::$enabledAppsCache = array(); // flush
|
||||||
// check if app is a shipped app or not. if not delete
|
// check if app is a shipped app or not. if not delete
|
||||||
\OC_Hook::emit('OC_App', 'pre_disable', array('app' => $app));
|
\OC_Hook::emit('OC_App', 'pre_disable', array('app' => $app));
|
||||||
|
|
|
@ -131,8 +131,12 @@ class AppManager implements IAppManager {
|
||||||
* Disable an app for every user
|
* Disable an app for every user
|
||||||
*
|
*
|
||||||
* @param string $appId
|
* @param string $appId
|
||||||
|
* @throws \Exception if app can't be disabled
|
||||||
*/
|
*/
|
||||||
public function disableApp($appId) {
|
public function disableApp($appId) {
|
||||||
|
if($appId === 'files') {
|
||||||
|
throw new \Exception("App 'files' can't be disabled.");
|
||||||
|
}
|
||||||
$this->appConfig->setValue($appId, 'enabled', 'no');
|
$this->appConfig->setValue($appId, 'enabled', 'no');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue