Remove OC_App::removeApp

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2018-01-29 13:41:00 +01:00 committed by Morris Jobke
parent a68895e334
commit efbdad2d0c
No known key found for this signature in database
GPG Key ID: FE03C3A163FEDE68
3 changed files with 7 additions and 14 deletions

View File

@ -471,6 +471,9 @@ class Installer {
*/ */
public function removeApp($appId) { public function removeApp($appId) {
if($this->isDownloaded( $appId )) { if($this->isDownloaded( $appId )) {
if (\OC::$server->getAppManager()->isShipped($appId)) {
return false;
}
$appDir = OC_App::getInstallPath() . '/' . $appId; $appDir = OC_App::getInstallPath() . '/' . $appId;
OC_Helper::rmdirr($appDir); OC_Helper::rmdirr($appDir);
return true; return true;

View File

@ -419,19 +419,6 @@ class OC_App {
} }
} }
/**
* @param string $app
* @return bool
*/
public static function removeApp($app) {
if (\OC::$server->getAppManager()->isShipped($app)) {
return false;
}
$installer = \OC::$server->query(Installer::class);
return $installer->removeApp($app);
}
/** /**
* This function set an app as disabled in appconfig. * This function set an app as disabled in appconfig.
* *

View File

@ -40,7 +40,10 @@ if (!array_key_exists('appid', $_POST)) {
$appId = (string)$_POST['appid']; $appId = (string)$_POST['appid'];
$appId = OC_App::cleanAppId($appId); $appId = OC_App::cleanAppId($appId);
$result = OC_App::removeApp($appId); // FIXME: move to controller
/** @var \OC\Installer $installer */
$installer = \OC::$server->query(\OC\Installer::class);
$result = $installer->removeApp($app);
if($result !== false) { if($result !== false) {
// FIXME: Clear the cache - move that into some sane helper method // FIXME: Clear the cache - move that into some sane helper method
\OC::$server->getMemCacheFactory()->createDistributed('settings')->remove('listApps-0'); \OC::$server->getMemCacheFactory()->createDistributed('settings')->remove('listApps-0');