fix: Replace getInstalledApps calls with getEnabledApps

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
pull/49648/head
Côme Chilliet 11 months ago
parent a3685551f7
commit f758f565d4
No known key found for this signature in database
GPG Key ID: A3E2F658B28C760A
  1. 2
      apps/dav/lib/AppInfo/PluginManager.php
  2. 2
      apps/dav/tests/unit/AppInfo/PluginManagerTest.php
  3. 2
      apps/files_trashbin/lib/AppInfo/Application.php
  4. 2
      apps/files_versions/lib/AppInfo/Application.php
  5. 2
      apps/updatenotification/lib/BackgroundJob/UpdateAvailableNotifications.php
  6. 2
      apps/updatenotification/lib/Command/Check.php
  7. 2
      apps/updatenotification/lib/Controller/APIController.php
  8. 2
      apps/updatenotification/tests/BackgroundJob/UpdateAvailableNotificationsTest.php
  9. 2
      core/Command/App/Remove.php
  10. 2
      core/Command/Maintenance/Repair.php
  11. 2
      lib/private/Console/Application.php
  12. 2
      lib/private/Migration/MetadataManager.php
  13. 2
      lib/private/NavigationManager.php
  14. 2
      lib/private/Template/JSConfigHelper.php
  15. 2
      lib/private/Updater.php
  16. 2
      lib/private/legacy/OC_App.php
  17. 4
      tests/lib/App/AppManagerTest.php
  18. 4
      tests/lib/NavigationManagerTest.php

@ -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)) {

@ -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 = [

@ -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'];

@ -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'];

@ -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) {

@ -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) {

@ -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);

@ -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)))

@ -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 [];
}

@ -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;

@ -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) {

@ -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'])));
}
/**

@ -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 = [];
}

@ -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);
}

@ -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);

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

@ -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 {

@ -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');

Loading…
Cancel
Save