@@ -28,17 +28,17 @@ |
||
28 | 28 | * @since 13.0.0 |
29 | 29 | */ |
30 | 30 | interface ICachedMountFileInfo extends ICachedMountInfo { |
31 | - /** |
|
32 | - * Return the path for the file within the cached mount |
|
33 | - * |
|
34 | - * @return string |
|
35 | - * @since 13.0.0 |
|
36 | - */ |
|
37 | - public function getInternalPath(): string; |
|
31 | + /** |
|
32 | + * Return the path for the file within the cached mount |
|
33 | + * |
|
34 | + * @return string |
|
35 | + * @since 13.0.0 |
|
36 | + */ |
|
37 | + public function getInternalPath(): string; |
|
38 | 38 | |
39 | - /** |
|
40 | - * @return string |
|
41 | - * @since 13.0.0 |
|
42 | - */ |
|
43 | - public function getPath(): string; |
|
39 | + /** |
|
40 | + * @return string |
|
41 | + * @since 13.0.0 |
|
42 | + */ |
|
43 | + public function getPath(): string; |
|
44 | 44 | } |
@@ -33,66 +33,66 @@ |
||
33 | 33 | use OCP\Migration\SimpleMigrationStep; |
34 | 34 | |
35 | 35 | class Version24000Date20211222112246 extends SimpleMigrationStep { |
36 | - private const TABLE_NAME = 'reactions'; |
|
36 | + private const TABLE_NAME = 'reactions'; |
|
37 | 37 | |
38 | - /** |
|
39 | - * @param IOutput $output |
|
40 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
41 | - * @param array $options |
|
42 | - * @return null|ISchemaWrapper |
|
43 | - */ |
|
44 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
45 | - /** @var ISchemaWrapper $schema */ |
|
46 | - $schema = $schemaClosure(); |
|
38 | + /** |
|
39 | + * @param IOutput $output |
|
40 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
41 | + * @param array $options |
|
42 | + * @return null|ISchemaWrapper |
|
43 | + */ |
|
44 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
45 | + /** @var ISchemaWrapper $schema */ |
|
46 | + $schema = $schemaClosure(); |
|
47 | 47 | |
48 | - $action = false; |
|
49 | - $comments = $schema->getTable('comments'); |
|
50 | - if (!$comments->hasColumn('reactions')) { |
|
51 | - $comments->addColumn('reactions', Types::STRING, [ |
|
52 | - 'notnull' => false, |
|
53 | - 'length' => 4000, |
|
54 | - ]); |
|
55 | - $action = true; |
|
56 | - } |
|
48 | + $action = false; |
|
49 | + $comments = $schema->getTable('comments'); |
|
50 | + if (!$comments->hasColumn('reactions')) { |
|
51 | + $comments->addColumn('reactions', Types::STRING, [ |
|
52 | + 'notnull' => false, |
|
53 | + 'length' => 4000, |
|
54 | + ]); |
|
55 | + $action = true; |
|
56 | + } |
|
57 | 57 | |
58 | - if (!$schema->hasTable(self::TABLE_NAME)) { |
|
59 | - $table = $schema->createTable(self::TABLE_NAME); |
|
60 | - $table->addColumn('id', Types::BIGINT, [ |
|
61 | - 'autoincrement' => true, |
|
62 | - 'notnull' => true, |
|
63 | - 'length' => 11, |
|
64 | - 'unsigned' => true, |
|
65 | - ]); |
|
66 | - $table->addColumn('parent_id', Types::BIGINT, [ |
|
67 | - 'notnull' => true, |
|
68 | - 'length' => 11, |
|
69 | - 'unsigned' => true, |
|
70 | - ]); |
|
71 | - $table->addColumn('message_id', Types::BIGINT, [ |
|
72 | - 'notnull' => true, |
|
73 | - 'length' => 11, |
|
74 | - 'unsigned' => true, |
|
75 | - ]); |
|
76 | - $table->addColumn('actor_type', Types::STRING, [ |
|
77 | - 'notnull' => true, |
|
78 | - 'length' => 64, |
|
79 | - 'default' => '', |
|
80 | - ]); |
|
81 | - $table->addColumn('actor_id', Types::STRING, [ |
|
82 | - 'notnull' => true, |
|
83 | - 'length' => 64, |
|
84 | - 'default' => '', |
|
85 | - ]); |
|
86 | - $table->addColumn('reaction', Types::STRING, [ |
|
87 | - 'notnull' => true, |
|
88 | - 'length' => 32, |
|
89 | - ]); |
|
90 | - $table->setPrimaryKey(['id']); |
|
91 | - $table->addIndex(['reaction'], 'comment_reaction'); |
|
92 | - $table->addIndex(['parent_id'], 'comment_reaction_parent_id'); |
|
93 | - $table->addUniqueIndex(['parent_id', 'actor_type', 'actor_id', 'reaction'], 'comment_reaction_unique'); |
|
94 | - $action = true; |
|
95 | - } |
|
96 | - return $action ? $schema : null; |
|
97 | - } |
|
58 | + if (!$schema->hasTable(self::TABLE_NAME)) { |
|
59 | + $table = $schema->createTable(self::TABLE_NAME); |
|
60 | + $table->addColumn('id', Types::BIGINT, [ |
|
61 | + 'autoincrement' => true, |
|
62 | + 'notnull' => true, |
|
63 | + 'length' => 11, |
|
64 | + 'unsigned' => true, |
|
65 | + ]); |
|
66 | + $table->addColumn('parent_id', Types::BIGINT, [ |
|
67 | + 'notnull' => true, |
|
68 | + 'length' => 11, |
|
69 | + 'unsigned' => true, |
|
70 | + ]); |
|
71 | + $table->addColumn('message_id', Types::BIGINT, [ |
|
72 | + 'notnull' => true, |
|
73 | + 'length' => 11, |
|
74 | + 'unsigned' => true, |
|
75 | + ]); |
|
76 | + $table->addColumn('actor_type', Types::STRING, [ |
|
77 | + 'notnull' => true, |
|
78 | + 'length' => 64, |
|
79 | + 'default' => '', |
|
80 | + ]); |
|
81 | + $table->addColumn('actor_id', Types::STRING, [ |
|
82 | + 'notnull' => true, |
|
83 | + 'length' => 64, |
|
84 | + 'default' => '', |
|
85 | + ]); |
|
86 | + $table->addColumn('reaction', Types::STRING, [ |
|
87 | + 'notnull' => true, |
|
88 | + 'length' => 32, |
|
89 | + ]); |
|
90 | + $table->setPrimaryKey(['id']); |
|
91 | + $table->addIndex(['reaction'], 'comment_reaction'); |
|
92 | + $table->addIndex(['parent_id'], 'comment_reaction_parent_id'); |
|
93 | + $table->addUniqueIndex(['parent_id', 'actor_type', 'actor_id', 'reaction'], 'comment_reaction_unique'); |
|
94 | + $action = true; |
|
95 | + } |
|
96 | + return $action ? $schema : null; |
|
97 | + } |
|
98 | 98 | } |
@@ -29,11 +29,11 @@ |
||
29 | 29 | use OCP\IConfig; |
30 | 30 | |
31 | 31 | trait TProfileHelper { |
32 | - protected function isProfileEnabledByDefault(IConfig $config): ?bool { |
|
33 | - return filter_var( |
|
34 | - $config->getAppValue('settings', 'profile_enabled_by_default', '1'), |
|
35 | - FILTER_VALIDATE_BOOLEAN, |
|
36 | - FILTER_NULL_ON_FAILURE, |
|
37 | - ); |
|
38 | - } |
|
32 | + protected function isProfileEnabledByDefault(IConfig $config): ?bool { |
|
33 | + return filter_var( |
|
34 | + $config->getAppValue('settings', 'profile_enabled_by_default', '1'), |
|
35 | + FILTER_VALIDATE_BOOLEAN, |
|
36 | + FILTER_NULL_ON_FAILURE, |
|
37 | + ); |
|
38 | + } |
|
39 | 39 | } |
@@ -28,12 +28,12 @@ |
||
28 | 28 | * @since 24.0.0 |
29 | 29 | */ |
30 | 30 | interface IRequestId { |
31 | - /** |
|
32 | - * Returns an ID for the request, value is not guaranteed to be unique and is mostly meant for logging |
|
33 | - * If `mod_unique_id` is installed this value will be taken. |
|
34 | - * |
|
35 | - * @return string |
|
36 | - * @since 24.0.0 |
|
37 | - */ |
|
38 | - public function getId(): string; |
|
31 | + /** |
|
32 | + * Returns an ID for the request, value is not guaranteed to be unique and is mostly meant for logging |
|
33 | + * If `mod_unique_id` is installed this value will be taken. |
|
34 | + * |
|
35 | + * @return string |
|
36 | + * @since 24.0.0 |
|
37 | + */ |
|
38 | + public function getId(): string; |
|
39 | 39 | } |
@@ -32,24 +32,24 @@ |
||
32 | 32 | * @since 24.0.0 |
33 | 33 | */ |
34 | 34 | class InvalidateMountCacheEvent extends Event { |
35 | - private ?IUser $user; |
|
35 | + private ?IUser $user; |
|
36 | 36 | |
37 | - /** |
|
38 | - * @param IUser|null $user user |
|
39 | - * |
|
40 | - * @since 24.0.0 |
|
41 | - */ |
|
42 | - public function __construct(?IUser $user) { |
|
43 | - parent::__construct(); |
|
44 | - $this->user = $user; |
|
45 | - } |
|
37 | + /** |
|
38 | + * @param IUser|null $user user |
|
39 | + * |
|
40 | + * @since 24.0.0 |
|
41 | + */ |
|
42 | + public function __construct(?IUser $user) { |
|
43 | + parent::__construct(); |
|
44 | + $this->user = $user; |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * @return IUser|null user |
|
49 | - * |
|
50 | - * @since 24.0.0 |
|
51 | - */ |
|
52 | - public function getUser(): ?IUser { |
|
53 | - return $this->user; |
|
54 | - } |
|
47 | + /** |
|
48 | + * @return IUser|null user |
|
49 | + * |
|
50 | + * @since 24.0.0 |
|
51 | + */ |
|
52 | + public function getUser(): ?IUser { |
|
53 | + return $this->user; |
|
54 | + } |
|
55 | 55 | } |
@@ -32,22 +32,22 @@ |
||
32 | 32 | |
33 | 33 | class Version010402Date20190107124745 extends SimpleMigrationStep { |
34 | 34 | |
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) { |
|
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) { |
|
42 | + /** @var ISchemaWrapper $schema */ |
|
43 | + $schema = $schemaClosure(); |
|
44 | 44 | |
45 | - // During an ownCloud migration, the client_identifier column identifier might not exist yet. |
|
46 | - if ($schema->getTable('oauth2_clients')->hasColumn('client_identifier')) { |
|
47 | - $table = $schema->getTable('oauth2_clients'); |
|
48 | - $table->dropIndex('oauth2_client_id_idx'); |
|
49 | - $table->addUniqueIndex(['client_identifier'], 'oauth2_client_id_idx'); |
|
50 | - return $schema; |
|
51 | - } |
|
52 | - } |
|
45 | + // During an ownCloud migration, the client_identifier column identifier might not exist yet. |
|
46 | + if ($schema->getTable('oauth2_clients')->hasColumn('client_identifier')) { |
|
47 | + $table = $schema->getTable('oauth2_clients'); |
|
48 | + $table->dropIndex('oauth2_client_id_idx'); |
|
49 | + $table->addUniqueIndex(['client_identifier'], 'oauth2_client_id_idx'); |
|
50 | + return $schema; |
|
51 | + } |
|
52 | + } |
|
53 | 53 | } |
@@ -37,119 +37,119 @@ |
||
37 | 37 | * Mount provider for object store app data folder for previews |
38 | 38 | */ |
39 | 39 | class ObjectStorePreviewCacheMountProvider implements IRootMountProvider { |
40 | - private LoggerInterface $logger; |
|
41 | - /** @var IConfig */ |
|
42 | - private $config; |
|
43 | - |
|
44 | - public function __construct(LoggerInterface $logger, IConfig $config) { |
|
45 | - $this->logger = $logger; |
|
46 | - $this->config = $config; |
|
47 | - } |
|
48 | - |
|
49 | - /** |
|
50 | - * @return MountPoint[] |
|
51 | - * @throws \Exception |
|
52 | - */ |
|
53 | - public function getRootMounts(IStorageFactory $loader): array { |
|
54 | - if (!is_array($this->config->getSystemValue('objectstore_multibucket'))) { |
|
55 | - return []; |
|
56 | - } |
|
57 | - if ($this->config->getSystemValue('objectstore.multibucket.preview-distribution', false) !== true) { |
|
58 | - return []; |
|
59 | - } |
|
60 | - |
|
61 | - $instanceId = $this->config->getSystemValueString('instanceid', ''); |
|
62 | - $mountPoints = []; |
|
63 | - $directoryRange = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']; |
|
64 | - $i = 0; |
|
65 | - foreach ($directoryRange as $parent) { |
|
66 | - foreach ($directoryRange as $child) { |
|
67 | - $mountPoints[] = new MountPoint( |
|
68 | - AppdataPreviewObjectStoreStorage::class, |
|
69 | - '/appdata_' . $instanceId . '/preview/' . $parent . '/' . $child, |
|
70 | - $this->getMultiBucketObjectStore($i), |
|
71 | - $loader, |
|
72 | - null, |
|
73 | - null, |
|
74 | - self::class |
|
75 | - ); |
|
76 | - $i++; |
|
77 | - } |
|
78 | - } |
|
79 | - |
|
80 | - $rootStorageArguments = $this->getMultiBucketObjectStoreForRoot(); |
|
81 | - $fakeRootStorage = new ObjectStoreStorage($rootStorageArguments); |
|
82 | - $fakeRootStorageJail = new Jail([ |
|
83 | - 'storage' => $fakeRootStorage, |
|
84 | - 'root' => '/appdata_' . $instanceId . '/preview', |
|
85 | - ]); |
|
86 | - |
|
87 | - // add a fallback location to be able to fetch existing previews from the old bucket |
|
88 | - $mountPoints[] = new MountPoint( |
|
89 | - $fakeRootStorageJail, |
|
90 | - '/appdata_' . $instanceId . '/preview/old-multibucket', |
|
91 | - null, |
|
92 | - $loader, |
|
93 | - null, |
|
94 | - null, |
|
95 | - self::class |
|
96 | - ); |
|
97 | - |
|
98 | - return $mountPoints; |
|
99 | - } |
|
100 | - |
|
101 | - protected function getMultiBucketObjectStore(int $number): array { |
|
102 | - $config = $this->config->getSystemValue('objectstore_multibucket'); |
|
103 | - |
|
104 | - // sanity checks |
|
105 | - if (empty($config['class'])) { |
|
106 | - $this->logger->error('No class given for objectstore', ['app' => 'files']); |
|
107 | - } |
|
108 | - if (!isset($config['arguments'])) { |
|
109 | - $config['arguments'] = []; |
|
110 | - } |
|
111 | - |
|
112 | - /* |
|
40 | + private LoggerInterface $logger; |
|
41 | + /** @var IConfig */ |
|
42 | + private $config; |
|
43 | + |
|
44 | + public function __construct(LoggerInterface $logger, IConfig $config) { |
|
45 | + $this->logger = $logger; |
|
46 | + $this->config = $config; |
|
47 | + } |
|
48 | + |
|
49 | + /** |
|
50 | + * @return MountPoint[] |
|
51 | + * @throws \Exception |
|
52 | + */ |
|
53 | + public function getRootMounts(IStorageFactory $loader): array { |
|
54 | + if (!is_array($this->config->getSystemValue('objectstore_multibucket'))) { |
|
55 | + return []; |
|
56 | + } |
|
57 | + if ($this->config->getSystemValue('objectstore.multibucket.preview-distribution', false) !== true) { |
|
58 | + return []; |
|
59 | + } |
|
60 | + |
|
61 | + $instanceId = $this->config->getSystemValueString('instanceid', ''); |
|
62 | + $mountPoints = []; |
|
63 | + $directoryRange = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']; |
|
64 | + $i = 0; |
|
65 | + foreach ($directoryRange as $parent) { |
|
66 | + foreach ($directoryRange as $child) { |
|
67 | + $mountPoints[] = new MountPoint( |
|
68 | + AppdataPreviewObjectStoreStorage::class, |
|
69 | + '/appdata_' . $instanceId . '/preview/' . $parent . '/' . $child, |
|
70 | + $this->getMultiBucketObjectStore($i), |
|
71 | + $loader, |
|
72 | + null, |
|
73 | + null, |
|
74 | + self::class |
|
75 | + ); |
|
76 | + $i++; |
|
77 | + } |
|
78 | + } |
|
79 | + |
|
80 | + $rootStorageArguments = $this->getMultiBucketObjectStoreForRoot(); |
|
81 | + $fakeRootStorage = new ObjectStoreStorage($rootStorageArguments); |
|
82 | + $fakeRootStorageJail = new Jail([ |
|
83 | + 'storage' => $fakeRootStorage, |
|
84 | + 'root' => '/appdata_' . $instanceId . '/preview', |
|
85 | + ]); |
|
86 | + |
|
87 | + // add a fallback location to be able to fetch existing previews from the old bucket |
|
88 | + $mountPoints[] = new MountPoint( |
|
89 | + $fakeRootStorageJail, |
|
90 | + '/appdata_' . $instanceId . '/preview/old-multibucket', |
|
91 | + null, |
|
92 | + $loader, |
|
93 | + null, |
|
94 | + null, |
|
95 | + self::class |
|
96 | + ); |
|
97 | + |
|
98 | + return $mountPoints; |
|
99 | + } |
|
100 | + |
|
101 | + protected function getMultiBucketObjectStore(int $number): array { |
|
102 | + $config = $this->config->getSystemValue('objectstore_multibucket'); |
|
103 | + |
|
104 | + // sanity checks |
|
105 | + if (empty($config['class'])) { |
|
106 | + $this->logger->error('No class given for objectstore', ['app' => 'files']); |
|
107 | + } |
|
108 | + if (!isset($config['arguments'])) { |
|
109 | + $config['arguments'] = []; |
|
110 | + } |
|
111 | + |
|
112 | + /* |
|
113 | 113 | * Use any provided bucket argument as prefix |
114 | 114 | * and add the mapping from parent/child => bucket |
115 | 115 | */ |
116 | - if (!isset($config['arguments']['bucket'])) { |
|
117 | - $config['arguments']['bucket'] = ''; |
|
118 | - } |
|
116 | + if (!isset($config['arguments']['bucket'])) { |
|
117 | + $config['arguments']['bucket'] = ''; |
|
118 | + } |
|
119 | 119 | |
120 | - $config['arguments']['bucket'] .= "-preview-$number"; |
|
120 | + $config['arguments']['bucket'] .= "-preview-$number"; |
|
121 | 121 | |
122 | - // instantiate object store implementation |
|
123 | - $config['arguments']['objectstore'] = new $config['class']($config['arguments']); |
|
122 | + // instantiate object store implementation |
|
123 | + $config['arguments']['objectstore'] = new $config['class']($config['arguments']); |
|
124 | 124 | |
125 | - $config['arguments']['internal-id'] = $number; |
|
125 | + $config['arguments']['internal-id'] = $number; |
|
126 | 126 | |
127 | - return $config['arguments']; |
|
128 | - } |
|
127 | + return $config['arguments']; |
|
128 | + } |
|
129 | 129 | |
130 | - protected function getMultiBucketObjectStoreForRoot(): array { |
|
131 | - $config = $this->config->getSystemValue('objectstore_multibucket'); |
|
130 | + protected function getMultiBucketObjectStoreForRoot(): array { |
|
131 | + $config = $this->config->getSystemValue('objectstore_multibucket'); |
|
132 | 132 | |
133 | - // sanity checks |
|
134 | - if (empty($config['class'])) { |
|
135 | - $this->logger->error('No class given for objectstore', ['app' => 'files']); |
|
136 | - } |
|
137 | - if (!isset($config['arguments'])) { |
|
138 | - $config['arguments'] = []; |
|
139 | - } |
|
133 | + // sanity checks |
|
134 | + if (empty($config['class'])) { |
|
135 | + $this->logger->error('No class given for objectstore', ['app' => 'files']); |
|
136 | + } |
|
137 | + if (!isset($config['arguments'])) { |
|
138 | + $config['arguments'] = []; |
|
139 | + } |
|
140 | 140 | |
141 | - /* |
|
141 | + /* |
|
142 | 142 | * Use any provided bucket argument as prefix |
143 | 143 | * and add the mapping from parent/child => bucket |
144 | 144 | */ |
145 | - if (!isset($config['arguments']['bucket'])) { |
|
146 | - $config['arguments']['bucket'] = ''; |
|
147 | - } |
|
148 | - $config['arguments']['bucket'] .= '0'; |
|
145 | + if (!isset($config['arguments']['bucket'])) { |
|
146 | + $config['arguments']['bucket'] = ''; |
|
147 | + } |
|
148 | + $config['arguments']['bucket'] .= '0'; |
|
149 | 149 | |
150 | - // instantiate object store implementation |
|
151 | - $config['arguments']['objectstore'] = new $config['class']($config['arguments']); |
|
150 | + // instantiate object store implementation |
|
151 | + $config['arguments']['objectstore'] = new $config['class']($config['arguments']); |
|
152 | 152 | |
153 | - return $config['arguments']; |
|
154 | - } |
|
153 | + return $config['arguments']; |
|
154 | + } |
|
155 | 155 | } |
@@ -32,68 +32,68 @@ |
||
32 | 32 | use OCP\Migration\IOutput; |
33 | 33 | |
34 | 34 | class Version1130Date20220110154718 extends GroupMappingMigration { |
35 | - public function getName() { |
|
36 | - return 'Copy ldap_group_mapping data from backup table and if needed'; |
|
37 | - } |
|
35 | + public function getName() { |
|
36 | + return 'Copy ldap_group_mapping data from backup table and if needed'; |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * @param IOutput $output |
|
41 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
42 | - * @param array $options |
|
43 | - * @return null|ISchemaWrapper |
|
44 | - */ |
|
45 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
46 | - /** @var ISchemaWrapper $schema */ |
|
47 | - $schema = $schemaClosure(); |
|
39 | + /** |
|
40 | + * @param IOutput $output |
|
41 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
42 | + * @param array $options |
|
43 | + * @return null|ISchemaWrapper |
|
44 | + */ |
|
45 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
46 | + /** @var ISchemaWrapper $schema */ |
|
47 | + $schema = $schemaClosure(); |
|
48 | 48 | |
49 | - if (!$schema->hasTable('ldap_group_mapping_backup')) { |
|
50 | - // Backup table does not exist |
|
51 | - return null; |
|
52 | - } |
|
49 | + if (!$schema->hasTable('ldap_group_mapping_backup')) { |
|
50 | + // Backup table does not exist |
|
51 | + return null; |
|
52 | + } |
|
53 | 53 | |
54 | - $table = $schema->createTable('ldap_group_mapping'); |
|
55 | - $table->addColumn('ldap_dn', Types::STRING, [ |
|
56 | - 'notnull' => true, |
|
57 | - 'length' => 4000, |
|
58 | - 'default' => '', |
|
59 | - ]); |
|
60 | - $table->addColumn('owncloud_name', Types::STRING, [ |
|
61 | - 'notnull' => true, |
|
62 | - 'length' => 64, |
|
63 | - 'default' => '', |
|
64 | - ]); |
|
65 | - $table->addColumn('directory_uuid', Types::STRING, [ |
|
66 | - 'notnull' => true, |
|
67 | - 'length' => 255, |
|
68 | - 'default' => '', |
|
69 | - ]); |
|
70 | - $table->addColumn('ldap_dn_hash', Types::STRING, [ |
|
71 | - 'notnull' => false, |
|
72 | - 'length' => 64, |
|
73 | - ]); |
|
74 | - $table->setPrimaryKey(['owncloud_name']); |
|
75 | - $table->addUniqueIndex(['ldap_dn_hash'], 'ldap_group_dn_hashes'); |
|
76 | - $table->addUniqueIndex(['directory_uuid'], 'ldap_group_directory_uuid'); |
|
54 | + $table = $schema->createTable('ldap_group_mapping'); |
|
55 | + $table->addColumn('ldap_dn', Types::STRING, [ |
|
56 | + 'notnull' => true, |
|
57 | + 'length' => 4000, |
|
58 | + 'default' => '', |
|
59 | + ]); |
|
60 | + $table->addColumn('owncloud_name', Types::STRING, [ |
|
61 | + 'notnull' => true, |
|
62 | + 'length' => 64, |
|
63 | + 'default' => '', |
|
64 | + ]); |
|
65 | + $table->addColumn('directory_uuid', Types::STRING, [ |
|
66 | + 'notnull' => true, |
|
67 | + 'length' => 255, |
|
68 | + 'default' => '', |
|
69 | + ]); |
|
70 | + $table->addColumn('ldap_dn_hash', Types::STRING, [ |
|
71 | + 'notnull' => false, |
|
72 | + 'length' => 64, |
|
73 | + ]); |
|
74 | + $table->setPrimaryKey(['owncloud_name']); |
|
75 | + $table->addUniqueIndex(['ldap_dn_hash'], 'ldap_group_dn_hashes'); |
|
76 | + $table->addUniqueIndex(['directory_uuid'], 'ldap_group_directory_uuid'); |
|
77 | 77 | |
78 | - return $schema; |
|
79 | - } |
|
78 | + return $schema; |
|
79 | + } |
|
80 | 80 | |
81 | - /** |
|
82 | - * @param IOutput $output |
|
83 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
84 | - * @param array $options |
|
85 | - */ |
|
86 | - public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { |
|
87 | - /** @var ISchemaWrapper $schema */ |
|
88 | - $schema = $schemaClosure(); |
|
81 | + /** |
|
82 | + * @param IOutput $output |
|
83 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
84 | + * @param array $options |
|
85 | + */ |
|
86 | + public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { |
|
87 | + /** @var ISchemaWrapper $schema */ |
|
88 | + $schema = $schemaClosure(); |
|
89 | 89 | |
90 | - if (!$schema->hasTable('ldap_group_mapping_backup')) { |
|
91 | - // Backup table does not exist |
|
92 | - return; |
|
93 | - } |
|
90 | + if (!$schema->hasTable('ldap_group_mapping_backup')) { |
|
91 | + // Backup table does not exist |
|
92 | + return; |
|
93 | + } |
|
94 | 94 | |
95 | - $output->startProgress(); |
|
96 | - $this->copyGroupMappingData('ldap_group_mapping_backup', 'ldap_group_mapping'); |
|
97 | - $output->finishProgress(); |
|
98 | - } |
|
95 | + $output->startProgress(); |
|
96 | + $this->copyGroupMappingData('ldap_group_mapping_backup', 'ldap_group_mapping'); |
|
97 | + $output->finishProgress(); |
|
98 | + } |
|
99 | 99 | } |
@@ -33,80 +33,80 @@ |
||
33 | 33 | use OCP\Migration\SimpleMigrationStep; |
34 | 34 | |
35 | 35 | class Version1010Date20200630192842 extends SimpleMigrationStep { |
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) { |
|
43 | - /** @var ISchemaWrapper $schema */ |
|
44 | - $schema = $schemaClosure(); |
|
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) { |
|
43 | + /** @var ISchemaWrapper $schema */ |
|
44 | + $schema = $schemaClosure(); |
|
45 | 45 | |
46 | - if (!$schema->hasTable('ldap_user_mapping')) { |
|
47 | - $table = $schema->createTable('ldap_user_mapping'); |
|
48 | - $table->addColumn('ldap_dn', Types::STRING, [ |
|
49 | - 'notnull' => true, |
|
50 | - 'length' => 4000, |
|
51 | - 'default' => '', |
|
52 | - ]); |
|
53 | - $table->addColumn('owncloud_name', Types::STRING, [ |
|
54 | - 'notnull' => true, |
|
55 | - 'length' => 64, |
|
56 | - 'default' => '', |
|
57 | - ]); |
|
58 | - $table->addColumn('directory_uuid', Types::STRING, [ |
|
59 | - 'notnull' => true, |
|
60 | - 'length' => 255, |
|
61 | - 'default' => '', |
|
62 | - ]); |
|
63 | - $table->addColumn('ldap_dn_hash', Types::STRING, [ |
|
64 | - 'notnull' => false, |
|
65 | - 'length' => 64, |
|
66 | - ]); |
|
67 | - $table->setPrimaryKey(['owncloud_name']); |
|
68 | - $table->addUniqueIndex(['ldap_dn_hash'], 'ldap_user_dn_hashes'); |
|
69 | - $table->addUniqueIndex(['directory_uuid'], 'ldap_user_directory_uuid'); |
|
70 | - } |
|
46 | + if (!$schema->hasTable('ldap_user_mapping')) { |
|
47 | + $table = $schema->createTable('ldap_user_mapping'); |
|
48 | + $table->addColumn('ldap_dn', Types::STRING, [ |
|
49 | + 'notnull' => true, |
|
50 | + 'length' => 4000, |
|
51 | + 'default' => '', |
|
52 | + ]); |
|
53 | + $table->addColumn('owncloud_name', Types::STRING, [ |
|
54 | + 'notnull' => true, |
|
55 | + 'length' => 64, |
|
56 | + 'default' => '', |
|
57 | + ]); |
|
58 | + $table->addColumn('directory_uuid', Types::STRING, [ |
|
59 | + 'notnull' => true, |
|
60 | + 'length' => 255, |
|
61 | + 'default' => '', |
|
62 | + ]); |
|
63 | + $table->addColumn('ldap_dn_hash', Types::STRING, [ |
|
64 | + 'notnull' => false, |
|
65 | + 'length' => 64, |
|
66 | + ]); |
|
67 | + $table->setPrimaryKey(['owncloud_name']); |
|
68 | + $table->addUniqueIndex(['ldap_dn_hash'], 'ldap_user_dn_hashes'); |
|
69 | + $table->addUniqueIndex(['directory_uuid'], 'ldap_user_directory_uuid'); |
|
70 | + } |
|
71 | 71 | |
72 | - if (!$schema->hasTable('ldap_group_mapping')) { |
|
73 | - $table = $schema->createTable('ldap_group_mapping'); |
|
74 | - $table->addColumn('ldap_dn', Types::STRING, [ |
|
75 | - 'notnull' => true, |
|
76 | - 'length' => 4000, |
|
77 | - 'default' => '', |
|
78 | - ]); |
|
79 | - $table->addColumn('owncloud_name', Types::STRING, [ |
|
80 | - 'notnull' => true, |
|
81 | - 'length' => 64, |
|
82 | - 'default' => '', |
|
83 | - ]); |
|
84 | - $table->addColumn('directory_uuid', Types::STRING, [ |
|
85 | - 'notnull' => true, |
|
86 | - 'length' => 255, |
|
87 | - 'default' => '', |
|
88 | - ]); |
|
89 | - $table->addColumn('ldap_dn_hash', Types::STRING, [ |
|
90 | - 'notnull' => false, |
|
91 | - 'length' => 64, |
|
92 | - ]); |
|
93 | - $table->setPrimaryKey(['owncloud_name']); |
|
94 | - $table->addUniqueIndex(['ldap_dn_hash'], 'ldap_group_dn_hashes'); |
|
95 | - $table->addUniqueIndex(['directory_uuid'], 'ldap_group_directory_uuid'); |
|
96 | - } |
|
72 | + if (!$schema->hasTable('ldap_group_mapping')) { |
|
73 | + $table = $schema->createTable('ldap_group_mapping'); |
|
74 | + $table->addColumn('ldap_dn', Types::STRING, [ |
|
75 | + 'notnull' => true, |
|
76 | + 'length' => 4000, |
|
77 | + 'default' => '', |
|
78 | + ]); |
|
79 | + $table->addColumn('owncloud_name', Types::STRING, [ |
|
80 | + 'notnull' => true, |
|
81 | + 'length' => 64, |
|
82 | + 'default' => '', |
|
83 | + ]); |
|
84 | + $table->addColumn('directory_uuid', Types::STRING, [ |
|
85 | + 'notnull' => true, |
|
86 | + 'length' => 255, |
|
87 | + 'default' => '', |
|
88 | + ]); |
|
89 | + $table->addColumn('ldap_dn_hash', Types::STRING, [ |
|
90 | + 'notnull' => false, |
|
91 | + 'length' => 64, |
|
92 | + ]); |
|
93 | + $table->setPrimaryKey(['owncloud_name']); |
|
94 | + $table->addUniqueIndex(['ldap_dn_hash'], 'ldap_group_dn_hashes'); |
|
95 | + $table->addUniqueIndex(['directory_uuid'], 'ldap_group_directory_uuid'); |
|
96 | + } |
|
97 | 97 | |
98 | - if (!$schema->hasTable('ldap_group_members')) { |
|
99 | - $table = $schema->createTable('ldap_group_members'); |
|
100 | - $table->addColumn('owncloudname', Types::STRING, [ |
|
101 | - 'notnull' => true, |
|
102 | - 'length' => 255, |
|
103 | - 'default' => '', |
|
104 | - ]); |
|
105 | - $table->addColumn('owncloudusers', Types::TEXT, [ |
|
106 | - 'notnull' => true, |
|
107 | - ]); |
|
108 | - $table->setPrimaryKey(['owncloudname']); |
|
109 | - } |
|
110 | - return $schema; |
|
111 | - } |
|
98 | + if (!$schema->hasTable('ldap_group_members')) { |
|
99 | + $table = $schema->createTable('ldap_group_members'); |
|
100 | + $table->addColumn('owncloudname', Types::STRING, [ |
|
101 | + 'notnull' => true, |
|
102 | + 'length' => 255, |
|
103 | + 'default' => '', |
|
104 | + ]); |
|
105 | + $table->addColumn('owncloudusers', Types::TEXT, [ |
|
106 | + 'notnull' => true, |
|
107 | + ]); |
|
108 | + $table->setPrimaryKey(['owncloudname']); |
|
109 | + } |
|
110 | + return $schema; |
|
111 | + } |
|
112 | 112 | } |