Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/files_sharing/tests/UpdaterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function testDeleteParentFolder() {
$rootView->deleteAll('files_trashin');

if ($status === false) {
\OC_App::disable('files_trashbin');
\OC::$server->getAppManager()->disableApp('files_trashbin');
}

\OC\Files\Filesystem::getLoader()->removeStorageWrapper('oc_trashbin');
Expand Down
2 changes: 1 addition & 1 deletion apps/files_trashbin/tests/TrashbinTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public static function setUpBeforeClass() {
$application->registerMountProviders();

//disable encryption
\OC_App::disable('encryption');
\OC::$server->getAppManager()->disableApp('encryption');

$config = \OC::$server->getConfig();
//configure trashbin
Expand Down
2 changes: 1 addition & 1 deletion lib/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ public static function handleRequest() {
$appIds = (array)$request->getParam('appid');
foreach($appIds as $appId) {
$appId = \OC_App::cleanAppId($appId);
\OC_App::disable($appId);
\OC::$server->getAppManager()->disableApp($appId);
}
\OC_JSON::success();
exit();
Expand Down
7 changes: 7 additions & 0 deletions lib/private/App/AppManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,13 @@ public function disableApp($appId) {
}
unset($this->installedAppsCache[$appId]);
$this->appConfig->setValue($appId, 'enabled', 'no');

// run uninstall steps
$appData = $this->getAppInfo($appId);
if (!is_null($appData)) {
\OC_App::executeRepairSteps($appId, $appData['repair-steps']['uninstall']);
}

$this->dispatcher->dispatch(ManagerEvent::EVENT_APP_DISABLE, new ManagerEvent(
ManagerEvent::EVENT_APP_DISABLE, $appId
));
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ private function checkAppsRequirements() {
if ($appManager->isShipped($app)) {
throw new \UnexpectedValueException('The files of the app "' . $app . '" were not correctly replaced before running the update');
}
OC_App::disable($app);
\OC::$server->getAppManager()->disableApp($app);
$this->emit('\OC\Updater', 'incompatibleAppDisabled', array($app));
}
// no need to disable any app in case this is a non-core upgrade
Expand Down
39 changes: 1 addition & 38 deletions lib/private/legacy/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,9 @@ public static function loadApp(string $app) {
\OC::$server->getLogger()->logException($ex);
if (!\OC::$server->getAppManager()->isShipped($app)) {
// Only disable apps which are not shipped
self::disable($app);
\OC::$server->getAppManager()->disableApp($app);
}
}
if (self::isType($app, array('authentication'))) {
// since authentication apps affect the "is app enabled for group" check,
// the enabled apps cache needs to be cleared to make sure that the
// next time getEnableApps() is called it will also include apps that were
// enabled for groups
self::$enabledAppsCache = [];
}
\OC::$server->getEventLogger()->end('load_app_' . $app);
}

Expand Down Expand Up @@ -329,11 +322,6 @@ public static function setAppTypes(string $app) {
}
}

/**
* get all enabled apps
*/
protected static $enabledAppsCache = [];

/**
* Returns apps enabled for the current user.
*
Expand Down Expand Up @@ -393,7 +381,6 @@ public static function isEnabled(string $app): bool {
*/
public function enable(string $appId,
array $groups = []) {
self::$enabledAppsCache = []; // flush

// Check if app is already downloaded
$installer = \OC::$server->query(Installer::class);
Expand Down Expand Up @@ -421,30 +408,6 @@ public function enable(string $appId,
}
}

/**
* This function set an app as disabled in appconfig.
*
* @param string $app app
* @throws Exception
*/
public static function disable(string $app) {
// flush
self::$enabledAppsCache = [];

// run uninstall steps
$appData = OC_App::getAppInfo($app);
if (!is_null($appData)) {
OC_App::executeRepairSteps($app, $appData['repair-steps']['uninstall']);
}

// emit disable hook - needed anymore ?
\OC_Hook::emit('OC_App', 'pre_disable', array('app' => $app));

// finally disable it
$appManager = \OC::$server->getAppManager();
$appManager->disableApp($app);
}

/**
* Get the path where to install apps
*
Expand Down
2 changes: 1 addition & 1 deletion settings/ajax/disableapp.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
$appIds = (array)$_POST['appid'];
foreach($appIds as $appId) {
$appId = OC_App::cleanAppId($appId);
OC_App::disable($appId);
\OC::$server->getAppManager()->disableApp($appId);
}
OC_JSON::success();