diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml
index a8c6a2e1a33..d34cdd388b2 100644
--- a/build/psalm-baseline.xml
+++ b/build/psalm-baseline.xml
@@ -4057,11 +4057,6 @@
-
-
-
-
-
userToNotify]]>
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php
index aaaa08de939..fe73bc0443d 100644
--- a/lib/composer/composer/autoload_classmap.php
+++ b/lib/composer/composer/autoload_classmap.php
@@ -763,14 +763,6 @@ return array(
'OCP\\Profile\\ParameterDoesNotExistException' => $baseDir . '/lib/public/Profile/ParameterDoesNotExistException.php',
'OCP\\Profiler\\IProfile' => $baseDir . '/lib/public/Profiler/IProfile.php',
'OCP\\Profiler\\IProfiler' => $baseDir . '/lib/public/Profiler/IProfiler.php',
- 'OCP\\Remote\\Api\\IApiCollection' => $baseDir . '/lib/public/Remote/Api/IApiCollection.php',
- 'OCP\\Remote\\Api\\IApiFactory' => $baseDir . '/lib/public/Remote/Api/IApiFactory.php',
- 'OCP\\Remote\\Api\\ICapabilitiesApi' => $baseDir . '/lib/public/Remote/Api/ICapabilitiesApi.php',
- 'OCP\\Remote\\Api\\IUserApi' => $baseDir . '/lib/public/Remote/Api/IUserApi.php',
- 'OCP\\Remote\\ICredentials' => $baseDir . '/lib/public/Remote/ICredentials.php',
- 'OCP\\Remote\\IInstance' => $baseDir . '/lib/public/Remote/IInstance.php',
- 'OCP\\Remote\\IInstanceFactory' => $baseDir . '/lib/public/Remote/IInstanceFactory.php',
- 'OCP\\Remote\\IUser' => $baseDir . '/lib/public/Remote/IUser.php',
'OCP\\RichObjectStrings\\Definitions' => $baseDir . '/lib/public/RichObjectStrings/Definitions.php',
'OCP\\RichObjectStrings\\IRichTextFormatter' => $baseDir . '/lib/public/RichObjectStrings/IRichTextFormatter.php',
'OCP\\RichObjectStrings\\IValidator' => $baseDir . '/lib/public/RichObjectStrings/IValidator.php',
@@ -2050,15 +2042,6 @@ return array(
'OC\\Profiler\\Profiler' => $baseDir . '/lib/private/Profiler/Profiler.php',
'OC\\Profiler\\RoutingDataCollector' => $baseDir . '/lib/private/Profiler/RoutingDataCollector.php',
'OC\\RedisFactory' => $baseDir . '/lib/private/RedisFactory.php',
- 'OC\\Remote\\Api\\ApiBase' => $baseDir . '/lib/private/Remote/Api/ApiBase.php',
- 'OC\\Remote\\Api\\ApiCollection' => $baseDir . '/lib/private/Remote/Api/ApiCollection.php',
- 'OC\\Remote\\Api\\ApiFactory' => $baseDir . '/lib/private/Remote/Api/ApiFactory.php',
- 'OC\\Remote\\Api\\NotFoundException' => $baseDir . '/lib/private/Remote/Api/NotFoundException.php',
- 'OC\\Remote\\Api\\OCS' => $baseDir . '/lib/private/Remote/Api/OCS.php',
- 'OC\\Remote\\Credentials' => $baseDir . '/lib/private/Remote/Credentials.php',
- 'OC\\Remote\\Instance' => $baseDir . '/lib/private/Remote/Instance.php',
- 'OC\\Remote\\InstanceFactory' => $baseDir . '/lib/private/Remote/InstanceFactory.php',
- 'OC\\Remote\\User' => $baseDir . '/lib/private/Remote/User.php',
'OC\\Repair' => $baseDir . '/lib/private/Repair.php',
'OC\\RepairException' => $baseDir . '/lib/private/RepairException.php',
'OC\\Repair\\AddBruteForceCleanupJob' => $baseDir . '/lib/private/Repair/AddBruteForceCleanupJob.php',
diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php
index 9d62ce8d334..f4d201e709a 100644
--- a/lib/composer/composer/autoload_static.php
+++ b/lib/composer/composer/autoload_static.php
@@ -804,14 +804,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OCP\\Profile\\ParameterDoesNotExistException' => __DIR__ . '/../../..' . '/lib/public/Profile/ParameterDoesNotExistException.php',
'OCP\\Profiler\\IProfile' => __DIR__ . '/../../..' . '/lib/public/Profiler/IProfile.php',
'OCP\\Profiler\\IProfiler' => __DIR__ . '/../../..' . '/lib/public/Profiler/IProfiler.php',
- 'OCP\\Remote\\Api\\IApiCollection' => __DIR__ . '/../../..' . '/lib/public/Remote/Api/IApiCollection.php',
- 'OCP\\Remote\\Api\\IApiFactory' => __DIR__ . '/../../..' . '/lib/public/Remote/Api/IApiFactory.php',
- 'OCP\\Remote\\Api\\ICapabilitiesApi' => __DIR__ . '/../../..' . '/lib/public/Remote/Api/ICapabilitiesApi.php',
- 'OCP\\Remote\\Api\\IUserApi' => __DIR__ . '/../../..' . '/lib/public/Remote/Api/IUserApi.php',
- 'OCP\\Remote\\ICredentials' => __DIR__ . '/../../..' . '/lib/public/Remote/ICredentials.php',
- 'OCP\\Remote\\IInstance' => __DIR__ . '/../../..' . '/lib/public/Remote/IInstance.php',
- 'OCP\\Remote\\IInstanceFactory' => __DIR__ . '/../../..' . '/lib/public/Remote/IInstanceFactory.php',
- 'OCP\\Remote\\IUser' => __DIR__ . '/../../..' . '/lib/public/Remote/IUser.php',
'OCP\\RichObjectStrings\\Definitions' => __DIR__ . '/../../..' . '/lib/public/RichObjectStrings/Definitions.php',
'OCP\\RichObjectStrings\\IRichTextFormatter' => __DIR__ . '/../../..' . '/lib/public/RichObjectStrings/IRichTextFormatter.php',
'OCP\\RichObjectStrings\\IValidator' => __DIR__ . '/../../..' . '/lib/public/RichObjectStrings/IValidator.php',
@@ -2091,15 +2083,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OC\\Profiler\\Profiler' => __DIR__ . '/../../..' . '/lib/private/Profiler/Profiler.php',
'OC\\Profiler\\RoutingDataCollector' => __DIR__ . '/../../..' . '/lib/private/Profiler/RoutingDataCollector.php',
'OC\\RedisFactory' => __DIR__ . '/../../..' . '/lib/private/RedisFactory.php',
- 'OC\\Remote\\Api\\ApiBase' => __DIR__ . '/../../..' . '/lib/private/Remote/Api/ApiBase.php',
- 'OC\\Remote\\Api\\ApiCollection' => __DIR__ . '/../../..' . '/lib/private/Remote/Api/ApiCollection.php',
- 'OC\\Remote\\Api\\ApiFactory' => __DIR__ . '/../../..' . '/lib/private/Remote/Api/ApiFactory.php',
- 'OC\\Remote\\Api\\NotFoundException' => __DIR__ . '/../../..' . '/lib/private/Remote/Api/NotFoundException.php',
- 'OC\\Remote\\Api\\OCS' => __DIR__ . '/../../..' . '/lib/private/Remote/Api/OCS.php',
- 'OC\\Remote\\Credentials' => __DIR__ . '/../../..' . '/lib/private/Remote/Credentials.php',
- 'OC\\Remote\\Instance' => __DIR__ . '/../../..' . '/lib/private/Remote/Instance.php',
- 'OC\\Remote\\InstanceFactory' => __DIR__ . '/../../..' . '/lib/private/Remote/InstanceFactory.php',
- 'OC\\Remote\\User' => __DIR__ . '/../../..' . '/lib/private/Remote/User.php',
'OC\\Repair' => __DIR__ . '/../../..' . '/lib/private/Repair.php',
'OC\\RepairException' => __DIR__ . '/../../..' . '/lib/private/RepairException.php',
'OC\\Repair\\AddBruteForceCleanupJob' => __DIR__ . '/../../..' . '/lib/private/Repair/AddBruteForceCleanupJob.php',
diff --git a/lib/private/Remote/Api/ApiBase.php b/lib/private/Remote/Api/ApiBase.php
deleted file mode 100644
index 1b8f5395c3e..00000000000
--- a/lib/private/Remote/Api/ApiBase.php
+++ /dev/null
@@ -1,77 +0,0 @@
-clientService->newClient();
- }
-
- protected function addDefaultHeaders(array $headers) {
- return array_merge([
- 'OCS-APIREQUEST' => 'true',
- 'Accept' => 'application/json'
- ], $headers);
- }
-
- /**
- * @param string $method
- * @param string $url
- * @param array $body
- * @param array $query
- * @param array $headers
- * @return resource|string
- * @throws \InvalidArgumentException
- */
- protected function request($method, $url, array $body = [], array $query = [], array $headers = []) {
- $fullUrl = trim($this->instance->getFullUrl(), '/') . '/' . $url;
- $options = [
- 'query' => $query,
- 'headers' => $this->addDefaultHeaders($headers),
- 'auth' => [$this->credentials->getUsername(), $this->credentials->getPassword()]
- ];
- if ($body) {
- $options['body'] = $body;
- }
-
- $client = $this->getHttpClient();
-
- switch ($method) {
- case 'get':
- $response = $client->get($fullUrl, $options);
- break;
- case 'post':
- $response = $client->post($fullUrl, $options);
- break;
- case 'put':
- $response = $client->put($fullUrl, $options);
- break;
- case 'delete':
- $response = $client->delete($fullUrl, $options);
- break;
- case 'options':
- $response = $client->options($fullUrl, $options);
- break;
- default:
- throw new \InvalidArgumentException('Invalid method ' . $method);
- }
-
- return $response->getBody();
- }
-}
diff --git a/lib/private/Remote/Api/ApiCollection.php b/lib/private/Remote/Api/ApiCollection.php
deleted file mode 100644
index 4513fb4d098..00000000000
--- a/lib/private/Remote/Api/ApiCollection.php
+++ /dev/null
@@ -1,34 +0,0 @@
-instance, $this->credentials, $this->clientService);
- }
-
- #[\Override]
- public function getUserApi() {
- return new OCS($this->instance, $this->credentials, $this->clientService);
- }
-}
diff --git a/lib/private/Remote/Api/ApiFactory.php b/lib/private/Remote/Api/ApiFactory.php
deleted file mode 100644
index 4ad7ca737bd..00000000000
--- a/lib/private/Remote/Api/ApiFactory.php
+++ /dev/null
@@ -1,27 +0,0 @@
-clientService);
- }
-}
diff --git a/lib/private/Remote/Api/NotFoundException.php b/lib/private/Remote/Api/NotFoundException.php
deleted file mode 100644
index 2f3953629fe..00000000000
--- a/lib/private/Remote/Api/NotFoundException.php
+++ /dev/null
@@ -1,13 +0,0 @@
-getResponse()->getStatusCode() === 404) {
- throw new NotFoundException();
- } elseif ($e->getResponse()->getStatusCode() === 403 || $e->getResponse()->getStatusCode() === 401) {
- throw new ForbiddenException();
- } else {
- throw $e;
- }
- }
- if (!isset($response['ocs']) || !isset($response['ocs']['meta'])) {
- throw new \Exception('Invalid ocs response');
- }
- if ($response['ocs']['meta']['statuscode'] === OCSController::RESPOND_UNAUTHORISED) {
- throw new ForbiddenException();
- }
- if ($response['ocs']['meta']['statuscode'] === OCSController::RESPOND_NOT_FOUND) {
- throw new NotFoundException();
- }
- if ($response['ocs']['meta']['status'] !== 'ok') {
- throw new \Exception('Unknown ocs error ' . $response['ocs']['meta']['message']);
- }
-
- return $response['ocs']['data'];
- }
-
- /**
- * @param array $data
- * @param string $type
- * @param string[] $keys
- * @throws \Exception
- */
- private function checkResponseArray(array $data, $type, array $keys) {
- foreach ($keys as $key) {
- if (!array_key_exists($key, $data)) {
- throw new \Exception('Invalid ' . $type . ' response, expected field ' . $key . ' not found');
- }
- }
- }
-
- #[\Override]
- public function getUser($userId) {
- $result = $this->request('get', 'cloud/users/' . $userId);
- $this->checkResponseArray($result, 'user', User::EXPECTED_KEYS);
- return new User($result);
- }
-
- /**
- * @return array The capabilities in the form of [$appId => [$capability => $value]]
- */
- #[\Override]
- public function getCapabilities() {
- $result = $this->request('get', 'cloud/capabilities');
- return $result['capabilities'];
- }
-}
diff --git a/lib/private/Remote/Credentials.php b/lib/private/Remote/Credentials.php
deleted file mode 100644
index 5946555dacc..00000000000
--- a/lib/private/Remote/Credentials.php
+++ /dev/null
@@ -1,30 +0,0 @@
-user;
- }
-
- #[\Override]
- public function getPassword(): string {
- return $this->password;
- }
-}
diff --git a/lib/private/Remote/Instance.php b/lib/private/Remote/Instance.php
deleted file mode 100644
index 8aa395c7059..00000000000
--- a/lib/private/Remote/Instance.php
+++ /dev/null
@@ -1,107 +0,0 @@
-url = str_replace('http://', '', $url);
- }
-
- #[Override]
- public function getUrl(): string {
- return $this->url;
- }
-
- #[Override]
- public function getFullUrl(): string {
- return $this->getProtocol() . '://' . $this->getUrl();
- }
-
- #[Override]
- public function getVersion(): string {
- $status = $this->getStatus();
- return $status['version'];
- }
-
- #[Override]
- public function getProtocol(): string {
- $status = $this->getStatus();
- return $status['protocol'];
- }
-
- #[Override]
- public function isActive(): bool {
- $status = $this->getStatus();
- return $status['installed'] && !$status['maintenance'];
- }
-
- private function getStatus(): array {
- if ($this->status) {
- return $this->status;
- }
- $key = 'remote/' . $this->url . '/status';
- $httpsKey = 'remote/' . $this->url . '/https';
- $status = $this->cache->get($key);
- if (!$status) {
- $response = $this->downloadStatus('https://' . $this->getUrl() . '/status.php');
- $protocol = 'https';
- if (!$response) {
- if ($status = $this->cache->get($httpsKey)) {
- throw new \Exception('refusing to connect to remote instance(' . $this->url . ') over http that was previously accessible over https');
- }
- $response = $this->downloadStatus('http://' . $this->getUrl() . '/status.php');
- $protocol = 'http';
- } else {
- $this->cache->set($httpsKey, true, 60 * 60 * 24 * 365);
- }
- $status = json_decode($response, true);
- if ($status) {
- $status['protocol'] = $protocol;
- }
- if ($status) {
- $this->cache->set($key, $status, 5 * 60);
- $this->status = $status;
- } else {
- throw new NotFoundException('Remote server not found at address ' . $this->url);
- }
- }
- return $status;
- }
-
- private function downloadStatus(string $url): false|string {
- try {
- $request = $this->clientService->newClient()->get($url);
- $content = $request->getBody();
-
- // IResponse.getBody responds with null|resource if returning a stream response was requested.
- // As that's not the case here, we can just ignore the psalm warning by adding an assertion.
- assert(is_string($content));
-
- return $content;
- } catch (\Exception) {
- return false;
- }
- }
-}
diff --git a/lib/private/Remote/InstanceFactory.php b/lib/private/Remote/InstanceFactory.php
deleted file mode 100644
index 42bec5abb50..00000000000
--- a/lib/private/Remote/InstanceFactory.php
+++ /dev/null
@@ -1,25 +0,0 @@
-cache, $this->clientService);
- }
-}
diff --git a/lib/private/Remote/User.php b/lib/private/Remote/User.php
deleted file mode 100644
index e72255a56bd..00000000000
--- a/lib/private/Remote/User.php
+++ /dev/null
@@ -1,135 +0,0 @@
-data['id'];
- }
-
- /**
- * @return string
- */
- #[\Override]
- public function getEmail() {
- return $this->data['email'];
- }
-
- /**
- * @return string
- */
- #[\Override]
- public function getDisplayName() {
- return $this->data['displayname'];
- }
-
- /**
- * @return string
- */
- #[\Override]
- public function getPhone() {
- return $this->data['phone'];
- }
-
- /**
- * @return string
- */
- #[\Override]
- public function getAddress() {
- return $this->data['address'];
- }
-
- /**
- * @return string
- */
- #[\Override]
- public function getWebsite() {
- return $this->data['website'];
- }
-
- /**
- * @return string
- */
- #[\Override]
- public function getTwitter() {
- return $this->data['twitter'] ?? '';
- }
-
- /**
- * @return string[]
- */
- #[\Override]
- public function getGroups() {
- return $this->data['groups'];
- }
-
- /**
- * @return string
- */
- #[\Override]
- public function getLanguage() {
- return $this->data['language'];
- }
-
- /**
- * @return int
- */
- #[\Override]
- public function getUsedSpace() {
- return $this->data['quota']['used'];
- }
-
- /**
- * @return int
- */
- #[\Override]
- public function getFreeSpace() {
- return $this->data['quota']['free'];
- }
-
- /**
- * @return int
- */
- #[\Override]
- public function getTotalSpace() {
- return $this->data['quota']['total'];
- }
-
- /**
- * @return int
- */
- #[\Override]
- public function getQuota() {
- return $this->data['quota']['quota'];
- }
-}
diff --git a/lib/private/Server.php b/lib/private/Server.php
index edbf8c225a6..de5d98f48eb 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -108,8 +108,6 @@ use OC\Preview\Watcher;
use OC\Preview\WatcherConnector;
use OC\Profile\ProfileManager;
use OC\Profiler\Profiler;
-use OC\Remote\Api\ApiFactory;
-use OC\Remote\InstanceFactory;
use OC\RichObjectStrings\RichTextFormatter;
use OC\RichObjectStrings\Validator;
use OC\Route\CachingRouter;
@@ -254,8 +252,6 @@ use OCP\OCS\IDiscoveryService;
use OCP\Preview\IMimeIconProvider;
use OCP\Profile\IProfileManager;
use OCP\Profiler\IProfiler;
-use OCP\Remote\Api\IApiFactory;
-use OCP\Remote\IInstanceFactory;
use OCP\RichObjectStrings\IRichTextFormatter;
use OCP\RichObjectStrings\IValidator;
use OCP\Route\IRouter;
@@ -1232,15 +1228,6 @@ class Server extends ServerContainer implements IServerContainer {
);
});
- $this->registerService(IApiFactory::class, function (ContainerInterface $c) {
- return new ApiFactory($c->get(IClientService::class));
- });
-
- $this->registerService(IInstanceFactory::class, function (ContainerInterface $c) {
- $memcacheFactory = $c->get(ICacheFactory::class);
- return new InstanceFactory($memcacheFactory->createLocal('remoteinstance.'), $c->get(IClientService::class));
- });
-
$this->registerAlias(IContactsStore::class, ContactsStore::class);
$this->registerAlias(IAccountManager::class, AccountManager::class);
diff --git a/lib/public/Remote/Api/IApiCollection.php b/lib/public/Remote/Api/IApiCollection.php
deleted file mode 100644
index 8b72871c3c1..00000000000
--- a/lib/public/Remote/Api/IApiCollection.php
+++ /dev/null
@@ -1,32 +0,0 @@
- [$capability => $value]]
- *
- * @since 13.0.0
- * @deprecated 23.0.0
- */
- public function getCapabilities();
-}
diff --git a/lib/public/Remote/Api/IUserApi.php b/lib/public/Remote/Api/IUserApi.php
deleted file mode 100644
index fcd38bf99c2..00000000000
--- a/lib/public/Remote/Api/IUserApi.php
+++ /dev/null
@@ -1,25 +0,0 @@
-instanceFactory = new InstanceFactory(new ArrayCache(), $this->getClientService());
- $this->expectGetRequest('https://example.com/status.php',
- '{"installed":true,"maintenance":false,"needsDbUpgrade":false,"version":"13.0.0.5","versionstring":"13.0.0 alpha","edition":"","productname":"Nextcloud"}');
- }
-
- protected function getOCSClient() {
- return new OCS(
- $this->instanceFactory->getInstance('example.com'),
- new Credentials('user', 'pass'),
- $this->getClientService()
- );
- }
-
- protected function getOCSUrl($url) {
- return 'https://example.com/ocs/v2.php/' . $url;
- }
-
- public function testGetUser(): void {
- $client = $this->getOCSClient();
-
- $this->expectGetRequest($this->getOCSUrl('cloud/users/user'),
- '{"ocs":{"meta":{"status":"ok","statuscode":200,"message":"OK"},
- "data":{"id":"user","quota":{"free":5366379387,"used":2329733,"total":5368709120,"relative":0.040000000000000001,"quota":5368709120},
- "email":null,"displayname":"test","phone":"","address":"","website":"","twitter":"","groups":["Test","Test1"],"language":"en"}}}');
-
- $user = $client->getUser('user');
- $this->assertEquals('user', $user->getUserId());
- }
-
- public function testGetUserInvalidResponse(): void {
- $this->expectException(\Exception::class);
- $this->expectExceptionMessage('Invalid user response, expected field email not found');
-
- $client = $this->getOCSClient();
-
- $this->expectGetRequest($this->getOCSUrl('cloud/users/user'),
- '{"ocs":{"meta":{"status":"ok","statuscode":200,"message":"OK"},
- "data":{"id":"user"}}}');
-
- $client->getUser('user');
- }
-
- public function testInvalidPassword(): void {
- $this->expectException(ForbiddenException::class);
-
- $client = $this->getOCSClient();
-
- $this->expectGetRequest($this->getOCSUrl('cloud/users/user'),
- '{"ocs":{"meta":{"status":"failure","statuscode":997,"message":"Current user is not logged in"},"data":[]}}');
-
- $client->getUser('user');
- }
-}
diff --git a/tests/lib/Remote/InstanceTest.php b/tests/lib/Remote/InstanceTest.php
deleted file mode 100644
index 2173bc3c6b6..00000000000
--- a/tests/lib/Remote/InstanceTest.php
+++ /dev/null
@@ -1,76 +0,0 @@
-cache = new ArrayCache();
- }
-
- public function testBasicStatus(): void {
- $instance = new Instance('example.com', $this->cache, $this->getClientService());
- $this->expectGetRequest('https://example.com/status.php', '{"installed":true,"maintenance":false,"needsDbUpgrade":false,"version":"13.0.0.5","versionstring":"13.0.0 alpha","edition":"","productname":"Nextcloud"}');
-
- $this->assertEquals(true, $instance->isActive());
- $this->assertEquals('13.0.0.5', $instance->getVersion());
- $this->assertEquals('https', $instance->getProtocol());
- $this->assertEquals('https://example.com', $instance->getFullUrl());
- }
-
- public function testHttpFallback(): void {
- $instance = new Instance('example.com', $this->cache, $this->getClientService());
- $this->expectGetRequest('https://example.com/status.php', new \Exception());
- $this->expectGetRequest('http://example.com/status.php', '{"installed":true,"maintenance":false,"needsDbUpgrade":false,"version":"13.0.0.5","versionstring":"13.0.0 alpha","edition":"","productname":"Nextcloud"}');
-
- $this->assertEquals('http', $instance->getProtocol());
- $this->assertEquals('http://example.com', $instance->getFullUrl());
- }
-
- public function testRerequestHttps(): void {
- $instance = new Instance('example.com', $this->cache, $this->getClientService());
- $this->expectGetRequest('https://example.com/status.php', '{"installed":true,"maintenance":false,"needsDbUpgrade":false,"version":"13.0.0.5","versionstring":"13.0.0 alpha","edition":"","productname":"Nextcloud"}');
-
- $this->assertEquals('https', $instance->getProtocol());
- $this->assertEquals(true, $instance->isActive());
-
- $this->cache->remove('remote/example.com/status');
- $this->expectGetRequest('https://example.com/status.php', '{"installed":true,"maintenance":true,"needsDbUpgrade":false,"version":"13.0.0.5","versionstring":"13.0.0 alpha","edition":"","productname":"Nextcloud"}');
- $instance2 = new Instance('example.com', $this->cache, $this->getClientService());
- $this->assertEquals('https', $instance2->getProtocol());
- $this->assertEquals(false, $instance2->isActive());
- }
-
- public function testPreventDowngradeAttach(): void {
- $this->expectException(\Exception::class);
- $this->expectExceptionMessage('refusing to connect to remote instance(example.com) over http that was previously accessible over https');
-
- $instance = new Instance('example.com', $this->cache, $this->getClientService());
- $this->expectGetRequest('https://example.com/status.php', '{"installed":true,"maintenance":false,"needsDbUpgrade":false,"version":"13.0.0.5","versionstring":"13.0.0 alpha","edition":"","productname":"Nextcloud"}');
-
- $this->assertEquals('https', $instance->getProtocol());
-
- $this->expectGetRequest('https://example.com/status.php', new \Exception());
- $this->cache->remove('remote/example.com/status');
- $instance2 = new Instance('example.com', $this->cache, $this->getClientService());
- $instance2->getProtocol();
- }
-}