Merge pull request #5833 from nextcloud/fix_uninstall_rep_step
Run repair steps on uninstall in all cases
This commit is contained in:
commit
846b0d6a42
|
@ -127,7 +127,7 @@ class UpdaterTest extends TestCase {
|
||||||
$rootView->deleteAll('files_trashin');
|
$rootView->deleteAll('files_trashin');
|
||||||
|
|
||||||
if ($status === false) {
|
if ($status === false) {
|
||||||
\OC_App::disable('files_trashbin');
|
\OC::$server->getAppManager()->disableApp('files_trashbin');
|
||||||
}
|
}
|
||||||
|
|
||||||
\OC\Files\Filesystem::getLoader()->removeStorageWrapper('oc_trashbin');
|
\OC\Files\Filesystem::getLoader()->removeStorageWrapper('oc_trashbin');
|
||||||
|
|
|
@ -71,7 +71,7 @@ class TrashbinTest extends \Test\TestCase {
|
||||||
$application->registerMountProviders();
|
$application->registerMountProviders();
|
||||||
|
|
||||||
//disable encryption
|
//disable encryption
|
||||||
\OC_App::disable('encryption');
|
\OC::$server->getAppManager()->disableApp('encryption');
|
||||||
|
|
||||||
$config = \OC::$server->getConfig();
|
$config = \OC::$server->getConfig();
|
||||||
//configure trashbin
|
//configure trashbin
|
||||||
|
|
|
@ -949,7 +949,7 @@ class OC {
|
||||||
$appIds = (array)$request->getParam('appid');
|
$appIds = (array)$request->getParam('appid');
|
||||||
foreach($appIds as $appId) {
|
foreach($appIds as $appId) {
|
||||||
$appId = \OC_App::cleanAppId($appId);
|
$appId = \OC_App::cleanAppId($appId);
|
||||||
\OC_App::disable($appId);
|
\OC::$server->getAppManager()->disableApp($appId);
|
||||||
}
|
}
|
||||||
\OC_JSON::success();
|
\OC_JSON::success();
|
||||||
exit();
|
exit();
|
||||||
|
|
|
@ -287,6 +287,13 @@ class AppManager implements IAppManager {
|
||||||
}
|
}
|
||||||
unset($this->installedAppsCache[$appId]);
|
unset($this->installedAppsCache[$appId]);
|
||||||
$this->appConfig->setValue($appId, 'enabled', 'no');
|
$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(
|
$this->dispatcher->dispatch(ManagerEvent::EVENT_APP_DISABLE, new ManagerEvent(
|
||||||
ManagerEvent::EVENT_APP_DISABLE, $appId
|
ManagerEvent::EVENT_APP_DISABLE, $appId
|
||||||
));
|
));
|
||||||
|
|
|
@ -395,7 +395,7 @@ class Updater extends BasicEmitter {
|
||||||
if ($appManager->isShipped($app)) {
|
if ($appManager->isShipped($app)) {
|
||||||
throw new \UnexpectedValueException('The files of the app "' . $app . '" were not correctly replaced before running the update');
|
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));
|
$this->emit('\OC\Updater', 'incompatibleAppDisabled', array($app));
|
||||||
}
|
}
|
||||||
// no need to disable any app in case this is a non-core upgrade
|
// no need to disable any app in case this is a non-core upgrade
|
||||||
|
|
|
@ -154,16 +154,9 @@ class OC_App {
|
||||||
\OC::$server->getLogger()->logException($ex);
|
\OC::$server->getLogger()->logException($ex);
|
||||||
if (!\OC::$server->getAppManager()->isShipped($app)) {
|
if (!\OC::$server->getAppManager()->isShipped($app)) {
|
||||||
// Only disable apps which are not shipped
|
// 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);
|
\OC::$server->getEventLogger()->end('load_app_' . $app);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,11 +322,6 @@ class OC_App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* get all enabled apps
|
|
||||||
*/
|
|
||||||
protected static $enabledAppsCache = [];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns apps enabled for the current user.
|
* Returns apps enabled for the current user.
|
||||||
*
|
*
|
||||||
|
@ -393,7 +381,6 @@ class OC_App {
|
||||||
*/
|
*/
|
||||||
public function enable(string $appId,
|
public function enable(string $appId,
|
||||||
array $groups = []) {
|
array $groups = []) {
|
||||||
self::$enabledAppsCache = []; // flush
|
|
||||||
|
|
||||||
// Check if app is already downloaded
|
// Check if app is already downloaded
|
||||||
$installer = \OC::$server->query(Installer::class);
|
$installer = \OC::$server->query(Installer::class);
|
||||||
|
@ -421,30 +408,6 @@ class OC_App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
* Get the path where to install apps
|
||||||
*
|
*
|
||||||
|
|
|
@ -39,6 +39,6 @@ if (!array_key_exists('appid', $_POST)) {
|
||||||
$appIds = (array)$_POST['appid'];
|
$appIds = (array)$_POST['appid'];
|
||||||
foreach($appIds as $appId) {
|
foreach($appIds as $appId) {
|
||||||
$appId = OC_App::cleanAppId($appId);
|
$appId = OC_App::cleanAppId($appId);
|
||||||
OC_App::disable($appId);
|
\OC::$server->getAppManager()->disableApp($appId);
|
||||||
}
|
}
|
||||||
OC_JSON::success();
|
OC_JSON::success();
|
||||||
|
|
Loading…
Reference in New Issue