@@ -34,122 +34,122 @@ |
||
34 | 34 | use OCP\Migration\SimpleMigrationStep; |
35 | 35 | |
36 | 36 | class Version1011Date20200630192246 extends SimpleMigrationStep { |
37 | - /** |
|
38 | - * @param IOutput $output |
|
39 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
40 | - * @param array $options |
|
41 | - * @return null|ISchemaWrapper |
|
42 | - */ |
|
43 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
44 | - /** @var ISchemaWrapper $schema */ |
|
45 | - $schema = $schemaClosure(); |
|
37 | + /** |
|
38 | + * @param IOutput $output |
|
39 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
40 | + * @param array $options |
|
41 | + * @return null|ISchemaWrapper |
|
42 | + */ |
|
43 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
44 | + /** @var ISchemaWrapper $schema */ |
|
45 | + $schema = $schemaClosure(); |
|
46 | 46 | |
47 | - if (!$schema->hasTable('external_mounts')) { |
|
48 | - $table = $schema->createTable('external_mounts'); |
|
49 | - $table->addColumn('mount_id', Types::BIGINT, [ |
|
50 | - 'autoincrement' => true, |
|
51 | - 'notnull' => true, |
|
52 | - 'length' => 6, |
|
53 | - ]); |
|
54 | - $table->addColumn('mount_point', Types::STRING, [ |
|
55 | - 'notnull' => true, |
|
56 | - 'length' => 128, |
|
57 | - ]); |
|
58 | - $table->addColumn('storage_backend', Types::STRING, [ |
|
59 | - 'notnull' => true, |
|
60 | - 'length' => 64, |
|
61 | - ]); |
|
62 | - $table->addColumn('auth_backend', Types::STRING, [ |
|
63 | - 'notnull' => true, |
|
64 | - 'length' => 64, |
|
65 | - ]); |
|
66 | - $table->addColumn('priority', Types::INTEGER, [ |
|
67 | - 'notnull' => true, |
|
68 | - 'length' => 4, |
|
69 | - 'default' => 100, |
|
70 | - ]); |
|
71 | - $table->addColumn('type', Types::INTEGER, [ |
|
72 | - 'notnull' => true, |
|
73 | - 'length' => 4, |
|
74 | - ]); |
|
75 | - $table->setPrimaryKey(['mount_id']); |
|
76 | - } |
|
47 | + if (!$schema->hasTable('external_mounts')) { |
|
48 | + $table = $schema->createTable('external_mounts'); |
|
49 | + $table->addColumn('mount_id', Types::BIGINT, [ |
|
50 | + 'autoincrement' => true, |
|
51 | + 'notnull' => true, |
|
52 | + 'length' => 6, |
|
53 | + ]); |
|
54 | + $table->addColumn('mount_point', Types::STRING, [ |
|
55 | + 'notnull' => true, |
|
56 | + 'length' => 128, |
|
57 | + ]); |
|
58 | + $table->addColumn('storage_backend', Types::STRING, [ |
|
59 | + 'notnull' => true, |
|
60 | + 'length' => 64, |
|
61 | + ]); |
|
62 | + $table->addColumn('auth_backend', Types::STRING, [ |
|
63 | + 'notnull' => true, |
|
64 | + 'length' => 64, |
|
65 | + ]); |
|
66 | + $table->addColumn('priority', Types::INTEGER, [ |
|
67 | + 'notnull' => true, |
|
68 | + 'length' => 4, |
|
69 | + 'default' => 100, |
|
70 | + ]); |
|
71 | + $table->addColumn('type', Types::INTEGER, [ |
|
72 | + 'notnull' => true, |
|
73 | + 'length' => 4, |
|
74 | + ]); |
|
75 | + $table->setPrimaryKey(['mount_id']); |
|
76 | + } |
|
77 | 77 | |
78 | - if (!$schema->hasTable('external_applicable')) { |
|
79 | - $table = $schema->createTable('external_applicable'); |
|
80 | - $table->addColumn('applicable_id', Types::BIGINT, [ |
|
81 | - 'autoincrement' => true, |
|
82 | - 'notnull' => true, |
|
83 | - 'length' => 6, |
|
84 | - ]); |
|
85 | - $table->addColumn('mount_id', Types::BIGINT, [ |
|
86 | - 'notnull' => true, |
|
87 | - 'length' => 6, |
|
88 | - ]); |
|
89 | - $table->addColumn('type', Types::INTEGER, [ |
|
90 | - 'notnull' => true, |
|
91 | - 'length' => 4, |
|
92 | - ]); |
|
93 | - $table->addColumn('value', Types::STRING, [ |
|
94 | - 'notnull' => false, |
|
95 | - 'length' => 64, |
|
96 | - ]); |
|
97 | - $table->setPrimaryKey(['applicable_id']); |
|
98 | - $table->addIndex(['mount_id'], 'applicable_mount'); |
|
99 | - $table->addUniqueIndex(['type', 'value', 'mount_id'], 'applicable_type_value_mount'); |
|
100 | - } |
|
78 | + if (!$schema->hasTable('external_applicable')) { |
|
79 | + $table = $schema->createTable('external_applicable'); |
|
80 | + $table->addColumn('applicable_id', Types::BIGINT, [ |
|
81 | + 'autoincrement' => true, |
|
82 | + 'notnull' => true, |
|
83 | + 'length' => 6, |
|
84 | + ]); |
|
85 | + $table->addColumn('mount_id', Types::BIGINT, [ |
|
86 | + 'notnull' => true, |
|
87 | + 'length' => 6, |
|
88 | + ]); |
|
89 | + $table->addColumn('type', Types::INTEGER, [ |
|
90 | + 'notnull' => true, |
|
91 | + 'length' => 4, |
|
92 | + ]); |
|
93 | + $table->addColumn('value', Types::STRING, [ |
|
94 | + 'notnull' => false, |
|
95 | + 'length' => 64, |
|
96 | + ]); |
|
97 | + $table->setPrimaryKey(['applicable_id']); |
|
98 | + $table->addIndex(['mount_id'], 'applicable_mount'); |
|
99 | + $table->addUniqueIndex(['type', 'value', 'mount_id'], 'applicable_type_value_mount'); |
|
100 | + } |
|
101 | 101 | |
102 | - if (!$schema->hasTable('external_config')) { |
|
103 | - $table = $schema->createTable('external_config'); |
|
104 | - $table->addColumn('config_id', Types::BIGINT, [ |
|
105 | - 'autoincrement' => true, |
|
106 | - 'notnull' => true, |
|
107 | - 'length' => 6, |
|
108 | - ]); |
|
109 | - $table->addColumn('mount_id', Types::BIGINT, [ |
|
110 | - 'notnull' => true, |
|
111 | - 'length' => 6, |
|
112 | - ]); |
|
113 | - $table->addColumn('key', Types::STRING, [ |
|
114 | - 'notnull' => true, |
|
115 | - 'length' => 64, |
|
116 | - ]); |
|
117 | - $table->addColumn('value', Types::STRING, [ |
|
118 | - 'notnull' => false, |
|
119 | - 'length' => 4000, |
|
120 | - ]); |
|
121 | - $table->setPrimaryKey(['config_id']); |
|
122 | - $table->addUniqueIndex(['mount_id', 'key'], 'config_mount_key'); |
|
123 | - } else { |
|
124 | - $table = $schema->getTable('external_config'); |
|
125 | - $table->changeColumn('value', [ |
|
126 | - 'notnull' => false, |
|
127 | - 'length' => 4000, |
|
128 | - ]); |
|
129 | - } |
|
102 | + if (!$schema->hasTable('external_config')) { |
|
103 | + $table = $schema->createTable('external_config'); |
|
104 | + $table->addColumn('config_id', Types::BIGINT, [ |
|
105 | + 'autoincrement' => true, |
|
106 | + 'notnull' => true, |
|
107 | + 'length' => 6, |
|
108 | + ]); |
|
109 | + $table->addColumn('mount_id', Types::BIGINT, [ |
|
110 | + 'notnull' => true, |
|
111 | + 'length' => 6, |
|
112 | + ]); |
|
113 | + $table->addColumn('key', Types::STRING, [ |
|
114 | + 'notnull' => true, |
|
115 | + 'length' => 64, |
|
116 | + ]); |
|
117 | + $table->addColumn('value', Types::STRING, [ |
|
118 | + 'notnull' => false, |
|
119 | + 'length' => 4000, |
|
120 | + ]); |
|
121 | + $table->setPrimaryKey(['config_id']); |
|
122 | + $table->addUniqueIndex(['mount_id', 'key'], 'config_mount_key'); |
|
123 | + } else { |
|
124 | + $table = $schema->getTable('external_config'); |
|
125 | + $table->changeColumn('value', [ |
|
126 | + 'notnull' => false, |
|
127 | + 'length' => 4000, |
|
128 | + ]); |
|
129 | + } |
|
130 | 130 | |
131 | - if (!$schema->hasTable('external_options')) { |
|
132 | - $table = $schema->createTable('external_options'); |
|
133 | - $table->addColumn('option_id', Types::BIGINT, [ |
|
134 | - 'autoincrement' => true, |
|
135 | - 'notnull' => true, |
|
136 | - 'length' => 6, |
|
137 | - ]); |
|
138 | - $table->addColumn('mount_id', Types::BIGINT, [ |
|
139 | - 'notnull' => true, |
|
140 | - 'length' => 6, |
|
141 | - ]); |
|
142 | - $table->addColumn('key', Types::STRING, [ |
|
143 | - 'notnull' => true, |
|
144 | - 'length' => 64, |
|
145 | - ]); |
|
146 | - $table->addColumn('value', Types::STRING, [ |
|
147 | - 'notnull' => true, |
|
148 | - 'length' => 256, |
|
149 | - ]); |
|
150 | - $table->setPrimaryKey(['option_id']); |
|
151 | - $table->addUniqueIndex(['mount_id', 'key'], 'option_mount_key'); |
|
152 | - } |
|
153 | - return $schema; |
|
154 | - } |
|
131 | + if (!$schema->hasTable('external_options')) { |
|
132 | + $table = $schema->createTable('external_options'); |
|
133 | + $table->addColumn('option_id', Types::BIGINT, [ |
|
134 | + 'autoincrement' => true, |
|
135 | + 'notnull' => true, |
|
136 | + 'length' => 6, |
|
137 | + ]); |
|
138 | + $table->addColumn('mount_id', Types::BIGINT, [ |
|
139 | + 'notnull' => true, |
|
140 | + 'length' => 6, |
|
141 | + ]); |
|
142 | + $table->addColumn('key', Types::STRING, [ |
|
143 | + 'notnull' => true, |
|
144 | + 'length' => 64, |
|
145 | + ]); |
|
146 | + $table->addColumn('value', Types::STRING, [ |
|
147 | + 'notnull' => true, |
|
148 | + 'length' => 256, |
|
149 | + ]); |
|
150 | + $table->setPrimaryKey(['option_id']); |
|
151 | + $table->addUniqueIndex(['mount_id', 'key'], 'option_mount_key'); |
|
152 | + } |
|
153 | + return $schema; |
|
154 | + } |
|
155 | 155 | } |
@@ -33,19 +33,19 @@ |
||
33 | 33 | |
34 | 34 | class Version24000Date20220208195521 extends SimpleMigrationStep { |
35 | 35 | |
36 | - /** |
|
37 | - * @param IOutput $output |
|
38 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
39 | - * @param array $options |
|
40 | - * @return null|ISchemaWrapper |
|
41 | - */ |
|
42 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
43 | - $schema = $schemaClosure(); |
|
44 | - $table = $schema->getTable('share'); |
|
45 | - $table->addColumn('password_expiration_time', Types::DATETIME, [ |
|
46 | - 'notnull' => false, |
|
47 | - ]); |
|
48 | - return $schema; |
|
49 | - } |
|
36 | + /** |
|
37 | + * @param IOutput $output |
|
38 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
39 | + * @param array $options |
|
40 | + * @return null|ISchemaWrapper |
|
41 | + */ |
|
42 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
43 | + $schema = $schemaClosure(); |
|
44 | + $table = $schema->getTable('share'); |
|
45 | + $table->addColumn('password_expiration_time', Types::DATETIME, [ |
|
46 | + 'notnull' => false, |
|
47 | + ]); |
|
48 | + return $schema; |
|
49 | + } |
|
50 | 50 | |
51 | 51 | } |
@@ -32,22 +32,22 @@ |
||
32 | 32 | use OCP\Migration\SimpleMigrationStep; |
33 | 33 | |
34 | 34 | class Version24000Date20220425072957 extends SimpleMigrationStep { |
35 | - /** |
|
36 | - * @param IOutput $output |
|
37 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
38 | - * @param array $options |
|
39 | - * @return null|ISchemaWrapper |
|
40 | - */ |
|
41 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
42 | - /** @var ISchemaWrapper $schema */ |
|
43 | - $schema = $schemaClosure(); |
|
35 | + /** |
|
36 | + * @param IOutput $output |
|
37 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
38 | + * @param array $options |
|
39 | + * @return null|ISchemaWrapper |
|
40 | + */ |
|
41 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
42 | + /** @var ISchemaWrapper $schema */ |
|
43 | + $schema = $schemaClosure(); |
|
44 | 44 | |
45 | - $table = $schema->getTable('mounts'); |
|
46 | - if (!$table->hasIndex('mount_user_storage')) { |
|
47 | - $table->addIndex(['storage_id', 'user_id'], 'mount_user_storage'); |
|
48 | - return $schema; |
|
49 | - } |
|
45 | + $table = $schema->getTable('mounts'); |
|
46 | + if (!$table->hasIndex('mount_user_storage')) { |
|
47 | + $table->addIndex(['storage_id', 'user_id'], 'mount_user_storage'); |
|
48 | + return $schema; |
|
49 | + } |
|
50 | 50 | |
51 | - return null; |
|
52 | - } |
|
51 | + return null; |
|
52 | + } |
|
53 | 53 | } |
@@ -27,13 +27,13 @@ |
||
27 | 27 | * @since 24.0.0 |
28 | 28 | */ |
29 | 29 | interface IEmojiHelper { |
30 | - /** |
|
31 | - * @since 24.0.0 |
|
32 | - */ |
|
33 | - public function doesPlatformSupportEmoji(): bool; |
|
30 | + /** |
|
31 | + * @since 24.0.0 |
|
32 | + */ |
|
33 | + public function doesPlatformSupportEmoji(): bool; |
|
34 | 34 | |
35 | - /** |
|
36 | - * @since 24.0.0 |
|
37 | - */ |
|
38 | - public function isValidSingleEmoji(string $emoji): bool; |
|
35 | + /** |
|
36 | + * @since 24.0.0 |
|
37 | + */ |
|
38 | + public function isValidSingleEmoji(string $emoji): bool; |
|
39 | 39 | } |
@@ -36,47 +36,47 @@ |
||
36 | 36 | * @since 8.1.0 |
37 | 37 | */ |
38 | 38 | interface ILockingProvider { |
39 | - /** |
|
40 | - * @since 8.1.0 |
|
41 | - */ |
|
42 | - public const LOCK_SHARED = 1; |
|
43 | - /** |
|
44 | - * @since 8.1.0 |
|
45 | - */ |
|
46 | - public const LOCK_EXCLUSIVE = 2; |
|
39 | + /** |
|
40 | + * @since 8.1.0 |
|
41 | + */ |
|
42 | + public const LOCK_SHARED = 1; |
|
43 | + /** |
|
44 | + * @since 8.1.0 |
|
45 | + */ |
|
46 | + public const LOCK_EXCLUSIVE = 2; |
|
47 | 47 | |
48 | - /** |
|
49 | - * @psalm-param self::LOCK_SHARED|self::LOCK_EXCLUSIVE $type |
|
50 | - * @since 8.1.0 |
|
51 | - */ |
|
52 | - public function isLocked(string $path, int $type): bool; |
|
48 | + /** |
|
49 | + * @psalm-param self::LOCK_SHARED|self::LOCK_EXCLUSIVE $type |
|
50 | + * @since 8.1.0 |
|
51 | + */ |
|
52 | + public function isLocked(string $path, int $type): bool; |
|
53 | 53 | |
54 | - /** |
|
55 | - * @psalm-param self::LOCK_SHARED|self::LOCK_EXCLUSIVE $type |
|
56 | - * @param ?string $readablePath A human-readable path to use in error messages, since 20.0.0 |
|
57 | - * @throws LockedException |
|
58 | - * @since 8.1.0 |
|
59 | - */ |
|
60 | - public function acquireLock(string $path, int $type, ?string $readablePath = null): void; |
|
54 | + /** |
|
55 | + * @psalm-param self::LOCK_SHARED|self::LOCK_EXCLUSIVE $type |
|
56 | + * @param ?string $readablePath A human-readable path to use in error messages, since 20.0.0 |
|
57 | + * @throws LockedException |
|
58 | + * @since 8.1.0 |
|
59 | + */ |
|
60 | + public function acquireLock(string $path, int $type, ?string $readablePath = null): void; |
|
61 | 61 | |
62 | - /** |
|
63 | - * @psalm-param self::LOCK_SHARED|self::LOCK_EXCLUSIVE $type |
|
64 | - * @since 8.1.0 |
|
65 | - */ |
|
66 | - public function releaseLock(string $path, int $type): void; |
|
62 | + /** |
|
63 | + * @psalm-param self::LOCK_SHARED|self::LOCK_EXCLUSIVE $type |
|
64 | + * @since 8.1.0 |
|
65 | + */ |
|
66 | + public function releaseLock(string $path, int $type): void; |
|
67 | 67 | |
68 | - /** |
|
69 | - * Change the target type of an existing lock |
|
70 | - * |
|
71 | - * @psalm-param self::LOCK_SHARED|self::LOCK_EXCLUSIVE $targetType |
|
72 | - * @throws LockedException |
|
73 | - * @since 8.1.0 |
|
74 | - */ |
|
75 | - public function changeLock(string $path, int $targetType): void; |
|
68 | + /** |
|
69 | + * Change the target type of an existing lock |
|
70 | + * |
|
71 | + * @psalm-param self::LOCK_SHARED|self::LOCK_EXCLUSIVE $targetType |
|
72 | + * @throws LockedException |
|
73 | + * @since 8.1.0 |
|
74 | + */ |
|
75 | + public function changeLock(string $path, int $targetType): void; |
|
76 | 76 | |
77 | - /** |
|
78 | - * Release all lock acquired by this instance |
|
79 | - * @since 8.1.0 |
|
80 | - */ |
|
81 | - public function releaseAll(): void; |
|
77 | + /** |
|
78 | + * Release all lock acquired by this instance |
|
79 | + * @since 8.1.0 |
|
80 | + */ |
|
81 | + public function releaseAll(): void; |
|
82 | 82 | } |
@@ -17,42 +17,42 @@ |
||
17 | 17 | */ |
18 | 18 | class Version1024Date20211221144219 extends SimpleMigrationStep { |
19 | 19 | |
20 | - /** |
|
21 | - * @param IOutput $output |
|
22 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
23 | - * @param array $options |
|
24 | - */ |
|
25 | - public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { |
|
26 | - } |
|
27 | - |
|
28 | - /** |
|
29 | - * @param IOutput $output |
|
30 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
31 | - * @param array $options |
|
32 | - * @return null|ISchemaWrapper |
|
33 | - * @throws SchemaException |
|
34 | - */ |
|
35 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
36 | - /** @var ISchemaWrapper $schema */ |
|
37 | - $schema = $schemaClosure(); |
|
38 | - $propertiesTable = $schema->getTable('properties'); |
|
39 | - |
|
40 | - if ($propertiesTable->hasColumn('valuetype')) { |
|
41 | - return null; |
|
42 | - } |
|
43 | - $propertiesTable->addColumn('valuetype', Types::SMALLINT, [ |
|
44 | - 'notnull' => false, |
|
45 | - 'default' => CustomPropertiesBackend::PROPERTY_TYPE_STRING |
|
46 | - ]); |
|
47 | - |
|
48 | - return $schema; |
|
49 | - } |
|
50 | - |
|
51 | - /** |
|
52 | - * @param IOutput $output |
|
53 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
54 | - * @param array $options |
|
55 | - */ |
|
56 | - public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { |
|
57 | - } |
|
20 | + /** |
|
21 | + * @param IOutput $output |
|
22 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
23 | + * @param array $options |
|
24 | + */ |
|
25 | + public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { |
|
26 | + } |
|
27 | + |
|
28 | + /** |
|
29 | + * @param IOutput $output |
|
30 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
31 | + * @param array $options |
|
32 | + * @return null|ISchemaWrapper |
|
33 | + * @throws SchemaException |
|
34 | + */ |
|
35 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
36 | + /** @var ISchemaWrapper $schema */ |
|
37 | + $schema = $schemaClosure(); |
|
38 | + $propertiesTable = $schema->getTable('properties'); |
|
39 | + |
|
40 | + if ($propertiesTable->hasColumn('valuetype')) { |
|
41 | + return null; |
|
42 | + } |
|
43 | + $propertiesTable->addColumn('valuetype', Types::SMALLINT, [ |
|
44 | + 'notnull' => false, |
|
45 | + 'default' => CustomPropertiesBackend::PROPERTY_TYPE_STRING |
|
46 | + ]); |
|
47 | + |
|
48 | + return $schema; |
|
49 | + } |
|
50 | + |
|
51 | + /** |
|
52 | + * @param IOutput $output |
|
53 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
54 | + * @param array $options |
|
55 | + */ |
|
56 | + public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { |
|
57 | + } |
|
58 | 58 | } |
@@ -28,63 +28,63 @@ |
||
28 | 28 | |
29 | 29 | class PublicCalendar extends Calendar { |
30 | 30 | |
31 | - /** |
|
32 | - * @param string $name |
|
33 | - * @throws NotFound |
|
34 | - * @return PublicCalendarObject |
|
35 | - */ |
|
36 | - public function getChild($name) { |
|
37 | - $obj = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'], $name); |
|
31 | + /** |
|
32 | + * @param string $name |
|
33 | + * @throws NotFound |
|
34 | + * @return PublicCalendarObject |
|
35 | + */ |
|
36 | + public function getChild($name) { |
|
37 | + $obj = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'], $name); |
|
38 | 38 | |
39 | - if (!$obj) { |
|
40 | - throw new NotFound('Calendar object not found'); |
|
41 | - } |
|
42 | - if ($obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE) { |
|
43 | - throw new NotFound('Calendar object not found'); |
|
44 | - } |
|
45 | - $obj['acl'] = $this->getChildACL(); |
|
39 | + if (!$obj) { |
|
40 | + throw new NotFound('Calendar object not found'); |
|
41 | + } |
|
42 | + if ($obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE) { |
|
43 | + throw new NotFound('Calendar object not found'); |
|
44 | + } |
|
45 | + $obj['acl'] = $this->getChildACL(); |
|
46 | 46 | |
47 | - return new PublicCalendarObject($this->caldavBackend, $this->l10n, $this->calendarInfo, $obj); |
|
48 | - } |
|
47 | + return new PublicCalendarObject($this->caldavBackend, $this->l10n, $this->calendarInfo, $obj); |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * @return PublicCalendarObject[] |
|
52 | - */ |
|
53 | - public function getChildren() { |
|
54 | - $objs = $this->caldavBackend->getCalendarObjects($this->calendarInfo['id']); |
|
55 | - $children = []; |
|
56 | - foreach ($objs as $obj) { |
|
57 | - if ($obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE) { |
|
58 | - continue; |
|
59 | - } |
|
60 | - $obj['acl'] = $this->getChildACL(); |
|
61 | - $children[] = new PublicCalendarObject($this->caldavBackend, $this->l10n, $this->calendarInfo, $obj); |
|
62 | - } |
|
63 | - return $children; |
|
64 | - } |
|
50 | + /** |
|
51 | + * @return PublicCalendarObject[] |
|
52 | + */ |
|
53 | + public function getChildren() { |
|
54 | + $objs = $this->caldavBackend->getCalendarObjects($this->calendarInfo['id']); |
|
55 | + $children = []; |
|
56 | + foreach ($objs as $obj) { |
|
57 | + if ($obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE) { |
|
58 | + continue; |
|
59 | + } |
|
60 | + $obj['acl'] = $this->getChildACL(); |
|
61 | + $children[] = new PublicCalendarObject($this->caldavBackend, $this->l10n, $this->calendarInfo, $obj); |
|
62 | + } |
|
63 | + return $children; |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * @param string[] $paths |
|
68 | - * @return PublicCalendarObject[] |
|
69 | - */ |
|
70 | - public function getMultipleChildren(array $paths) { |
|
71 | - $objs = $this->caldavBackend->getMultipleCalendarObjects($this->calendarInfo['id'], $paths); |
|
72 | - $children = []; |
|
73 | - foreach ($objs as $obj) { |
|
74 | - if ($obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE) { |
|
75 | - continue; |
|
76 | - } |
|
77 | - $obj['acl'] = $this->getChildACL(); |
|
78 | - $children[] = new PublicCalendarObject($this->caldavBackend, $this->l10n, $this->calendarInfo, $obj); |
|
79 | - } |
|
80 | - return $children; |
|
81 | - } |
|
66 | + /** |
|
67 | + * @param string[] $paths |
|
68 | + * @return PublicCalendarObject[] |
|
69 | + */ |
|
70 | + public function getMultipleChildren(array $paths) { |
|
71 | + $objs = $this->caldavBackend->getMultipleCalendarObjects($this->calendarInfo['id'], $paths); |
|
72 | + $children = []; |
|
73 | + foreach ($objs as $obj) { |
|
74 | + if ($obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE) { |
|
75 | + continue; |
|
76 | + } |
|
77 | + $obj['acl'] = $this->getChildACL(); |
|
78 | + $children[] = new PublicCalendarObject($this->caldavBackend, $this->l10n, $this->calendarInfo, $obj); |
|
79 | + } |
|
80 | + return $children; |
|
81 | + } |
|
82 | 82 | |
83 | - /** |
|
84 | - * public calendars are always shared |
|
85 | - * @return bool |
|
86 | - */ |
|
87 | - public function isShared() { |
|
88 | - return true; |
|
89 | - } |
|
83 | + /** |
|
84 | + * public calendars are always shared |
|
85 | + * @return bool |
|
86 | + */ |
|
87 | + public function isShared() { |
|
88 | + return true; |
|
89 | + } |
|
90 | 90 | } |
@@ -35,56 +35,56 @@ |
||
35 | 35 | * or mangle Etag headers. |
36 | 36 | */ |
37 | 37 | class CopyEtagHeaderPlugin extends \Sabre\DAV\ServerPlugin { |
38 | - private ?Server $server = null; |
|
38 | + private ?Server $server = null; |
|
39 | 39 | |
40 | - /** |
|
41 | - * This initializes the plugin. |
|
42 | - * |
|
43 | - * @param \Sabre\DAV\Server $server Sabre server |
|
44 | - * |
|
45 | - * @return void |
|
46 | - */ |
|
47 | - public function initialize(\Sabre\DAV\Server $server) { |
|
48 | - $this->server = $server; |
|
40 | + /** |
|
41 | + * This initializes the plugin. |
|
42 | + * |
|
43 | + * @param \Sabre\DAV\Server $server Sabre server |
|
44 | + * |
|
45 | + * @return void |
|
46 | + */ |
|
47 | + public function initialize(\Sabre\DAV\Server $server) { |
|
48 | + $this->server = $server; |
|
49 | 49 | |
50 | - $server->on('afterMethod:*', [$this, 'afterMethod']); |
|
51 | - $server->on('afterMove', [$this, 'afterMove']); |
|
52 | - } |
|
50 | + $server->on('afterMethod:*', [$this, 'afterMethod']); |
|
51 | + $server->on('afterMove', [$this, 'afterMove']); |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * After method, copy the "Etag" header to "OC-Etag" header. |
|
56 | - * |
|
57 | - * @param RequestInterface $request request |
|
58 | - * @param ResponseInterface $response response |
|
59 | - */ |
|
60 | - public function afterMethod(RequestInterface $request, ResponseInterface $response) { |
|
61 | - $eTag = $response->getHeader('Etag'); |
|
62 | - if (!empty($eTag)) { |
|
63 | - $response->setHeader('OC-ETag', $eTag); |
|
64 | - } |
|
65 | - } |
|
54 | + /** |
|
55 | + * After method, copy the "Etag" header to "OC-Etag" header. |
|
56 | + * |
|
57 | + * @param RequestInterface $request request |
|
58 | + * @param ResponseInterface $response response |
|
59 | + */ |
|
60 | + public function afterMethod(RequestInterface $request, ResponseInterface $response) { |
|
61 | + $eTag = $response->getHeader('Etag'); |
|
62 | + if (!empty($eTag)) { |
|
63 | + $response->setHeader('OC-ETag', $eTag); |
|
64 | + } |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * Called after a node is moved. |
|
69 | - * |
|
70 | - * This allows the backend to move all the associated properties. |
|
71 | - * |
|
72 | - * @param string $source |
|
73 | - * @param string $destination |
|
74 | - * @return void |
|
75 | - */ |
|
76 | - public function afterMove($source, $destination) { |
|
77 | - try { |
|
78 | - $node = $this->server->tree->getNodeForPath($destination); |
|
79 | - } catch (NotFound $e) { |
|
80 | - // Don't care |
|
81 | - return; |
|
82 | - } |
|
67 | + /** |
|
68 | + * Called after a node is moved. |
|
69 | + * |
|
70 | + * This allows the backend to move all the associated properties. |
|
71 | + * |
|
72 | + * @param string $source |
|
73 | + * @param string $destination |
|
74 | + * @return void |
|
75 | + */ |
|
76 | + public function afterMove($source, $destination) { |
|
77 | + try { |
|
78 | + $node = $this->server->tree->getNodeForPath($destination); |
|
79 | + } catch (NotFound $e) { |
|
80 | + // Don't care |
|
81 | + return; |
|
82 | + } |
|
83 | 83 | |
84 | - if ($node instanceof File) { |
|
85 | - $eTag = $node->getETag(); |
|
86 | - $this->server->httpResponse->setHeader('OC-ETag', $eTag); |
|
87 | - $this->server->httpResponse->setHeader('ETag', $eTag); |
|
88 | - } |
|
89 | - } |
|
84 | + if ($node instanceof File) { |
|
85 | + $eTag = $node->getETag(); |
|
86 | + $this->server->httpResponse->setHeader('OC-ETag', $eTag); |
|
87 | + $this->server->httpResponse->setHeader('ETag', $eTag); |
|
88 | + } |
|
89 | + } |
|
90 | 90 | } |
@@ -31,41 +31,41 @@ |
||
31 | 31 | */ |
32 | 32 | interface IShareable extends INode { |
33 | 33 | |
34 | - /** |
|
35 | - * Updates the list of shares. |
|
36 | - * |
|
37 | - * The first array is a list of people that are to be added to the |
|
38 | - * resource. |
|
39 | - * |
|
40 | - * Every element in the add array has the following properties: |
|
41 | - * * href - A url. Usually a mailto: address |
|
42 | - * * commonName - Usually a first and last name, or false |
|
43 | - * * readOnly - A boolean value |
|
44 | - * |
|
45 | - * Every element in the remove array is just the address string. |
|
46 | - * |
|
47 | - * @param list<array{href: string, commonName: string, readOnly: bool}> $add |
|
48 | - * @param list<string> $remove |
|
49 | - */ |
|
50 | - public function updateShares(array $add, array $remove): void; |
|
34 | + /** |
|
35 | + * Updates the list of shares. |
|
36 | + * |
|
37 | + * The first array is a list of people that are to be added to the |
|
38 | + * resource. |
|
39 | + * |
|
40 | + * Every element in the add array has the following properties: |
|
41 | + * * href - A url. Usually a mailto: address |
|
42 | + * * commonName - Usually a first and last name, or false |
|
43 | + * * readOnly - A boolean value |
|
44 | + * |
|
45 | + * Every element in the remove array is just the address string. |
|
46 | + * |
|
47 | + * @param list<array{href: string, commonName: string, readOnly: bool}> $add |
|
48 | + * @param list<string> $remove |
|
49 | + */ |
|
50 | + public function updateShares(array $add, array $remove): void; |
|
51 | 51 | |
52 | - /** |
|
53 | - * Returns the list of people whom this resource is shared with. |
|
54 | - * |
|
55 | - * Every element in this array should have the following properties: |
|
56 | - * * href - Often a mailto: address |
|
57 | - * * commonName - Optional, for example a first + last name |
|
58 | - * * status - See the Sabre\CalDAV\SharingPlugin::STATUS_ constants. |
|
59 | - * * readOnly - boolean |
|
60 | - * |
|
61 | - * @return list<array{href: string, commonName: string, status: int, readOnly: bool, '{http://owncloud.org/ns}principal': string, '{http://owncloud.org/ns}group-share': bool}> |
|
62 | - */ |
|
63 | - public function getShares(): array; |
|
52 | + /** |
|
53 | + * Returns the list of people whom this resource is shared with. |
|
54 | + * |
|
55 | + * Every element in this array should have the following properties: |
|
56 | + * * href - Often a mailto: address |
|
57 | + * * commonName - Optional, for example a first + last name |
|
58 | + * * status - See the Sabre\CalDAV\SharingPlugin::STATUS_ constants. |
|
59 | + * * readOnly - boolean |
|
60 | + * |
|
61 | + * @return list<array{href: string, commonName: string, status: int, readOnly: bool, '{http://owncloud.org/ns}principal': string, '{http://owncloud.org/ns}group-share': bool}> |
|
62 | + */ |
|
63 | + public function getShares(): array; |
|
64 | 64 | |
65 | - public function getResourceId(): int; |
|
65 | + public function getResourceId(): int; |
|
66 | 66 | |
67 | - /** |
|
68 | - * @return ?string |
|
69 | - */ |
|
70 | - public function getOwner(); |
|
67 | + /** |
|
68 | + * @return ?string |
|
69 | + */ |
|
70 | + public function getOwner(); |
|
71 | 71 | } |