0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-03-15 00:43:23 +00:00

fix: Replace getInstalledApps calls with getEnabledApps

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
Côme Chilliet 2025-02-10 11:35:38 +01:00
parent a3685551f7
commit f758f565d4
No known key found for this signature in database
GPG key ID: A3E2F658B28C760A
18 changed files with 20 additions and 20 deletions
apps
dav
lib/AppInfo
tests/unit/AppInfo
files_trashbin/lib/AppInfo
files_versions/lib/AppInfo
updatenotification
core/Command
App
Maintenance
lib/private
tests/lib

View file

@ -119,7 +119,7 @@ class PluginManager {
$this->calendarPlugins[] = $this->container->get(AppCalendarPlugin::class);
foreach ($this->appManager->getInstalledApps() as $app) {
foreach ($this->appManager->getEnabledApps() as $app) {
// load plugins and collections from info.xml
$info = $this->appManager->getAppInfo($app);
if (!isset($info['types']) || !in_array('dav', $info['types'], true)) {

View file

@ -24,7 +24,7 @@ class PluginManagerTest extends TestCase {
$server = $this->createMock(ServerContainer::class);
$appManager = $this->createMock(AppManager::class);
$appManager->method('getInstalledApps')
$appManager->method('getEnabledApps')
->willReturn(['adavapp', 'adavapp2']);
$appInfo1 = [

View file

@ -74,7 +74,7 @@ class Application extends App implements IBootstrap {
}
public function registerTrashBackends(ContainerInterface $serverContainer, LoggerInterface $logger, IAppManager $appManager, ITrashManager $trashManager): void {
foreach ($appManager->getInstalledApps() as $app) {
foreach ($appManager->getEnabledApps() as $app) {
$appInfo = $appManager->getAppInfo($app);
if (isset($appInfo['trash'])) {
$backends = $appInfo['trash'];

View file

@ -114,7 +114,7 @@ class Application extends App implements IBootstrap {
}
public function registerVersionBackends(ContainerInterface $container, IAppManager $appManager, LoggerInterface $logger): void {
foreach ($appManager->getInstalledApps() as $app) {
foreach ($appManager->getEnabledApps() as $app) {
$appInfo = $appManager->getAppInfo($app);
if (isset($appInfo['versions'])) {
$backends = $appInfo['versions'];

View file

@ -132,7 +132,7 @@ class UpdateAvailableNotifications extends TimedJob {
* Check all installed apps for updates
*/
protected function checkAppUpdates() {
$apps = $this->appManager->getInstalledApps();
$apps = $this->appManager->getEnabledApps();
foreach ($apps as $app) {
$update = $this->isUpdateAvailable($app);
if ($update !== false) {

View file

@ -56,7 +56,7 @@ class Check extends Command {
// Apps
$apps = $this->appManager->getInstalledApps();
$apps = $this->appManager->getEnabledApps();
foreach ($apps as $app) {
$update = $this->installer->isUpdateAvailable($app);
if ($update !== false) {

View file

@ -75,7 +75,7 @@ class APIController extends OCSController {
}
// Get list of installed custom apps
$installedApps = $this->appManager->getInstalledApps();
$installedApps = $this->appManager->getEnabledApps();
$installedApps = array_filter($installedApps, function ($app) {
try {
$this->appManager->getAppPath($app);

View file

@ -244,7 +244,7 @@ class UpdateAvailableNotificationsTest extends TestCase {
]);
$this->appManager->expects($this->once())
->method('getInstalledApps')
->method('getEnabledApps')
->willReturn($apps);
$job->expects($this->exactly(\count($apps)))

View file

@ -117,7 +117,7 @@ class Remove extends Command implements CompletionAwareInterface {
*/
public function completeArgumentValues($argumentName, CompletionContext $context): array {
if ($argumentName === 'app-id') {
return $this->manager->getInstalledApps();
return $this->manager->getEnabledApps();
}
return [];
}

View file

@ -61,7 +61,7 @@ class Repair extends Command {
$this->repair->addStep($step);
}
$apps = $this->appManager->getInstalledApps();
$apps = $this->appManager->getEnabledApps();
foreach ($apps as $app) {
if (!$this->appManager->isEnabledForUser($app)) {
continue;

View file

@ -88,7 +88,7 @@ class Application {
$this->writeMaintenanceModeInfo($input, $output);
} else {
$this->appManager->loadApps();
foreach ($this->appManager->getInstalledApps() as $app) {
foreach ($this->appManager->getEnabledApps() as $app) {
try {
$appPath = $this->appManager->getAppPath($app);
} catch (AppPathNotFoundException) {

View file

@ -97,7 +97,7 @@ class MetadataManager {
* @since 30.0.0
*/
public function getUnsupportedApps(array $metadata): array {
return array_values(array_diff($this->appManager->getInstalledApps(), array_keys($metadata['apps'])));
return array_values(array_diff($this->appManager->getEnabledApps(), array_keys($metadata['apps'])));
}
/**

View file

@ -328,7 +328,7 @@ class NavigationManager implements INavigationManager {
$apps = $this->appManager->getEnabledAppsForUser($user);
$this->customAppOrder = json_decode($this->config->getUserValue($user->getUID(), 'core', 'apporder', '[]'), true, flags:JSON_THROW_ON_ERROR);
} else {
$apps = $this->appManager->getInstalledApps();
$apps = $this->appManager->getEnabledApps();
$this->customAppOrder = [];
}

View file

@ -78,7 +78,7 @@ class JSConfigHelper {
$apps_paths = [];
if ($this->currentUser === null) {
$apps = $this->appManager->getInstalledApps();
$apps = $this->appManager->getEnabledApps();
} else {
$apps = $this->appManager->getEnabledAppsForUser($this->currentUser);
}

View file

@ -242,7 +242,7 @@ class Updater extends BasicEmitter {
$appManager = \OC::$server->getAppManager();
// upgrade appstore apps
$this->upgradeAppStoreApps($appManager->getInstalledApps());
$this->upgradeAppStoreApps($appManager->getEnabledApps());
$autoDisabledApps = $appManager->getAutoDisabledApps();
if (!empty($autoDisabledApps)) {
$this->upgradeAppStoreApps(array_keys($autoDisabledApps), $autoDisabledApps);

View file

@ -185,7 +185,7 @@ class OC_App {
}
if (is_null($user)) {
$apps = $appManager->getInstalledApps();
$apps = $appManager->getEnabledApps();
} else {
$apps = $appManager->getEnabledAppsForUser($user);
}

View file

@ -539,7 +539,7 @@ class AppManagerTest extends TestCase {
$this->assertTrue($this->manager->isEnabledForUser('test'));
}
public function testGetInstalledApps(): void {
public function testGetEnabledApps(): void {
$this->appConfig->setValue('test1', 'enabled', 'yes');
$this->appConfig->setValue('test2', 'enabled', 'no');
$this->appConfig->setValue('test3', 'enabled', '["foo"]');
@ -560,7 +560,7 @@ class AppManagerTest extends TestCase {
'viewer',
'workflowengine',
];
$this->assertEquals($apps, $this->manager->getInstalledApps());
$this->assertEquals($apps, $this->manager->getEnabledApps());
}
public function testGetAppsForUser(): void {

View file

@ -718,7 +718,7 @@ class NavigationManagerTest extends TestCase {
'id' => 'settings',
]);
$this->appManager->method('getInstalledApps')->willReturn([]);
$this->appManager->method('getEnabledApps')->willReturn([]);
$user = $this->createMock(IUser::class);
$user->method('getUID')->willReturn('user1');
@ -743,7 +743,7 @@ class NavigationManagerTest extends TestCase {
}
public function testDefaultEntryUpdated(): void {
$this->appManager->method('getInstalledApps')->willReturn([]);
$this->appManager->method('getEnabledApps')->willReturn([]);
$user = $this->createMock(IUser::class);
$user->method('getUID')->willReturn('user1');