Skip to content

Commit ed9b474

Browse files
authored
Merge pull request #49648 from nextcloud/fix/clarify-app-manager-methods
Clarify app manager method names
2 parents ee48caf + f758f56 commit ed9b474

File tree

39 files changed

+110
-84
lines changed

39 files changed

+110
-84
lines changed

apps/comments/lib/Activity/Listener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __construct(
3131
public function commentEvent(CommentsEvent $event): void {
3232
if ($event->getComment()->getObjectType() !== 'files'
3333
|| $event->getEvent() !== CommentsEvent::EVENT_ADD
34-
|| !$this->appManager->isInstalled('activity')) {
34+
|| !$this->appManager->isEnabledForAnyone('activity')) {
3535
// Comment not for file, not adding a comment or no activity-app enabled (save the energy)
3636
return;
3737
}

apps/comments/tests/Unit/Activity/ListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ protected function setUp(): void {
6767

6868
public function testCommentEvent(): void {
6969
$this->appManager->expects($this->any())
70-
->method('isInstalled')
70+
->method('isEnabledForAnyone')
7171
->with('activity')
7272
->willReturn(true);
7373

apps/dav/lib/AppInfo/PluginManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ private function populate(): void {
119119

120120
$this->calendarPlugins[] = $this->container->get(AppCalendarPlugin::class);
121121

122-
foreach ($this->appManager->getInstalledApps() as $app) {
122+
foreach ($this->appManager->getEnabledApps() as $app) {
123123
// load plugins and collections from info.xml
124124
$info = $this->appManager->getAppInfo($app);
125125
if (!isset($info['types']) || !in_array('dav', $info['types'], true)) {

apps/dav/lib/Connector/Sabre/Directory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ public function getChildren() {
220220
if (!$this->info->isReadable()) {
221221
// return 403 instead of 404 because a 404 would make
222222
// the caller believe that the collection itself does not exist
223-
if (Server::get(IAppManager::class)->isInstalled('files_accesscontrol')) {
223+
if (Server::get(IAppManager::class)->isEnabledForAnyone('files_accesscontrol')) {
224224
throw new Forbidden('No read permissions. This might be caused by files_accesscontrol, check your configured rules');
225225
} else {
226226
throw new Forbidden('No read permissions');

apps/dav/tests/unit/AppInfo/PluginManagerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function test(): void {
2424
$server = $this->createMock(ServerContainer::class);
2525

2626
$appManager = $this->createMock(AppManager::class);
27-
$appManager->method('getInstalledApps')
27+
$appManager->method('getEnabledApps')
2828
->willReturn(['adavapp', 'adavapp2']);
2929

3030
$appInfo1 = [

apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ public function getSupportedShareTypes() {
746746

747747
public function getUserDisplayName(string $userId): string {
748748
// check if gss is enabled and available
749-
if (!$this->appManager->isInstalled('globalsiteselector')
749+
if (!$this->appManager->isEnabledForAnyone('globalsiteselector')
750750
|| !class_exists('\OCA\GlobalSiteSelector\Service\SlaveService')) {
751751
return '';
752752
}

apps/files_sharing/lib/Controller/ShareAPIController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ private function fixMissingDisplayName(array $shares, ?array $updatedDisplayName
408408
private function retrieveFederatedDisplayName(array $userIds, bool $cacheOnly = false): array {
409409
// check if gss is enabled and available
410410
if (count($userIds) === 0
411-
|| !$this->appManager->isInstalled('globalsiteselector')
411+
|| !$this->appManager->isEnabledForAnyone('globalsiteselector')
412412
|| !class_exists('\OCA\GlobalSiteSelector\Service\SlaveService')) {
413413
return [];
414414
}

apps/files_trashbin/lib/AppInfo/Application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function boot(IBootContext $context): void {
7474
}
7575

7676
public function registerTrashBackends(ContainerInterface $serverContainer, LoggerInterface $logger, IAppManager $appManager, ITrashManager $trashManager): void {
77-
foreach ($appManager->getInstalledApps() as $app) {
77+
foreach ($appManager->getEnabledApps() as $app) {
7878
$appInfo = $appManager->getAppInfo($app);
7979
if (isset($appInfo['trash'])) {
8080
$backends = $appInfo['trash'];

apps/files_versions/lib/AppInfo/Application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function boot(IBootContext $context): void {
114114
}
115115

116116
public function registerVersionBackends(ContainerInterface $container, IAppManager $appManager, LoggerInterface $logger): void {
117-
foreach ($appManager->getInstalledApps() as $app) {
117+
foreach ($appManager->getEnabledApps() as $app) {
118118
$appInfo = $appManager->getAppInfo($app);
119119
if (isset($appInfo['versions'])) {
120120
$backends = $appInfo['versions'];

apps/settings/lib/Controller/AppSettingsController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function viewApps(): TemplateResponse {
9292
$this->initialState->provideInitialState('appstoreDeveloperDocs', $this->urlGenerator->linkToDocs('developer-manual'));
9393
$this->initialState->provideInitialState('appstoreUpdateCount', count($this->getAppsWithUpdates()));
9494

95-
if ($this->appManager->isInstalled('app_api')) {
95+
if ($this->appManager->isEnabledForAnyone('app_api')) {
9696
try {
9797
Server::get(\OCA\AppAPI\Service\ExAppsPageService::class)->provideAppApiState($this->initialState);
9898
} catch (\Psr\Container\NotFoundExceptionInterface|\Psr\Container\ContainerExceptionInterface $e) {
@@ -440,7 +440,7 @@ private function getAppsForCategory($requestedCategory = ''): array {
440440
}
441441

442442
$currentVersion = '';
443-
if ($this->appManager->isInstalled($app['id'])) {
443+
if ($this->appManager->isEnabledForAnyone($app['id'])) {
444444
$currentVersion = $this->appManager->getAppVersion($app['id']);
445445
} else {
446446
$currentVersion = $app['releases'][0]['version'];

0 commit comments

Comments
 (0)