diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2022-02-22 12:01:43 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-22 12:01:43 +0300 |
commit | f10ba8e8676704503fd130b2199d1ba48a5044a2 (patch) | |
tree | 42d63c09490eee7d55fb00d6cf2940b70628b8ed | |
parent | 7323a440a91502d84261d6219a02a5355218a098 (diff) | |
parent | cff8f018bc5b8f15f69462d562e84275d5cc2dd6 (diff) |
Merge pull request #6912 from nextcloud/feature/remove-unused-app-config
Remove unused app config
-rw-r--r-- | lib/BackgroundJob/CheckHostedSignalingServer.php | 2 | ||||
-rw-r--r-- | lib/Migration/Version14000Date20220217115327.php | 49 | ||||
-rw-r--r-- | tests/php/BackgroundJob/CheckHostedSignalingServerTest.php | 8 |
3 files changed, 51 insertions, 8 deletions
diff --git a/lib/BackgroundJob/CheckHostedSignalingServer.php b/lib/BackgroundJob/CheckHostedSignalingServer.php index 4d0671679..256dcd9d2 100644 --- a/lib/BackgroundJob/CheckHostedSignalingServer.php +++ b/lib/BackgroundJob/CheckHostedSignalingServer.php @@ -145,8 +145,6 @@ class CheckHostedSignalingServer extends TimedJob { $this->config->setAppValue('spreed', 'hosted-signaling-server-account', json_encode($accountInfo)); } - $this->config->setAppValue('spreed', 'hosted-signaling-server-account-last-checked', $this->time->getTime()); - if (!is_null($notificationSubject)) { $this->logger->info('Hosted signaling server background job caused a notification: ' . $notificationSubject . ' ' . json_encode($notificationParameters)); diff --git a/lib/Migration/Version14000Date20220217115327.php b/lib/Migration/Version14000Date20220217115327.php new file mode 100644 index 000000000..7a37254f4 --- /dev/null +++ b/lib/Migration/Version14000Date20220217115327.php @@ -0,0 +1,49 @@ +<?php + +declare(strict_types=1); +/** + * @copyright Copyright (c) 2022, Vitor Mattos <vitor@php.rio> + * + * @author Vitor Mattos <vitor@php.rio> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +namespace OCA\Talk\Migration; + +use Closure; +use OCP\IConfig; +use OCP\Migration\IOutput; +use OCP\Migration\SimpleMigrationStep; + +class Version14000Date20220217115327 extends SimpleMigrationStep { + + /** @var IConfig */ + protected $config; + + public function __construct(IConfig $config) { + $this->config = $config; + } + + /** + * @param IOutput $output + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` + * @param array $options + */ + public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { + $this->config->deleteAppValue('spreed', 'hosted-signaling-server-account-last-checked'); + } +} diff --git a/tests/php/BackgroundJob/CheckHostedSignalingServerTest.php b/tests/php/BackgroundJob/CheckHostedSignalingServerTest.php index 11b0ab978..a187db92a 100644 --- a/tests/php/BackgroundJob/CheckHostedSignalingServerTest.php +++ b/tests/php/BackgroundJob/CheckHostedSignalingServerTest.php @@ -87,9 +87,6 @@ class CheckHostedSignalingServerTest extends TestCase { ['spreed', 'hosted-signaling-server-account-id', '', 'my-account-id'], ['spreed', 'hosted-signaling-server-account', '{}', '{"status": "pending"}'] ])); - $this->config->expects($this->once()) - ->method('setAppValue') - ->with('spreed', 'hosted-signaling-server-account-last-checked', null); $this->hostedSignalingServerService->expects($this->once()) ->method('fetchAccountInfo') @@ -119,12 +116,11 @@ class CheckHostedSignalingServerTest extends TestCase { ->withConsecutive( ['spreed', 'signaling_mode'], ); - $this->config->expects($this->exactly(3)) + $this->config->expects($this->exactly(2)) ->method('setAppValue') ->withConsecutive( ['spreed', 'signaling_servers', '{"servers":[{"server":"signaling-url","verify":true}],"secret":"signaling-secret"}'], - ['spreed', 'hosted-signaling-server-account', json_encode($newStatus)], - ['spreed', 'hosted-signaling-server-account-last-checked', null] + ['spreed', 'hosted-signaling-server-account', json_encode($newStatus)] ); $group = $this->createMock(IGroup::class); |