diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2025-03-10 15:31:45 +0100 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2025-03-11 21:56:45 +0100 |
commit | e674631f9b310e9b3a39ed4979b93c2d545b6348 (patch) | |
tree | ddfc34726e6fa349838e80645f2863d4bbd5ee6d | |
parent | 4ec1edb890ce02d5f13cbf0ca1a0c7766ec4ac7d (diff) | |
download | nextcloud-server-e674631f9b310e9b3a39ed4979b93c2d545b6348.tar.gz nextcloud-server-e674631f9b310e9b3a39ed4979b93c2d545b6348.zip |
fix(lookup-server): do not query data by default
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
6 files changed, 12 insertions, 15 deletions
diff --git a/apps/federatedfilesharing/lib/FederatedShareProvider.php b/apps/federatedfilesharing/lib/FederatedShareProvider.php index 9ca36b65c4f..6ffd71020fa 100644 --- a/apps/federatedfilesharing/lib/FederatedShareProvider.php +++ b/apps/federatedfilesharing/lib/FederatedShareProvider.php @@ -1039,8 +1039,8 @@ class FederatedShareProvider implements IShareProvider { if ($this->gsConfig->isGlobalScaleEnabled()) { return true; } - $result = $this->config->getAppValue('files_sharing', 'lookupServerEnabled', 'yes'); - return ($result === 'yes'); + $result = $this->config->getAppValue('files_sharing', 'lookupServerEnabled', 'no'); + return $result === 'yes'; } diff --git a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php index 41b79a88011..a9b56d0ee76 100644 --- a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php +++ b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php @@ -848,7 +848,7 @@ class FederatedShareProviderTest extends \Test\TestCase { $this->gsConfig->expects($this->once())->method('isGlobalScaleEnabled') ->willReturn($gsEnabled); $this->config->expects($this->any())->method('getAppValue') - ->with('files_sharing', 'lookupServerEnabled', 'yes') + ->with('files_sharing', 'lookupServerEnabled', 'no') ->willReturn($isEnabled); $this->assertSame($expected, diff --git a/apps/files_sharing/lib/Controller/ShareesAPIController.php b/apps/files_sharing/lib/Controller/ShareesAPIController.php index 31014ac6565..a55720c00b5 100644 --- a/apps/files_sharing/lib/Controller/ShareesAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareesAPIController.php @@ -212,12 +212,9 @@ class ShareesAPIController extends OCSController { $this->offset = $perPage * ($page - 1); // In global scale mode we always search the loogup server - if ($this->config->getSystemValueBool('gs.enabled', false)) { - $lookup = true; - $this->result['lookupEnabled'] = true; - } else { - $this->result['lookupEnabled'] = $this->config->getAppValue('files_sharing', 'lookupServerEnabled', 'yes') === 'yes'; - } + $lookup = $this->config->getSystemValueBool('gs.enabled', false) + || $this->config->getAppValue('files_sharing', 'lookupServerEnabled', 'no') === 'yes'; + $this->result['lookupEnabled'] = $lookup; [$result, $hasMoreResults] = $this->collaboratorSearch->search($search, $shareTypes, $lookup, $this->limit, $this->offset); diff --git a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php index b56e57d272a..6c816951da6 100644 --- a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php @@ -260,7 +260,7 @@ class ShareesAPIControllerTest extends TestCase { ->method('getAppValue') ->with($this->anything(), $this->anything(), $this->anything()) ->willReturnMap([ - ['files_sharing', 'lookupServerEnabled', 'yes', 'yes'], + ['files_sharing', 'lookupServerEnabled', 'no', 'yes'], ]); $this->shareManager->expects($this->once()) diff --git a/lib/private/Collaboration/Collaborators/LookupPlugin.php b/lib/private/Collaboration/Collaborators/LookupPlugin.php index 5a03e4f8673..62cd7b9f2c9 100644 --- a/lib/private/Collaboration/Collaborators/LookupPlugin.php +++ b/lib/private/Collaboration/Collaborators/LookupPlugin.php @@ -54,7 +54,7 @@ class LookupPlugin implements ISearchPlugin { public function search($search, $limit, $offset, ISearchResult $searchResult): bool { $isGlobalScaleEnabled = $this->config->getSystemValueBool('gs.enabled', false); - $isLookupServerEnabled = $this->config->getAppValue('files_sharing', 'lookupServerEnabled', 'yes') === 'yes'; + $isLookupServerEnabled = $this->config->getAppValue('files_sharing', 'lookupServerEnabled', 'no') === 'yes'; $hasInternetConnection = $this->config->getSystemValueBool('has_internet_connection', true); // if case of Global Scale we always search the lookup server diff --git a/tests/lib/Collaboration/Collaborators/LookupPluginTest.php b/tests/lib/Collaboration/Collaborators/LookupPluginTest.php index 3eb28a861a5..b4819532b34 100644 --- a/tests/lib/Collaboration/Collaborators/LookupPluginTest.php +++ b/tests/lib/Collaboration/Collaborators/LookupPluginTest.php @@ -89,7 +89,7 @@ class LookupPluginTest extends TestCase { public function testSearchNoLookupServerURI() { $this->config->expects($this->once()) ->method('getAppValue') - ->with('files_sharing', 'lookupServerEnabled', 'yes') + ->with('files_sharing', 'lookupServerEnabled', 'no') ->willReturn('yes'); $this->config->expects($this->exactly(2)) ->method('getSystemValueBool') @@ -118,7 +118,7 @@ class LookupPluginTest extends TestCase { public function testSearchNoInternet() { $this->config->expects($this->once()) ->method('getAppValue') - ->with('files_sharing', 'lookupServerEnabled', 'yes') + ->with('files_sharing', 'lookupServerEnabled', 'no') ->willReturn('yes'); $this->config->expects($this->exactly(2)) ->method('getSystemValueBool') @@ -154,7 +154,7 @@ class LookupPluginTest extends TestCase { $this->config->expects($this->once()) ->method('getAppValue') - ->with('files_sharing', 'lookupServerEnabled', 'yes') + ->with('files_sharing', 'lookupServerEnabled', 'no') ->willReturn('yes'); $this->config->expects($this->exactly(2)) ->method('getSystemValueBool') @@ -214,7 +214,7 @@ class LookupPluginTest extends TestCase { $this->config->expects($this->once()) ->method('getAppValue') - ->with('files_sharing', 'lookupServerEnabled', 'yes') + ->with('files_sharing', 'lookupServerEnabled', 'no') ->willReturn($LookupEnabled ? 'yes' : 'no'); if ($GSEnabled || $LookupEnabled) { $searchResult->expects($this->once()) |