diff --git a/apps/files_sharing/tests/UpdaterTest.php b/apps/files_sharing/tests/UpdaterTest.php
index c8d089f54b4ccaaa396c59b742500c6706828575..2e044716d079498a651b3e22c133bc6454aeed9c 100644
--- a/apps/files_sharing/tests/UpdaterTest.php
+++ b/apps/files_sharing/tests/UpdaterTest.php
@@ -127,7 +127,7 @@ class UpdaterTest extends TestCase {
 		$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');
diff --git a/apps/files_trashbin/tests/TrashbinTest.php b/apps/files_trashbin/tests/TrashbinTest.php
index 7e4cdb112e86de22de28daa9ac16cd85ed7e716e..1121940c84e6cf1e556a2bfed3ec99b3b4337411 100644
--- a/apps/files_trashbin/tests/TrashbinTest.php
+++ b/apps/files_trashbin/tests/TrashbinTest.php
@@ -71,7 +71,7 @@ class TrashbinTest extends \Test\TestCase {
 		$application->registerMountProviders();
 
 		//disable encryption
-		\OC_App::disable('encryption');
+		\OC::$server->getAppManager()->disableApp('encryption');
 
 		$config = \OC::$server->getConfig();
 		//configure trashbin
diff --git a/lib/base.php b/lib/base.php
index c5eabe1910a577773feff3b79287bc7e597d0cbf..f0e139d92c8e8d5d6de26e52b82d019e4b57e72a 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -949,7 +949,7 @@ class OC {
 			$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();
diff --git a/lib/private/Updater.php b/lib/private/Updater.php
index c70113e1c7d9054cc2401e2f3fa9b170ac820cc1..4dc8edc0272da1b22d92adc4619b1b4cb55808f1 100644
--- a/lib/private/Updater.php
+++ b/lib/private/Updater.php
@@ -395,7 +395,7 @@ class Updater extends BasicEmitter {
 				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
diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php
index eba29d27cf808fae3248fa94bd5b35995e9b662f..303afa797dc1f985e661e50e11351f7bd7d6dbdf 100644
--- a/lib/private/legacy/app.php
+++ b/lib/private/legacy/app.php
@@ -154,7 +154,7 @@ class OC_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'))) {
@@ -421,20 +421,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 = [];
-
-		$appManager = \OC::$server->getAppManager();
-		$appManager->disableApp($app);
-	}
-
 	/**
 	 * Get the path where to install apps
 	 *