@@ -16,52 +16,52 @@ |
||
| 16 | 16 | |
| 17 | 17 | class DeclarativeAdminSettings implements IDeclarativeSettingsFormWithHandlers { |
| 18 | 18 | |
| 19 | - public function __construct( |
|
| 20 | - private IL10N $l, |
|
| 21 | - private SettingsService $service, |
|
| 22 | - private IURLGenerator $urlGenerator, |
|
| 23 | - ) { |
|
| 24 | - } |
|
| 19 | + public function __construct( |
|
| 20 | + private IL10N $l, |
|
| 21 | + private SettingsService $service, |
|
| 22 | + private IURLGenerator $urlGenerator, |
|
| 23 | + ) { |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - public function getValue(string $fieldId, IUser $user): mixed { |
|
| 27 | - return match($fieldId) { |
|
| 28 | - 'windows_support' => $this->service->hasFilesWindowsSupport(), |
|
| 29 | - default => throw new \InvalidArgumentException('Unexpected field id ' . $fieldId), |
|
| 30 | - }; |
|
| 31 | - } |
|
| 26 | + public function getValue(string $fieldId, IUser $user): mixed { |
|
| 27 | + return match($fieldId) { |
|
| 28 | + 'windows_support' => $this->service->hasFilesWindowsSupport(), |
|
| 29 | + default => throw new \InvalidArgumentException('Unexpected field id ' . $fieldId), |
|
| 30 | + }; |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - public function setValue(string $fieldId, mixed $value, IUser $user): void { |
|
| 34 | - switch ($fieldId) { |
|
| 35 | - case 'windows_support': |
|
| 36 | - $this->service->setFilesWindowsSupport((bool)$value); |
|
| 37 | - break; |
|
| 38 | - } |
|
| 39 | - } |
|
| 33 | + public function setValue(string $fieldId, mixed $value, IUser $user): void { |
|
| 34 | + switch ($fieldId) { |
|
| 35 | + case 'windows_support': |
|
| 36 | + $this->service->setFilesWindowsSupport((bool)$value); |
|
| 37 | + break; |
|
| 38 | + } |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - public function getSchema(): array { |
|
| 42 | - return [ |
|
| 43 | - 'id' => 'files-filename-support', |
|
| 44 | - 'priority' => 10, |
|
| 45 | - 'section_type' => DeclarativeSettingsTypes::SECTION_TYPE_ADMIN, |
|
| 46 | - 'section_id' => 'server', |
|
| 47 | - 'storage_type' => DeclarativeSettingsTypes::STORAGE_TYPE_EXTERNAL, |
|
| 48 | - 'title' => $this->l->t('Files compatibility'), |
|
| 49 | - 'doc_url' => $this->urlGenerator->linkToDocs('admin-windows-compatible-filenames'), |
|
| 50 | - 'description' => ( |
|
| 51 | - $this->l->t('Allow to restrict filenames to ensure files can be synced with all clients. By default all filenames valid on POSIX (e.g. Linux or macOS) are allowed.') |
|
| 52 | - . "\n" . $this->l->t('After enabling the Windows compatible filenames, existing files cannot be modified anymore but can be renamed to valid new names by their owner.') |
|
| 53 | - . "\n" . $this->l->t('It is also possible to migrate files automatically after enabling this setting, please refer to the documentation about the occ command.') |
|
| 54 | - ), |
|
| 41 | + public function getSchema(): array { |
|
| 42 | + return [ |
|
| 43 | + 'id' => 'files-filename-support', |
|
| 44 | + 'priority' => 10, |
|
| 45 | + 'section_type' => DeclarativeSettingsTypes::SECTION_TYPE_ADMIN, |
|
| 46 | + 'section_id' => 'server', |
|
| 47 | + 'storage_type' => DeclarativeSettingsTypes::STORAGE_TYPE_EXTERNAL, |
|
| 48 | + 'title' => $this->l->t('Files compatibility'), |
|
| 49 | + 'doc_url' => $this->urlGenerator->linkToDocs('admin-windows-compatible-filenames'), |
|
| 50 | + 'description' => ( |
|
| 51 | + $this->l->t('Allow to restrict filenames to ensure files can be synced with all clients. By default all filenames valid on POSIX (e.g. Linux or macOS) are allowed.') |
|
| 52 | + . "\n" . $this->l->t('After enabling the Windows compatible filenames, existing files cannot be modified anymore but can be renamed to valid new names by their owner.') |
|
| 53 | + . "\n" . $this->l->t('It is also possible to migrate files automatically after enabling this setting, please refer to the documentation about the occ command.') |
|
| 54 | + ), |
|
| 55 | 55 | |
| 56 | - 'fields' => [ |
|
| 57 | - [ |
|
| 58 | - 'id' => 'windows_support', |
|
| 59 | - 'title' => $this->l->t('Enforce Windows compatibility'), |
|
| 60 | - 'description' => $this->l->t('This will block filenames not valid on Windows systems, like using reserved names or special characters. But this will not enforce compatibility of case sensitivity.'), |
|
| 61 | - 'type' => DeclarativeSettingsTypes::CHECKBOX, |
|
| 62 | - 'default' => false, |
|
| 63 | - ], |
|
| 64 | - ], |
|
| 65 | - ]; |
|
| 66 | - } |
|
| 56 | + 'fields' => [ |
|
| 57 | + [ |
|
| 58 | + 'id' => 'windows_support', |
|
| 59 | + 'title' => $this->l->t('Enforce Windows compatibility'), |
|
| 60 | + 'description' => $this->l->t('This will block filenames not valid on Windows systems, like using reserved names or special characters. But this will not enforce compatibility of case sensitivity.'), |
|
| 61 | + 'type' => DeclarativeSettingsTypes::CHECKBOX, |
|
| 62 | + 'default' => false, |
|
| 63 | + ], |
|
| 64 | + ], |
|
| 65 | + ]; |
|
| 66 | + } |
|
| 67 | 67 | } |
@@ -26,14 +26,14 @@ discard block |
||
| 26 | 26 | public function getValue(string $fieldId, IUser $user): mixed { |
| 27 | 27 | return match($fieldId) { |
| 28 | 28 | 'windows_support' => $this->service->hasFilesWindowsSupport(), |
| 29 | - default => throw new \InvalidArgumentException('Unexpected field id ' . $fieldId), |
|
| 29 | + default => throw new \InvalidArgumentException('Unexpected field id '.$fieldId), |
|
| 30 | 30 | }; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | public function setValue(string $fieldId, mixed $value, IUser $user): void { |
| 34 | 34 | switch ($fieldId) { |
| 35 | 35 | case 'windows_support': |
| 36 | - $this->service->setFilesWindowsSupport((bool)$value); |
|
| 36 | + $this->service->setFilesWindowsSupport((bool) $value); |
|
| 37 | 37 | break; |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -49,8 +49,8 @@ discard block |
||
| 49 | 49 | 'doc_url' => $this->urlGenerator->linkToDocs('admin-windows-compatible-filenames'), |
| 50 | 50 | 'description' => ( |
| 51 | 51 | $this->l->t('Allow to restrict filenames to ensure files can be synced with all clients. By default all filenames valid on POSIX (e.g. Linux or macOS) are allowed.') |
| 52 | - . "\n" . $this->l->t('After enabling the Windows compatible filenames, existing files cannot be modified anymore but can be renamed to valid new names by their owner.') |
|
| 53 | - . "\n" . $this->l->t('It is also possible to migrate files automatically after enabling this setting, please refer to the documentation about the occ command.') |
|
| 52 | + . "\n".$this->l->t('After enabling the Windows compatible filenames, existing files cannot be modified anymore but can be renamed to valid new names by their owner.') |
|
| 53 | + . "\n".$this->l->t('It is also possible to migrate files automatically after enabling this setting, please refer to the documentation about the occ command.') |
|
| 54 | 54 | ), |
| 55 | 55 | |
| 56 | 56 | 'fields' => [ |