summaryrefslogtreecommitdiffstats
path: root/lib/base.php
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-07-07 17:29:54 +0200
committerVincent Petry <pvince81@owncloud.com>2016-02-29 12:07:37 +0100
commit1dbe240b0e5b0a0b32d0e0eca596bf4e510f980e (patch)
treec42218485da4eacc6c36f4062fde295869359421 /lib/base.php
parent32f4bea0ae174487fd5a58e2c9eeb6e567d1ff91 (diff)
downloadnextcloud-server-1dbe240b0e5b0a0b32d0e0eca596bf4e510f980e.tar.gz
nextcloud-server-1dbe240b0e5b0a0b32d0e0eca596bf4e510f980e.zip
Disable app that bricks the server after enabling
If an app is getting enabled in the web UI, an ajax call is now made to make sure the server still works. If it doesn't, it sends an emergency app disabling call to disable the breaking app.
Diffstat (limited to 'lib/base.php')
-rw-r--r--lib/base.php20
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/base.php b/lib/base.php
index df4e91dda9f..31d96666985 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -823,12 +823,28 @@ class OC {
exit();
}
- $request = \OC::$server->getRequest()->getPathInfo();
- if (substr($request, -3) !== '.js') { // we need these files during the upgrade
+ $request = \OC::$server->getRequest();
+ $requestPath = $request->getPathInfo();
+ if (substr($requestPath, -3) !== '.js') { // we need these files during the upgrade
self::checkMaintenanceMode();
self::checkUpgrade();
}
+ // emergency app disabling
+ if ($requestPath === '/disableapp'
+ && $request->getMethod() === 'POST'
+ && ((string)$request->getParam('appid')) !== ''
+ ) {
+ \OCP\JSON::callCheck();
+ \OCP\JSON::checkAdminUser();
+ $appId = (string)$request->getParam('appid');
+ $appId = \OC_App::cleanAppId($appId);
+
+ \OC_App::disable($appId);
+ \OC_JSON::success();
+ exit();
+ }
+
// Always load authentication apps
OC_App::loadApps(['authentication']);