Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/ConfigLexicon.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ public function getAppConfigs(): array {
new Entry(Config::HOSTED_SIGNALING_SERVER_NONCE, ValueType::STRING, '', definition: 'Temporary nonce while configuring the hosted signaling server', flags: IAppConfig::FLAG_SENSITIVE, rename: 'hosted-signaling-server-nonce'),
new Entry(Config::HOSTED_SIGNALING_SERVER_ACCOUNT_ID, ValueType::STRING, '', definition: 'Account identifier of the hosted signaling server', flags: IAppConfig::FLAG_SENSITIVE, rename: 'hosted-signaling-server-account-id'),
new Entry(Config::SIP_BRIDGE_DIALIN_INFO, ValueType::STRING, '', definition: 'Additional information added in the SIP dial-in invitation mail and sidebar', flags: IAppConfig::FLAG_SENSITIVE),
new Entry(Config::SIP_DIALIN_DEFAULT, ValueType::INT, 0, definition: 'Default value of SIP dial-in when creating new conversations'),
new Entry(Config::SIP_BRIDGE_DIALOUT_ANONYMOUS, ValueType::BOOL, false, definition: 'When set to true, all out-going SIP calls will be anonymous calls (CLIR)'),
new Entry(Config::SIP_BRIDGE_DIALOUT_NUMBER, ValueType::STRING, '', definition: 'Fallback phone number that is used as caller for out-going calls when the user has no phone-number configured (has to be E164 `+49123456789` formatted'),
new Entry(Config::SIP_BRIDGE_DIALOUT_PREFIX, ValueType::STRING, '+', definition: 'Deprecated: Only used for direct dial-in from older SIP bridges, which send phone numbers without this prefix', deprecated: true),
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/RoomController.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public function __construct(
protected function getTalkHashHeader(): array {
$values = [
$this->config->getSystemValueString('version'),
$this->config->getAppValue('spreed', 'installed_version'),
$this->appConfig->getAppValueString('installed_version'),
json_encode($this->appConfig->getAppValueArray(Config::STUN_SERVERS)),
json_encode($this->appConfig->getAppValueArray(Config::TURN_SERVERS)),
json_encode($this->appConfig->getAppValueArray(Config::SIGNALING_SERVERS)),
Expand Down
10 changes: 3 additions & 7 deletions lib/Listener/GroupDeletedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,16 @@
use OCA\Talk\Manager;
use OCA\Talk\Model\Attendee;
use OCA\Talk\Service\ParticipantService;
use OCP\AppFramework\Services\IAppConfig;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
use OCP\Group\Events\GroupDeletedEvent;
use OCP\IAppConfig;
use OCP\IConfig;

/**
* @template-implements IEventListener<Event>
*/
class GroupDeletedListener implements IEventListener {
public function __construct(
private readonly IConfig $config,
private readonly Manager $manager,
private readonly ParticipantService $participantService,
private readonly IAppConfig $appConfig,
Expand Down Expand Up @@ -54,12 +52,10 @@ public function handle(Event $event): void {
}

protected function removeGroupFromConfig(string $configKey, string $removeGroupId): void {
$json = $this->config->getAppValue('spreed', $configKey, '[]');
$array = json_decode($json, true);
$gids = \is_array($array) ? $array : [];
$gids = $this->appConfig->getAppValueArray($configKey);

$gids = array_filter($gids, static fn ($gid) => $gid !== $removeGroupId);

$this->config->setAppValue('spreed', $configKey, json_encode($gids));
$this->appConfig->setAppValueArray($configKey, $gids);
}
}
10 changes: 4 additions & 6 deletions lib/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -1267,13 +1267,11 @@ public function createRoom(
}
}
if ($sipEnabled === null) {
$default = $this->config->getAppValue('spreed', 'sip_dialin_default', 'none');
if ($default !== 'none') {
$default = (int)$default;
if (in_array($default, [Webinary::SIP_DISABLED, Webinary::SIP_ENABLED, Webinary::SIP_ENABLED_NO_PIN], true)) {
$sipEnabled = $default;
}
$default = $this->appConfig->getAppValueInt(Config::SIP_DIALIN_DEFAULT);
if (in_array($default, [Webinary::SIP_DISABLED, Webinary::SIP_ENABLED, Webinary::SIP_ENABLED_NO_PIN], true)) {
$sipEnabled = $default;
}

}
if ($sipEnabled !== null) {
$insert->setValue('sip_enabled', $insert->createNamedParameter($sipEnabled, IQueryBuilder::PARAM_INT));
Expand Down
8 changes: 4 additions & 4 deletions lib/Migration/ClearResourceAccessCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
namespace OCA\Talk\Migration;

use OCA\Talk\Collaboration\Resources\ConversationProvider;
use OCP\AppFramework\Services\IAppConfig;
use OCP\Collaboration\Resources\IManager;
use OCP\IConfig;
use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;

class ClearResourceAccessCache implements IRepairStep {
protected const INVALIDATIONS = 1;

public function __construct(
private readonly IConfig $config,
private readonly IAppConfig $appConfig,
private readonly IManager $manager,
private readonly ConversationProvider $provider,
) {
Expand All @@ -31,14 +31,14 @@ public function getName(): string {

#[\Override]
public function run(IOutput $output): void {
$invalidatedCache = (int)$this->config->getAppValue('spreed', 'project_access_invalidated', '0');
$invalidatedCache = $this->appConfig->getAppValueInt('project_access_invalidated', 0);

if ($invalidatedCache === self::INVALIDATIONS) {
$output->info('Invalidation not required');
return;
}

$this->manager->invalidateAccessCacheForProvider($this->provider);
$this->config->setAppValue('spreed', 'project_access_invalidated', (string)self::INVALIDATIONS);
$this->appConfig->setAppValueInt('project_access_invalidated', self::INVALIDATIONS);
}
}
6 changes: 3 additions & 3 deletions lib/Migration/Version14000Date20220217115327.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace OCA\Talk\Migration;

use Closure;
use OCP\IConfig;
use OCP\AppFramework\Services\IAppConfig;
use OCP\Migration\Attributes\DataCleansing;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
Expand All @@ -18,7 +18,7 @@
class Version14000Date20220217115327 extends SimpleMigrationStep {

public function __construct(
private readonly IConfig $config,
private readonly IAppConfig $appConfig,
) {
}

Expand All @@ -29,6 +29,6 @@ public function __construct(
*/
#[\Override]
public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
$this->config->deleteAppValue('spreed', 'hosted-signaling-server-account-last-checked');
$this->appConfig->deleteAppValue('hosted-signaling-server-account-last-checked');
}
}
6 changes: 3 additions & 3 deletions lib/Migration/Version2000Date20171026140256.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

namespace OCA\Talk\Migration;

use OCP\AppFramework\Services\IAppConfig;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IGroupManager;
use OCP\Migration\Attributes\DataCleansing;
Expand All @@ -21,7 +21,7 @@ class Version2000Date20171026140256 extends SimpleMigrationStep {

public function __construct(
private readonly IDBConnection $connection,
private readonly IConfig $config,
private readonly IAppConfig $appConfig,
private readonly IGroupManager $groupManager,
) {
}
Expand All @@ -34,7 +34,7 @@ public function __construct(
*/
#[\Override]
public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void {
if (version_compare($this->config->getAppValue('spreed', 'installed_version', '0.0.0'), '2.0.0', '<')) {
if (version_compare($this->appConfig->getAppValueString('installed_version', '0.0.0'), '2.0.0', '<')) {
// Migrations only work after 2.0.0
return;
}
Expand Down
4 changes: 1 addition & 3 deletions lib/Migration/Version2000Date20171026140257.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use OCA\Talk\Config;
use OCP\AppFramework\Services\IAppConfig;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\Migration\Attributes\DataCleansing;
use OCP\Migration\IOutput;
Expand All @@ -26,7 +25,6 @@ class Version2000Date20171026140257 extends SimpleMigrationStep {

public function __construct(
private readonly IDBConnection $connection,
private readonly IConfig $config,
private readonly IAppConfig $appConfig,
private readonly ISecureRandom $secureRandom,
) {
Expand All @@ -41,7 +39,7 @@ public function __construct(
*/
#[\Override]
public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void {
if (version_compare($this->config->getAppValue('spreed', 'installed_version', '0.0.0'), '2.0.0', '<')) {
if (version_compare($this->appConfig->getAppValueString('installed_version', '0.0.0'), '2.0.0', '<')) {
// Migrations only work after 2.0.0
return;
}
Expand Down
6 changes: 3 additions & 3 deletions lib/Migration/Version2001Date20170707115443.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

use OCA\Talk\Participant;
use OCA\Talk\Room;
use OCP\AppFramework\Services\IAppConfig;
use OCP\DB\ISchemaWrapper;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\DB\Types;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\Migration\Attributes\AddColumn;
use OCP\Migration\Attributes\ColumnType;
Expand All @@ -27,7 +27,7 @@ class Version2001Date20170707115443 extends SimpleMigrationStep {

public function __construct(
private readonly IDBConnection $db,
private readonly IConfig $config,
private readonly IAppConfig $appConfig,
) {
}

Expand Down Expand Up @@ -63,7 +63,7 @@ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $op
*/
#[\Override]
public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void {
if (version_compare($this->config->getAppValue('spreed', 'installed_version', '0.0.0'), '2.0.0', '<')) {
if (version_compare($this->appConfig->getAppValueString('installed_version', '0.0.0'), '2.0.0', '<')) {
// Migrations only work after 2.0.0
return;
}
Expand Down
6 changes: 3 additions & 3 deletions lib/Migration/Version2001Date20171026134605.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

use Doctrine\DBAL\Exception\InvalidFieldNameException;
use Doctrine\DBAL\Exception\TableNotFoundException;
use OCP\AppFramework\Services\IAppConfig;
use OCP\DB\ISchemaWrapper;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\DB\Types;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\Migration\Attributes\CreateTable;
use OCP\Migration\Attributes\DataCleansing;
Expand All @@ -31,7 +31,7 @@ class Version2001Date20171026134605 extends SimpleMigrationStep {

public function __construct(
private readonly IDBConnection $connection,
private readonly IConfig $config,
private readonly IAppConfig $appConfig,
) {
}

Expand Down Expand Up @@ -152,7 +152,7 @@ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $op
*/
#[\Override]
public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void {
if (version_compare($this->config->getAppValue('spreed', 'installed_version', '0.0.0'), '2.0.0', '<')) {
if (version_compare($this->appConfig->getAppValueString('installed_version', '0.0.0'), '2.0.0', '<')) {
// Migrations only work after 2.0.0
return;
}
Expand Down
6 changes: 3 additions & 3 deletions lib/Migration/Version2001Date20180103144447.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

namespace OCA\Talk\Migration;

use OCP\AppFramework\Services\IAppConfig;
use OCP\DB\ISchemaWrapper;
use OCP\DB\Types;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\Migration\Attributes\AddColumn;
use OCP\Migration\Attributes\ColumnType;
Expand All @@ -32,7 +32,7 @@ class Version2001Date20180103144447 extends SimpleMigrationStep {

public function __construct(
private readonly IDBConnection $connection,
private readonly IConfig $config,
private readonly IAppConfig $appConfig,
) {
}

Expand Down Expand Up @@ -108,7 +108,7 @@ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $op
*/
#[\Override]
public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void {
if (version_compare($this->config->getAppValue('spreed', 'installed_version', '0.0.0'), '2.0.0', '<')) {
if (version_compare($this->appConfig->getAppValueString('installed_version', '0.0.0'), '2.0.0', '<')) {
// Migrations only work after 2.0.0
return;
}
Expand Down
8 changes: 4 additions & 4 deletions lib/Settings/Admin/AdminSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ public function getForm(): TemplateResponse {
}

protected function initGeneralSettings(): void {
$this->initialState->provideInitialState(Config::DEFAULT_GROUP_NOTIFICATION, $this->appConfig->getAppValueInt(Config::DEFAULT_GROUP_NOTIFICATION));
$this->initialState->provideInitialState(Config::CONVERSATIONS_FILES, (int)$this->appConfig->getAppValueBool(Config::CONVERSATIONS_FILES));
$this->initialState->provideInitialState(Config::CONVERSATIONS_FILES_PUBLIC_SHARES, (int)$this->appConfig->getAppValueBool(Config::CONVERSATIONS_FILES_PUBLIC_SHARES));
$this->initialState->provideInitialState('default_group_notification', $this->appConfig->getAppValueInt(Config::DEFAULT_GROUP_NOTIFICATION));
$this->initialState->provideInitialState('conversations_files', (int)$this->appConfig->getAppValueBool(Config::CONVERSATIONS_FILES));
$this->initialState->provideInitialState('conversations_files_public_shares', (int)$this->appConfig->getAppValueBool(Config::CONVERSATIONS_FILES_PUBLIC_SHARES));
$this->initialState->provideInitialState('valid_apache_php_configuration', $this->validApachePHPConfiguration());
}

Expand Down Expand Up @@ -486,7 +486,7 @@ protected function getGroupDetailsArray(array $gids, string $configKey): array {

if (count($gids) !== count($groups)) {
$gids = array_map(static fn (array $group) => $group['id'], $groups);
$this->serverConfig->setAppValue('spreed', $configKey, json_encode($gids));
$this->appConfig->setAppValueArray($configKey, $gids);
}

return $groups;
Expand Down
Loading