File tree 6 files changed +93
-0
lines changed
6 files changed +93
-0
lines changed Original file line number Diff line number Diff line change 16
16
'OCA \\Files \\Activity \\Settings \\FileActivitySettings ' => $ baseDir . '/../lib/Activity/Settings/FileActivitySettings.php ' ,
17
17
'OCA \\Files \\Activity \\Settings \\FileChanged ' => $ baseDir . '/../lib/Activity/Settings/FileChanged.php ' ,
18
18
'OCA \\Files \\Activity \\Settings \\FileFavoriteChanged ' => $ baseDir . '/../lib/Activity/Settings/FileFavoriteChanged.php ' ,
19
+ 'OCA \\Files \\AdvancedCapabilities ' => $ baseDir . '/../lib/AdvancedCapabilities.php ' ,
19
20
'OCA \\Files \\App ' => $ baseDir . '/../lib/App.php ' ,
20
21
'OCA \\Files \\AppInfo \\Application ' => $ baseDir . '/../lib/AppInfo/Application.php ' ,
21
22
'OCA \\Files \\BackgroundJob \\CleanupDirectEditingTokens ' => $ baseDir . '/../lib/BackgroundJob/CleanupDirectEditingTokens.php ' ,
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ class ComposerStaticInitFiles
31
31
'OCA \\Files \\Activity \\Settings \\FileActivitySettings ' => __DIR__ . '/.. ' . '/../lib/Activity/Settings/FileActivitySettings.php ' ,
32
32
'OCA \\Files \\Activity \\Settings \\FileChanged ' => __DIR__ . '/.. ' . '/../lib/Activity/Settings/FileChanged.php ' ,
33
33
'OCA \\Files \\Activity \\Settings \\FileFavoriteChanged ' => __DIR__ . '/.. ' . '/../lib/Activity/Settings/FileFavoriteChanged.php ' ,
34
+ 'OCA \\Files \\AdvancedCapabilities ' => __DIR__ . '/.. ' . '/../lib/AdvancedCapabilities.php ' ,
34
35
'OCA \\Files \\App ' => __DIR__ . '/.. ' . '/../lib/App.php ' ,
35
36
'OCA \\Files \\AppInfo \\Application ' => __DIR__ . '/.. ' . '/../lib/AppInfo/Application.php ' ,
36
37
'OCA \\Files \\BackgroundJob \\CleanupDirectEditingTokens ' => __DIR__ . '/.. ' . '/../lib/BackgroundJob/CleanupDirectEditingTokens.php ' ,
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ /**
6
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
7
+ * SPDX-License-Identifier: AGPL-3.0-or-later
8
+ */
9
+ namespace OCA \Files ;
10
+
11
+ use OCA \Files \Service \SettingsService ;
12
+ use OCP \Capabilities \ICapability ;
13
+ use OCP \Capabilities \IInitialStateExcludedCapability ;
14
+
15
+ /**
16
+ * Capabilities not needed for every request.
17
+ * This capabilities might be hard to compute or no used by the webui.
18
+ */
19
+ class AdvancedCapabilities implements ICapability, IInitialStateExcludedCapability {
20
+
21
+ public function __construct (
22
+ protected SettingsService $ service ,
23
+ ) {
24
+ }
25
+
26
+ /**
27
+ * Return this classes capabilities
28
+ *
29
+ * @return array{files: array{'windows_compatible_filenames': bool}}
30
+ */
31
+ public function getCapabilities (): array {
32
+ return [
33
+ 'files ' => [
34
+ 'windows_compatible_filenames ' => $ this ->service ->hasFilesWindowsSupport (),
35
+ ],
36
+ ];
37
+ }
38
+ }
Original file line number Diff line number Diff line change 9
9
namespace OCA \Files \AppInfo ;
10
10
11
11
use Closure ;
12
+ use OCA \Files \AdvancedCapabilities ;
12
13
use OCA \Files \Capabilities ;
13
14
use OCA \Files \Collaboration \Resources \Listener ;
14
15
use OCA \Files \Collaboration \Resources \ResourceProvider ;
@@ -107,6 +108,7 @@ public function register(IRegistrationContext $context): void {
107
108
* Register capabilities
108
109
*/
109
110
$ context ->registerCapability (Capabilities::class);
111
+ $ context ->registerCapability (AdvancedCapabilities::class);
110
112
$ context ->registerCapability (DirectEditingCapabilities::class);
111
113
112
114
$ context ->registerDeclarativeSettings (DeclarativeAdminSettings::class);
Original file line number Diff line number Diff line change 29
29
"files" : {
30
30
"type" : " object" ,
31
31
"required" : [
32
+ " windows_compatible_filenames" ,
32
33
" $comment" ,
33
34
" bigfilechunking" ,
34
35
" blacklisted_files" ,
41
42
" directEditing"
42
43
],
43
44
"properties" : {
45
+ "windows_compatible_filenames" : {
46
+ "type" : " boolean"
47
+ },
44
48
"$comment" : {
45
49
"type" : " string" ,
46
50
"nullable" : true
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ /**
6
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
7
+ * SPDX-License-Identifier: AGPL-3.0-or-later
8
+ */
9
+ namespace OCA \Files ;
10
+
11
+ use OCA \Files \Service \SettingsService ;
12
+ use PHPUnit \Framework \MockObject \MockObject ;
13
+ use Test \TestCase ;
14
+
15
+ class AdvancedCapabilitiesTest extends TestCase {
16
+
17
+ protected SettingsService &MockObject $ service ;
18
+ protected AdvancedCapabilities $ capabilities ;
19
+
20
+ protected function setUp (): void {
21
+ $ this ->service = $ this ->createMock (SettingsService::class);
22
+ $ this ->capabilities = new AdvancedCapabilities ($ this ->service );
23
+ }
24
+
25
+ /**
26
+ * @dataProvider dataGetCapabilities
27
+ */
28
+ public function testGetCapabilities (bool $ wcf ): void {
29
+ $ this ->service
30
+ ->expects (self ::once ())
31
+ ->method ('hasFilesWindowsSupport ' )
32
+ ->willReturn ($ wcf );
33
+
34
+ self ::assertEqualsCanonicalizing (['files ' => [ 'windows_compatible_filenames ' => $ wcf ]], $ this ->capabilities ->getCapabilities ());
35
+ }
36
+
37
+ public static function dataGetCapabilities (): array {
38
+ return [
39
+ 'WCF enabled ' => [
40
+ true ,
41
+ ],
42
+ 'WCF disabled ' => [
43
+ false ,
44
+ ],
45
+ ];
46
+ }
47
+ }
You can’t perform that action at this time.
0 commit comments