@@ -93,7 +93,7 @@ |
||
93 | 93 | $column->setType(Type::getType(Types::BIGINT)); |
94 | 94 | $column->setOptions(['length' => 20]); |
95 | 95 | |
96 | - $updates[] = '* ' . $tableName . '.' . $columnName; |
|
96 | + $updates[] = '* '.$tableName.'.'.$columnName; |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | } |
@@ -17,90 +17,90 @@ |
||
17 | 17 | use Symfony\Component\Console\Question\ConfirmationQuestion; |
18 | 18 | |
19 | 19 | class ConvertFilecacheBigInt extends Command { |
20 | - public function __construct( |
|
21 | - private Connection $connection, |
|
22 | - ) { |
|
23 | - parent::__construct(); |
|
24 | - } |
|
20 | + public function __construct( |
|
21 | + private Connection $connection, |
|
22 | + ) { |
|
23 | + parent::__construct(); |
|
24 | + } |
|
25 | 25 | |
26 | - protected function configure() { |
|
27 | - $this |
|
28 | - ->setName('db:convert-filecache-bigint') |
|
29 | - ->setDescription('Convert the ID columns of the filecache to BigInt'); |
|
30 | - } |
|
26 | + protected function configure() { |
|
27 | + $this |
|
28 | + ->setName('db:convert-filecache-bigint') |
|
29 | + ->setDescription('Convert the ID columns of the filecache to BigInt'); |
|
30 | + } |
|
31 | 31 | |
32 | - /** |
|
33 | - * @return array<string,string[]> |
|
34 | - */ |
|
35 | - public static function getColumnsByTable(): array { |
|
36 | - return [ |
|
37 | - 'activity' => ['activity_id', 'object_id'], |
|
38 | - 'activity_mq' => ['mail_id'], |
|
39 | - 'authtoken' => ['id'], |
|
40 | - 'bruteforce_attempts' => ['id'], |
|
41 | - 'federated_reshares' => ['share_id'], |
|
42 | - 'filecache' => ['fileid', 'storage', 'parent', 'mimetype', 'mimepart', 'mtime', 'storage_mtime'], |
|
43 | - 'filecache_extended' => ['fileid'], |
|
44 | - 'files_trash' => ['auto_id'], |
|
45 | - 'file_locks' => ['id'], |
|
46 | - 'file_metadata' => ['id'], |
|
47 | - 'jobs' => ['id'], |
|
48 | - 'mimetypes' => ['id'], |
|
49 | - 'mounts' => ['id', 'storage_id', 'root_id', 'mount_id'], |
|
50 | - 'share_external' => ['id', 'parent'], |
|
51 | - 'storages' => ['numeric_id'], |
|
52 | - ]; |
|
53 | - } |
|
32 | + /** |
|
33 | + * @return array<string,string[]> |
|
34 | + */ |
|
35 | + public static function getColumnsByTable(): array { |
|
36 | + return [ |
|
37 | + 'activity' => ['activity_id', 'object_id'], |
|
38 | + 'activity_mq' => ['mail_id'], |
|
39 | + 'authtoken' => ['id'], |
|
40 | + 'bruteforce_attempts' => ['id'], |
|
41 | + 'federated_reshares' => ['share_id'], |
|
42 | + 'filecache' => ['fileid', 'storage', 'parent', 'mimetype', 'mimepart', 'mtime', 'storage_mtime'], |
|
43 | + 'filecache_extended' => ['fileid'], |
|
44 | + 'files_trash' => ['auto_id'], |
|
45 | + 'file_locks' => ['id'], |
|
46 | + 'file_metadata' => ['id'], |
|
47 | + 'jobs' => ['id'], |
|
48 | + 'mimetypes' => ['id'], |
|
49 | + 'mounts' => ['id', 'storage_id', 'root_id', 'mount_id'], |
|
50 | + 'share_external' => ['id', 'parent'], |
|
51 | + 'storages' => ['numeric_id'], |
|
52 | + ]; |
|
53 | + } |
|
54 | 54 | |
55 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
56 | - $schema = new SchemaWrapper($this->connection); |
|
57 | - $isSqlite = $this->connection->getDatabaseProvider() === IDBConnection::PLATFORM_SQLITE; |
|
58 | - $updates = []; |
|
55 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
56 | + $schema = new SchemaWrapper($this->connection); |
|
57 | + $isSqlite = $this->connection->getDatabaseProvider() === IDBConnection::PLATFORM_SQLITE; |
|
58 | + $updates = []; |
|
59 | 59 | |
60 | - $tables = static::getColumnsByTable(); |
|
61 | - foreach ($tables as $tableName => $columns) { |
|
62 | - if (!$schema->hasTable($tableName)) { |
|
63 | - continue; |
|
64 | - } |
|
60 | + $tables = static::getColumnsByTable(); |
|
61 | + foreach ($tables as $tableName => $columns) { |
|
62 | + if (!$schema->hasTable($tableName)) { |
|
63 | + continue; |
|
64 | + } |
|
65 | 65 | |
66 | - $table = $schema->getTable($tableName); |
|
66 | + $table = $schema->getTable($tableName); |
|
67 | 67 | |
68 | - foreach ($columns as $columnName) { |
|
69 | - $column = $table->getColumn($columnName); |
|
70 | - $isAutoIncrement = $column->getAutoincrement(); |
|
71 | - $isAutoIncrementOnSqlite = $isSqlite && $isAutoIncrement; |
|
72 | - if ($column->getType()->getName() !== Types::BIGINT && !$isAutoIncrementOnSqlite) { |
|
73 | - $column->setType(Type::getType(Types::BIGINT)); |
|
74 | - $column->setOptions(['length' => 20]); |
|
68 | + foreach ($columns as $columnName) { |
|
69 | + $column = $table->getColumn($columnName); |
|
70 | + $isAutoIncrement = $column->getAutoincrement(); |
|
71 | + $isAutoIncrementOnSqlite = $isSqlite && $isAutoIncrement; |
|
72 | + if ($column->getType()->getName() !== Types::BIGINT && !$isAutoIncrementOnSqlite) { |
|
73 | + $column->setType(Type::getType(Types::BIGINT)); |
|
74 | + $column->setOptions(['length' => 20]); |
|
75 | 75 | |
76 | - $updates[] = '* ' . $tableName . '.' . $columnName; |
|
77 | - } |
|
78 | - } |
|
79 | - } |
|
76 | + $updates[] = '* ' . $tableName . '.' . $columnName; |
|
77 | + } |
|
78 | + } |
|
79 | + } |
|
80 | 80 | |
81 | - if (empty($updates)) { |
|
82 | - $output->writeln('<info>All tables already up to date!</info>'); |
|
83 | - return 0; |
|
84 | - } |
|
81 | + if (empty($updates)) { |
|
82 | + $output->writeln('<info>All tables already up to date!</info>'); |
|
83 | + return 0; |
|
84 | + } |
|
85 | 85 | |
86 | - $output->writeln('<comment>Following columns will be updated:</comment>'); |
|
87 | - $output->writeln(''); |
|
88 | - $output->writeln($updates); |
|
89 | - $output->writeln(''); |
|
90 | - $output->writeln('<comment>This can take up to hours, depending on the number of files in your instance!</comment>'); |
|
86 | + $output->writeln('<comment>Following columns will be updated:</comment>'); |
|
87 | + $output->writeln(''); |
|
88 | + $output->writeln($updates); |
|
89 | + $output->writeln(''); |
|
90 | + $output->writeln('<comment>This can take up to hours, depending on the number of files in your instance!</comment>'); |
|
91 | 91 | |
92 | - if ($input->isInteractive()) { |
|
93 | - /** @var QuestionHelper $helper */ |
|
94 | - $helper = $this->getHelper('question'); |
|
95 | - $question = new ConfirmationQuestion('Continue with the conversion (y/n)? [n] ', false); |
|
92 | + if ($input->isInteractive()) { |
|
93 | + /** @var QuestionHelper $helper */ |
|
94 | + $helper = $this->getHelper('question'); |
|
95 | + $question = new ConfirmationQuestion('Continue with the conversion (y/n)? [n] ', false); |
|
96 | 96 | |
97 | - if (!$helper->ask($input, $output, $question)) { |
|
98 | - return 1; |
|
99 | - } |
|
100 | - } |
|
97 | + if (!$helper->ask($input, $output, $question)) { |
|
98 | + return 1; |
|
99 | + } |
|
100 | + } |
|
101 | 101 | |
102 | - $this->connection->migrateToSchema($schema->getWrappedSchema()); |
|
102 | + $this->connection->migrateToSchema($schema->getWrappedSchema()); |
|
103 | 103 | |
104 | - return 0; |
|
105 | - } |
|
104 | + return 0; |
|
105 | + } |
|
106 | 106 | } |
@@ -35,72 +35,72 @@ |
||
35 | 35 | use OCP\Migration\SimpleMigrationStep; |
36 | 36 | |
37 | 37 | class Version16000Date20190212081545 extends SimpleMigrationStep { |
38 | - /** |
|
39 | - * @param IOutput $output |
|
40 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
41 | - * @param array $options |
|
42 | - * |
|
43 | - * @return ISchemaWrapper |
|
44 | - */ |
|
45 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper { |
|
46 | - /** @var ISchemaWrapper $schema */ |
|
47 | - $schema = $schemaClosure(); |
|
38 | + /** |
|
39 | + * @param IOutput $output |
|
40 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
41 | + * @param array $options |
|
42 | + * |
|
43 | + * @return ISchemaWrapper |
|
44 | + */ |
|
45 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper { |
|
46 | + /** @var ISchemaWrapper $schema */ |
|
47 | + $schema = $schemaClosure(); |
|
48 | 48 | |
49 | - $table = $schema->createTable('login_flow_v2'); |
|
50 | - $table->addColumn('id', Types::BIGINT, [ |
|
51 | - 'autoincrement' => true, |
|
52 | - 'notnull' => true, |
|
53 | - 'length' => 20, |
|
54 | - 'unsigned' => true, |
|
55 | - ]); |
|
56 | - $table->addColumn('timestamp', Types::BIGINT, [ |
|
57 | - 'notnull' => true, |
|
58 | - 'length' => 20, |
|
59 | - 'unsigned' => true, |
|
60 | - ]); |
|
61 | - $table->addColumn('started', Types::SMALLINT, [ |
|
62 | - 'notnull' => true, |
|
63 | - 'length' => 1, |
|
64 | - 'unsigned' => true, |
|
65 | - 'default' => 0, |
|
66 | - ]); |
|
67 | - $table->addColumn('poll_token', Types::STRING, [ |
|
68 | - 'notnull' => true, |
|
69 | - 'length' => 255, |
|
70 | - ]); |
|
71 | - $table->addColumn('login_token', Types::STRING, [ |
|
72 | - 'notnull' => true, |
|
73 | - 'length' => 255, |
|
74 | - ]); |
|
75 | - $table->addColumn('public_key', Types::TEXT, [ |
|
76 | - 'notnull' => true, |
|
77 | - 'length' => 32768, |
|
78 | - ]); |
|
79 | - $table->addColumn('private_key', Types::TEXT, [ |
|
80 | - 'notnull' => true, |
|
81 | - 'length' => 32768, |
|
82 | - ]); |
|
83 | - $table->addColumn('client_name', Types::STRING, [ |
|
84 | - 'notnull' => true, |
|
85 | - 'length' => 255, |
|
86 | - ]); |
|
87 | - $table->addColumn('login_name', Types::STRING, [ |
|
88 | - 'notnull' => false, |
|
89 | - 'length' => 255, |
|
90 | - ]); |
|
91 | - $table->addColumn('server', Types::STRING, [ |
|
92 | - 'notnull' => false, |
|
93 | - 'length' => 255, |
|
94 | - ]); |
|
95 | - $table->addColumn('app_password', Types::STRING, [ |
|
96 | - 'notnull' => false, |
|
97 | - 'length' => 1024, |
|
98 | - ]); |
|
99 | - $table->setPrimaryKey(['id']); |
|
100 | - $table->addUniqueIndex(['poll_token'], 'poll_token'); |
|
101 | - $table->addUniqueIndex(['login_token'], 'login_token'); |
|
102 | - $table->addIndex(['timestamp'], 'timestamp'); |
|
49 | + $table = $schema->createTable('login_flow_v2'); |
|
50 | + $table->addColumn('id', Types::BIGINT, [ |
|
51 | + 'autoincrement' => true, |
|
52 | + 'notnull' => true, |
|
53 | + 'length' => 20, |
|
54 | + 'unsigned' => true, |
|
55 | + ]); |
|
56 | + $table->addColumn('timestamp', Types::BIGINT, [ |
|
57 | + 'notnull' => true, |
|
58 | + 'length' => 20, |
|
59 | + 'unsigned' => true, |
|
60 | + ]); |
|
61 | + $table->addColumn('started', Types::SMALLINT, [ |
|
62 | + 'notnull' => true, |
|
63 | + 'length' => 1, |
|
64 | + 'unsigned' => true, |
|
65 | + 'default' => 0, |
|
66 | + ]); |
|
67 | + $table->addColumn('poll_token', Types::STRING, [ |
|
68 | + 'notnull' => true, |
|
69 | + 'length' => 255, |
|
70 | + ]); |
|
71 | + $table->addColumn('login_token', Types::STRING, [ |
|
72 | + 'notnull' => true, |
|
73 | + 'length' => 255, |
|
74 | + ]); |
|
75 | + $table->addColumn('public_key', Types::TEXT, [ |
|
76 | + 'notnull' => true, |
|
77 | + 'length' => 32768, |
|
78 | + ]); |
|
79 | + $table->addColumn('private_key', Types::TEXT, [ |
|
80 | + 'notnull' => true, |
|
81 | + 'length' => 32768, |
|
82 | + ]); |
|
83 | + $table->addColumn('client_name', Types::STRING, [ |
|
84 | + 'notnull' => true, |
|
85 | + 'length' => 255, |
|
86 | + ]); |
|
87 | + $table->addColumn('login_name', Types::STRING, [ |
|
88 | + 'notnull' => false, |
|
89 | + 'length' => 255, |
|
90 | + ]); |
|
91 | + $table->addColumn('server', Types::STRING, [ |
|
92 | + 'notnull' => false, |
|
93 | + 'length' => 255, |
|
94 | + ]); |
|
95 | + $table->addColumn('app_password', Types::STRING, [ |
|
96 | + 'notnull' => false, |
|
97 | + 'length' => 1024, |
|
98 | + ]); |
|
99 | + $table->setPrimaryKey(['id']); |
|
100 | + $table->addUniqueIndex(['poll_token'], 'poll_token'); |
|
101 | + $table->addUniqueIndex(['login_token'], 'login_token'); |
|
102 | + $table->addIndex(['timestamp'], 'timestamp'); |
|
103 | 103 | |
104 | - return $schema; |
|
105 | - } |
|
104 | + return $schema; |
|
105 | + } |
|
106 | 106 | } |
@@ -30,65 +30,65 @@ |
||
30 | 30 | use OCP\Migration\SimpleMigrationStep; |
31 | 31 | |
32 | 32 | class Version13000Date20170705121758 extends SimpleMigrationStep { |
33 | - /** |
|
34 | - * @param IOutput $output |
|
35 | - * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
36 | - * @param array $options |
|
37 | - * @return null|ISchemaWrapper |
|
38 | - * @since 13.0.0 |
|
39 | - */ |
|
40 | - public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
41 | - /** @var ISchemaWrapper $schema */ |
|
42 | - $schema = $schemaClosure(); |
|
33 | + /** |
|
34 | + * @param IOutput $output |
|
35 | + * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
36 | + * @param array $options |
|
37 | + * @return null|ISchemaWrapper |
|
38 | + * @since 13.0.0 |
|
39 | + */ |
|
40 | + public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
41 | + /** @var ISchemaWrapper $schema */ |
|
42 | + $schema = $schemaClosure(); |
|
43 | 43 | |
44 | - if (!$schema->hasTable('personal_sections')) { |
|
45 | - $table = $schema->createTable('personal_sections'); |
|
44 | + if (!$schema->hasTable('personal_sections')) { |
|
45 | + $table = $schema->createTable('personal_sections'); |
|
46 | 46 | |
47 | - $table->addColumn('id', Types::STRING, [ |
|
48 | - 'notnull' => false, |
|
49 | - 'length' => 64, |
|
50 | - ]); |
|
51 | - $table->addColumn('class', Types::STRING, [ |
|
52 | - 'notnull' => true, |
|
53 | - 'length' => 255, |
|
54 | - ]); |
|
55 | - $table->addColumn('priority', Types::INTEGER, [ |
|
56 | - 'notnull' => true, |
|
57 | - 'length' => 6, |
|
58 | - 'default' => 0, |
|
59 | - ]); |
|
47 | + $table->addColumn('id', Types::STRING, [ |
|
48 | + 'notnull' => false, |
|
49 | + 'length' => 64, |
|
50 | + ]); |
|
51 | + $table->addColumn('class', Types::STRING, [ |
|
52 | + 'notnull' => true, |
|
53 | + 'length' => 255, |
|
54 | + ]); |
|
55 | + $table->addColumn('priority', Types::INTEGER, [ |
|
56 | + 'notnull' => true, |
|
57 | + 'length' => 6, |
|
58 | + 'default' => 0, |
|
59 | + ]); |
|
60 | 60 | |
61 | - $table->setPrimaryKey(['id'], 'personal_sections_id_index'); |
|
62 | - $table->addUniqueIndex(['class'], 'personal_sections_class'); |
|
63 | - } |
|
61 | + $table->setPrimaryKey(['id'], 'personal_sections_id_index'); |
|
62 | + $table->addUniqueIndex(['class'], 'personal_sections_class'); |
|
63 | + } |
|
64 | 64 | |
65 | - if (!$schema->hasTable('personal_settings')) { |
|
66 | - $table = $schema->createTable('personal_settings'); |
|
65 | + if (!$schema->hasTable('personal_settings')) { |
|
66 | + $table = $schema->createTable('personal_settings'); |
|
67 | 67 | |
68 | - $table->addColumn('id', Types::INTEGER, [ |
|
69 | - 'autoincrement' => true, |
|
70 | - 'notnull' => true, |
|
71 | - 'length' => 20, |
|
72 | - ]); |
|
73 | - $table->addColumn('class', Types::STRING, [ |
|
74 | - 'notnull' => true, |
|
75 | - 'length' => 255, |
|
76 | - ]); |
|
77 | - $table->addColumn('section', Types::STRING, [ |
|
78 | - 'notnull' => false, |
|
79 | - 'length' => 64, |
|
80 | - ]); |
|
81 | - $table->addColumn('priority', Types::INTEGER, [ |
|
82 | - 'notnull' => true, |
|
83 | - 'length' => 6, |
|
84 | - 'default' => 0, |
|
85 | - ]); |
|
68 | + $table->addColumn('id', Types::INTEGER, [ |
|
69 | + 'autoincrement' => true, |
|
70 | + 'notnull' => true, |
|
71 | + 'length' => 20, |
|
72 | + ]); |
|
73 | + $table->addColumn('class', Types::STRING, [ |
|
74 | + 'notnull' => true, |
|
75 | + 'length' => 255, |
|
76 | + ]); |
|
77 | + $table->addColumn('section', Types::STRING, [ |
|
78 | + 'notnull' => false, |
|
79 | + 'length' => 64, |
|
80 | + ]); |
|
81 | + $table->addColumn('priority', Types::INTEGER, [ |
|
82 | + 'notnull' => true, |
|
83 | + 'length' => 6, |
|
84 | + 'default' => 0, |
|
85 | + ]); |
|
86 | 86 | |
87 | - $table->setPrimaryKey(['id'], 'personal_settings_id_index'); |
|
88 | - $table->addUniqueIndex(['class'], 'personal_settings_class'); |
|
89 | - $table->addIndex(['section'], 'personal_settings_section'); |
|
90 | - } |
|
87 | + $table->setPrimaryKey(['id'], 'personal_settings_id_index'); |
|
88 | + $table->addUniqueIndex(['class'], 'personal_settings_class'); |
|
89 | + $table->addIndex(['section'], 'personal_settings_section'); |
|
90 | + } |
|
91 | 91 | |
92 | - return $schema; |
|
93 | - } |
|
92 | + return $schema; |
|
93 | + } |
|
94 | 94 | } |
@@ -35,61 +35,61 @@ |
||
35 | 35 | */ |
36 | 36 | class Version1006Date20180619154313 extends SimpleMigrationStep { |
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 | - * @since 13.0.0 |
|
44 | - */ |
|
45 | - public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
46 | - /** @var ISchemaWrapper $schema */ |
|
47 | - $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 | + * @since 13.0.0 |
|
44 | + */ |
|
45 | + public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
46 | + /** @var ISchemaWrapper $schema */ |
|
47 | + $schema = $schemaClosure(); |
|
48 | 48 | |
49 | - if (!$schema->hasTable('calendar_invitations')) { |
|
50 | - $table = $schema->createTable('calendar_invitations'); |
|
49 | + if (!$schema->hasTable('calendar_invitations')) { |
|
50 | + $table = $schema->createTable('calendar_invitations'); |
|
51 | 51 | |
52 | - $table->addColumn('id', Types::BIGINT, [ |
|
53 | - 'autoincrement' => true, |
|
54 | - 'notnull' => true, |
|
55 | - 'length' => 11, |
|
56 | - 'unsigned' => true, |
|
57 | - ]); |
|
58 | - $table->addColumn('uid', Types::STRING, [ |
|
59 | - 'notnull' => true, |
|
60 | - 'length' => 255, |
|
61 | - ]); |
|
62 | - $table->addColumn('recurrenceid', Types::STRING, [ |
|
63 | - 'notnull' => false, |
|
64 | - 'length' => 255, |
|
65 | - ]); |
|
66 | - $table->addColumn('attendee', Types::STRING, [ |
|
67 | - 'notnull' => true, |
|
68 | - 'length' => 255, |
|
69 | - ]); |
|
70 | - $table->addColumn('organizer', Types::STRING, [ |
|
71 | - 'notnull' => true, |
|
72 | - 'length' => 255, |
|
73 | - ]); |
|
74 | - $table->addColumn('sequence', Types::BIGINT, [ |
|
75 | - 'notnull' => false, |
|
76 | - 'length' => 11, |
|
77 | - 'unsigned' => true, |
|
78 | - ]); |
|
79 | - $table->addColumn('token', Types::STRING, [ |
|
80 | - 'notnull' => true, |
|
81 | - 'length' => 60, |
|
82 | - ]); |
|
83 | - $table->addColumn('expiration', Types::BIGINT, [ |
|
84 | - 'notnull' => true, |
|
85 | - 'length' => 11, |
|
86 | - 'unsigned' => true, |
|
87 | - ]); |
|
52 | + $table->addColumn('id', Types::BIGINT, [ |
|
53 | + 'autoincrement' => true, |
|
54 | + 'notnull' => true, |
|
55 | + 'length' => 11, |
|
56 | + 'unsigned' => true, |
|
57 | + ]); |
|
58 | + $table->addColumn('uid', Types::STRING, [ |
|
59 | + 'notnull' => true, |
|
60 | + 'length' => 255, |
|
61 | + ]); |
|
62 | + $table->addColumn('recurrenceid', Types::STRING, [ |
|
63 | + 'notnull' => false, |
|
64 | + 'length' => 255, |
|
65 | + ]); |
|
66 | + $table->addColumn('attendee', Types::STRING, [ |
|
67 | + 'notnull' => true, |
|
68 | + 'length' => 255, |
|
69 | + ]); |
|
70 | + $table->addColumn('organizer', Types::STRING, [ |
|
71 | + 'notnull' => true, |
|
72 | + 'length' => 255, |
|
73 | + ]); |
|
74 | + $table->addColumn('sequence', Types::BIGINT, [ |
|
75 | + 'notnull' => false, |
|
76 | + 'length' => 11, |
|
77 | + 'unsigned' => true, |
|
78 | + ]); |
|
79 | + $table->addColumn('token', Types::STRING, [ |
|
80 | + 'notnull' => true, |
|
81 | + 'length' => 60, |
|
82 | + ]); |
|
83 | + $table->addColumn('expiration', Types::BIGINT, [ |
|
84 | + 'notnull' => true, |
|
85 | + 'length' => 11, |
|
86 | + 'unsigned' => true, |
|
87 | + ]); |
|
88 | 88 | |
89 | - $table->setPrimaryKey(['id']); |
|
90 | - $table->addIndex(['token'], 'calendar_invitation_tokens'); |
|
89 | + $table->setPrimaryKey(['id']); |
|
90 | + $table->addIndex(['token'], 'calendar_invitation_tokens'); |
|
91 | 91 | |
92 | - return $schema; |
|
93 | - } |
|
94 | - } |
|
92 | + return $schema; |
|
93 | + } |
|
94 | + } |
|
95 | 95 | } |
@@ -33,56 +33,56 @@ |
||
33 | 33 | |
34 | 34 | class Version1005Date20180530124431 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 | - * @since 13.0.0 |
|
42 | - */ |
|
43 | - public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
44 | - /** @var ISchemaWrapper $schema */ |
|
45 | - $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 | + * @since 13.0.0 |
|
42 | + */ |
|
43 | + public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
44 | + /** @var ISchemaWrapper $schema */ |
|
45 | + $schema = $schemaClosure(); |
|
46 | 46 | |
47 | - $types = ['resources', 'rooms']; |
|
48 | - foreach ($types as $type) { |
|
49 | - if (!$schema->hasTable('calendar_' . $type)) { |
|
50 | - $table = $schema->createTable('calendar_' . $type); |
|
47 | + $types = ['resources', 'rooms']; |
|
48 | + foreach ($types as $type) { |
|
49 | + if (!$schema->hasTable('calendar_' . $type)) { |
|
50 | + $table = $schema->createTable('calendar_' . $type); |
|
51 | 51 | |
52 | - $table->addColumn('id', Types::BIGINT, [ |
|
53 | - 'autoincrement' => true, |
|
54 | - 'notnull' => true, |
|
55 | - 'length' => 11, |
|
56 | - 'unsigned' => true, |
|
57 | - ]); |
|
58 | - $table->addColumn('backend_id', Types::STRING, [ |
|
59 | - 'notnull' => false, |
|
60 | - 'length' => 64, |
|
61 | - ]); |
|
62 | - $table->addColumn('resource_id', Types::STRING, [ |
|
63 | - 'notnull' => false, |
|
64 | - 'length' => 64, |
|
65 | - ]); |
|
66 | - $table->addColumn('email', Types::STRING, [ |
|
67 | - 'notnull' => false, |
|
68 | - 'length' => 255, |
|
69 | - ]); |
|
70 | - $table->addColumn('displayname', Types::STRING, [ |
|
71 | - 'notnull' => false, |
|
72 | - 'length' => 255, |
|
73 | - ]); |
|
74 | - $table->addColumn('group_restrictions', Types::STRING, [ |
|
75 | - 'notnull' => false, |
|
76 | - 'length' => 4000, |
|
77 | - ]); |
|
52 | + $table->addColumn('id', Types::BIGINT, [ |
|
53 | + 'autoincrement' => true, |
|
54 | + 'notnull' => true, |
|
55 | + 'length' => 11, |
|
56 | + 'unsigned' => true, |
|
57 | + ]); |
|
58 | + $table->addColumn('backend_id', Types::STRING, [ |
|
59 | + 'notnull' => false, |
|
60 | + 'length' => 64, |
|
61 | + ]); |
|
62 | + $table->addColumn('resource_id', Types::STRING, [ |
|
63 | + 'notnull' => false, |
|
64 | + 'length' => 64, |
|
65 | + ]); |
|
66 | + $table->addColumn('email', Types::STRING, [ |
|
67 | + 'notnull' => false, |
|
68 | + 'length' => 255, |
|
69 | + ]); |
|
70 | + $table->addColumn('displayname', Types::STRING, [ |
|
71 | + 'notnull' => false, |
|
72 | + 'length' => 255, |
|
73 | + ]); |
|
74 | + $table->addColumn('group_restrictions', Types::STRING, [ |
|
75 | + 'notnull' => false, |
|
76 | + 'length' => 4000, |
|
77 | + ]); |
|
78 | 78 | |
79 | - $table->setPrimaryKey(['id']); |
|
80 | - $table->addIndex(['backend_id', 'resource_id'], 'calendar_' . $type . '_bkdrsc'); |
|
81 | - $table->addIndex(['email'], 'calendar_' . $type . '_email'); |
|
82 | - $table->addIndex(['displayname'], 'calendar_' . $type . '_name'); |
|
83 | - } |
|
84 | - } |
|
79 | + $table->setPrimaryKey(['id']); |
|
80 | + $table->addIndex(['backend_id', 'resource_id'], 'calendar_' . $type . '_bkdrsc'); |
|
81 | + $table->addIndex(['email'], 'calendar_' . $type . '_email'); |
|
82 | + $table->addIndex(['displayname'], 'calendar_' . $type . '_name'); |
|
83 | + } |
|
84 | + } |
|
85 | 85 | |
86 | - return $schema; |
|
87 | - } |
|
86 | + return $schema; |
|
87 | + } |
|
88 | 88 | } |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | |
47 | 47 | $types = ['resources', 'rooms']; |
48 | 48 | foreach ($types as $type) { |
49 | - if (!$schema->hasTable('calendar_' . $type)) { |
|
50 | - $table = $schema->createTable('calendar_' . $type); |
|
49 | + if (!$schema->hasTable('calendar_'.$type)) { |
|
50 | + $table = $schema->createTable('calendar_'.$type); |
|
51 | 51 | |
52 | 52 | $table->addColumn('id', Types::BIGINT, [ |
53 | 53 | 'autoincrement' => true, |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | ]); |
78 | 78 | |
79 | 79 | $table->setPrimaryKey(['id']); |
80 | - $table->addIndex(['backend_id', 'resource_id'], 'calendar_' . $type . '_bkdrsc'); |
|
81 | - $table->addIndex(['email'], 'calendar_' . $type . '_email'); |
|
82 | - $table->addIndex(['displayname'], 'calendar_' . $type . '_name'); |
|
80 | + $table->addIndex(['backend_id', 'resource_id'], 'calendar_'.$type.'_bkdrsc'); |
|
81 | + $table->addIndex(['email'], 'calendar_'.$type.'_email'); |
|
82 | + $table->addIndex(['displayname'], 'calendar_'.$type.'_name'); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 |
@@ -37,55 +37,55 @@ |
||
37 | 37 | */ |
38 | 38 | class Version1011Date20190725113607 extends SimpleMigrationStep { |
39 | 39 | |
40 | - /** |
|
41 | - * @param IOutput $output |
|
42 | - * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
43 | - * @param array $options |
|
44 | - * @return null|ISchemaWrapper |
|
45 | - * @since 13.0.0 |
|
46 | - */ |
|
47 | - public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
48 | - /** @var ISchemaWrapper $schema */ |
|
49 | - $schema = $schemaClosure(); |
|
40 | + /** |
|
41 | + * @param IOutput $output |
|
42 | + * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
43 | + * @param array $options |
|
44 | + * @return null|ISchemaWrapper |
|
45 | + * @since 13.0.0 |
|
46 | + */ |
|
47 | + public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
48 | + /** @var ISchemaWrapper $schema */ |
|
49 | + $schema = $schemaClosure(); |
|
50 | 50 | |
51 | - $types = ['resource', 'room']; |
|
52 | - foreach ($types as $type) { |
|
53 | - if (!$schema->hasTable($this->getMetadataTableName($type))) { |
|
54 | - $table = $schema->createTable($this->getMetadataTableName($type)); |
|
51 | + $types = ['resource', 'room']; |
|
52 | + foreach ($types as $type) { |
|
53 | + if (!$schema->hasTable($this->getMetadataTableName($type))) { |
|
54 | + $table = $schema->createTable($this->getMetadataTableName($type)); |
|
55 | 55 | |
56 | - $table->addColumn('id', Types::BIGINT, [ |
|
57 | - 'autoincrement' => true, |
|
58 | - 'notnull' => true, |
|
59 | - 'length' => 11, |
|
60 | - 'unsigned' => true, |
|
61 | - ]); |
|
62 | - $table->addColumn($type . '_id', Types::BIGINT, [ |
|
63 | - 'notnull' => true, |
|
64 | - 'length' => 11, |
|
65 | - 'unsigned' => true, |
|
66 | - ]); |
|
67 | - $table->addColumn('key', Types::STRING, [ |
|
68 | - 'notnull' => true, |
|
69 | - 'length' => 255, |
|
70 | - ]); |
|
71 | - $table->addColumn('value', Types::STRING, [ |
|
72 | - 'notnull' => false, |
|
73 | - 'length' => 4000, |
|
74 | - ]); |
|
56 | + $table->addColumn('id', Types::BIGINT, [ |
|
57 | + 'autoincrement' => true, |
|
58 | + 'notnull' => true, |
|
59 | + 'length' => 11, |
|
60 | + 'unsigned' => true, |
|
61 | + ]); |
|
62 | + $table->addColumn($type . '_id', Types::BIGINT, [ |
|
63 | + 'notnull' => true, |
|
64 | + 'length' => 11, |
|
65 | + 'unsigned' => true, |
|
66 | + ]); |
|
67 | + $table->addColumn('key', Types::STRING, [ |
|
68 | + 'notnull' => true, |
|
69 | + 'length' => 255, |
|
70 | + ]); |
|
71 | + $table->addColumn('value', Types::STRING, [ |
|
72 | + 'notnull' => false, |
|
73 | + 'length' => 4000, |
|
74 | + ]); |
|
75 | 75 | |
76 | - $table->setPrimaryKey(['id']); |
|
77 | - $table->addIndex([$type . '_id', 'key'], $this->getMetadataTableName($type) . '_idk'); |
|
78 | - } |
|
79 | - } |
|
76 | + $table->setPrimaryKey(['id']); |
|
77 | + $table->addIndex([$type . '_id', 'key'], $this->getMetadataTableName($type) . '_idk'); |
|
78 | + } |
|
79 | + } |
|
80 | 80 | |
81 | - return $schema; |
|
82 | - } |
|
81 | + return $schema; |
|
82 | + } |
|
83 | 83 | |
84 | - /** |
|
85 | - * @param string $type |
|
86 | - * @return string |
|
87 | - */ |
|
88 | - private function getMetadataTableName(string $type):string { |
|
89 | - return 'calendar_' . $type . 's_md'; |
|
90 | - } |
|
84 | + /** |
|
85 | + * @param string $type |
|
86 | + * @return string |
|
87 | + */ |
|
88 | + private function getMetadataTableName(string $type):string { |
|
89 | + return 'calendar_' . $type . 's_md'; |
|
90 | + } |
|
91 | 91 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | 'length' => 11, |
60 | 60 | 'unsigned' => true, |
61 | 61 | ]); |
62 | - $table->addColumn($type . '_id', Types::BIGINT, [ |
|
62 | + $table->addColumn($type.'_id', Types::BIGINT, [ |
|
63 | 63 | 'notnull' => true, |
64 | 64 | 'length' => 11, |
65 | 65 | 'unsigned' => true, |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | ]); |
75 | 75 | |
76 | 76 | $table->setPrimaryKey(['id']); |
77 | - $table->addIndex([$type . '_id', 'key'], $this->getMetadataTableName($type) . '_idk'); |
|
77 | + $table->addIndex([$type.'_id', 'key'], $this->getMetadataTableName($type).'_idk'); |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
@@ -86,6 +86,6 @@ discard block |
||
86 | 86 | * @return string |
87 | 87 | */ |
88 | 88 | private function getMetadataTableName(string $type):string { |
89 | - return 'calendar_' . $type . 's_md'; |
|
89 | + return 'calendar_'.$type.'s_md'; |
|
90 | 90 | } |
91 | 91 | } |
@@ -43,7 +43,7 @@ |
||
43 | 43 | |
44 | 44 | public function injectFn(callable $fn) { |
45 | 45 | $reflected = new ReflectionFunction(Closure::fromCallable($fn)); |
46 | - return $fn(...array_map(function (ReflectionParameter $param) { |
|
46 | + return $fn(...array_map(function(ReflectionParameter $param) { |
|
47 | 47 | // First we try by type (more likely these days) |
48 | 48 | if (($type = $param->getType()) !== null) { |
49 | 49 | try { |
@@ -33,36 +33,36 @@ |
||
33 | 33 | use function array_map; |
34 | 34 | |
35 | 35 | class FunctionInjector { |
36 | - /** @var ContainerInterface */ |
|
37 | - private $container; |
|
36 | + /** @var ContainerInterface */ |
|
37 | + private $container; |
|
38 | 38 | |
39 | - public function __construct(ContainerInterface $container) { |
|
40 | - $this->container = $container; |
|
41 | - } |
|
39 | + public function __construct(ContainerInterface $container) { |
|
40 | + $this->container = $container; |
|
41 | + } |
|
42 | 42 | |
43 | - public function injectFn(callable $fn) { |
|
44 | - $reflected = new ReflectionFunction(Closure::fromCallable($fn)); |
|
45 | - return $fn(...array_map(function (ReflectionParameter $param) { |
|
46 | - // First we try by type (more likely these days) |
|
47 | - if (($type = $param->getType()) !== null) { |
|
48 | - try { |
|
49 | - return $this->container->get($type->getName()); |
|
50 | - } catch (QueryException $ex) { |
|
51 | - // Ignore and try name as well |
|
52 | - } |
|
53 | - } |
|
54 | - // Second we try by name (mostly for primitives) |
|
55 | - try { |
|
56 | - return $this->container->get($param->getName()); |
|
57 | - } catch (QueryException $ex) { |
|
58 | - // As a last resort we pass `null` if allowed |
|
59 | - if ($type !== null && $type->allowsNull()) { |
|
60 | - return null; |
|
61 | - } |
|
43 | + public function injectFn(callable $fn) { |
|
44 | + $reflected = new ReflectionFunction(Closure::fromCallable($fn)); |
|
45 | + return $fn(...array_map(function (ReflectionParameter $param) { |
|
46 | + // First we try by type (more likely these days) |
|
47 | + if (($type = $param->getType()) !== null) { |
|
48 | + try { |
|
49 | + return $this->container->get($type->getName()); |
|
50 | + } catch (QueryException $ex) { |
|
51 | + // Ignore and try name as well |
|
52 | + } |
|
53 | + } |
|
54 | + // Second we try by name (mostly for primitives) |
|
55 | + try { |
|
56 | + return $this->container->get($param->getName()); |
|
57 | + } catch (QueryException $ex) { |
|
58 | + // As a last resort we pass `null` if allowed |
|
59 | + if ($type !== null && $type->allowsNull()) { |
|
60 | + return null; |
|
61 | + } |
|
62 | 62 | |
63 | - // Nothing worked, time to bail out |
|
64 | - throw $ex; |
|
65 | - } |
|
66 | - }, $reflected->getParameters())); |
|
67 | - } |
|
63 | + // Nothing worked, time to bail out |
|
64 | + throw $ex; |
|
65 | + } |
|
66 | + }, $reflected->getParameters())); |
|
67 | + } |
|
68 | 68 | } |
@@ -60,11 +60,11 @@ |
||
60 | 60 | if ($readablePath) { |
61 | 61 | $message = "\"$path\"(\"$readablePath\") is locked"; |
62 | 62 | } else { |
63 | - $message = '"' . $path . '" is locked'; |
|
63 | + $message = '"'.$path.'" is locked'; |
|
64 | 64 | } |
65 | 65 | $this->existingLock = $existingLock; |
66 | 66 | if ($existingLock) { |
67 | - $message .= ', existing lock on file: ' . $existingLock; |
|
67 | + $message .= ', existing lock on file: '.$existingLock; |
|
68 | 68 | } |
69 | 69 | parent::__construct($message, 0, $previous); |
70 | 70 | $this->path = $path; |
@@ -14,64 +14,64 @@ |
||
14 | 14 | * @since 8.1.0 |
15 | 15 | */ |
16 | 16 | class LockedException extends \Exception { |
17 | - /** |
|
18 | - * Locked path |
|
19 | - * |
|
20 | - * @var string |
|
21 | - */ |
|
22 | - private $path; |
|
17 | + /** |
|
18 | + * Locked path |
|
19 | + * |
|
20 | + * @var string |
|
21 | + */ |
|
22 | + private $path; |
|
23 | 23 | |
24 | - /** @var string|null */ |
|
25 | - private $existingLock; |
|
24 | + /** @var string|null */ |
|
25 | + private $existingLock; |
|
26 | 26 | |
27 | - private ?string $readablePath; |
|
27 | + private ?string $readablePath; |
|
28 | 28 | |
29 | - /** |
|
30 | - * LockedException constructor. |
|
31 | - * |
|
32 | - * @param string $path locked path |
|
33 | - * @param \Exception|null $previous previous exception for cascading |
|
34 | - * @param string $existingLock since 14.0.0 |
|
35 | - * @param string $readablePath since 20.0.0 |
|
36 | - * @since 8.1.0 |
|
37 | - */ |
|
38 | - public function __construct(string $path, ?\Exception $previous = null, ?string $existingLock = null, ?string $readablePath = null) { |
|
39 | - $this->readablePath = $readablePath; |
|
40 | - if ($readablePath) { |
|
41 | - $message = "\"$path\"(\"$readablePath\") is locked"; |
|
42 | - } else { |
|
43 | - $message = '"' . $path . '" is locked'; |
|
44 | - } |
|
45 | - $this->existingLock = $existingLock; |
|
46 | - if ($existingLock) { |
|
47 | - $message .= ', existing lock on file: ' . $existingLock; |
|
48 | - } |
|
49 | - parent::__construct($message, 0, $previous); |
|
50 | - $this->path = $path; |
|
51 | - } |
|
29 | + /** |
|
30 | + * LockedException constructor. |
|
31 | + * |
|
32 | + * @param string $path locked path |
|
33 | + * @param \Exception|null $previous previous exception for cascading |
|
34 | + * @param string $existingLock since 14.0.0 |
|
35 | + * @param string $readablePath since 20.0.0 |
|
36 | + * @since 8.1.0 |
|
37 | + */ |
|
38 | + public function __construct(string $path, ?\Exception $previous = null, ?string $existingLock = null, ?string $readablePath = null) { |
|
39 | + $this->readablePath = $readablePath; |
|
40 | + if ($readablePath) { |
|
41 | + $message = "\"$path\"(\"$readablePath\") is locked"; |
|
42 | + } else { |
|
43 | + $message = '"' . $path . '" is locked'; |
|
44 | + } |
|
45 | + $this->existingLock = $existingLock; |
|
46 | + if ($existingLock) { |
|
47 | + $message .= ', existing lock on file: ' . $existingLock; |
|
48 | + } |
|
49 | + parent::__construct($message, 0, $previous); |
|
50 | + $this->path = $path; |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * @return string |
|
55 | - * @since 8.1.0 |
|
56 | - */ |
|
57 | - public function getPath(): string { |
|
58 | - return $this->path; |
|
59 | - } |
|
53 | + /** |
|
54 | + * @return string |
|
55 | + * @since 8.1.0 |
|
56 | + */ |
|
57 | + public function getPath(): string { |
|
58 | + return $this->path; |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * @return string |
|
63 | - * @since 19.0.0 |
|
64 | - */ |
|
65 | - public function getExistingLock(): ?string { |
|
66 | - return $this->existingLock; |
|
67 | - } |
|
61 | + /** |
|
62 | + * @return string |
|
63 | + * @since 19.0.0 |
|
64 | + */ |
|
65 | + public function getExistingLock(): ?string { |
|
66 | + return $this->existingLock; |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * @return ?string |
|
71 | - * @since 32.0.0 |
|
72 | - */ |
|
73 | - public function getReadablePath(): ?string { |
|
74 | - return $this->readablePath; |
|
75 | - } |
|
69 | + /** |
|
70 | + * @return ?string |
|
71 | + * @since 32.0.0 |
|
72 | + */ |
|
73 | + public function getReadablePath(): ?string { |
|
74 | + return $this->readablePath; |
|
75 | + } |
|
76 | 76 | |
77 | 77 | } |
@@ -35,16 +35,16 @@ |
||
35 | 35 | use OCP\AppFramework\Bootstrap\IRegistrationContext; |
36 | 36 | |
37 | 37 | class Application extends App implements IBootstrap { |
38 | - public const APP_ID = 'sharebymail'; |
|
38 | + public const APP_ID = 'sharebymail'; |
|
39 | 39 | |
40 | - public function __construct() { |
|
41 | - parent::__construct(self::APP_ID); |
|
42 | - } |
|
40 | + public function __construct() { |
|
41 | + parent::__construct(self::APP_ID); |
|
42 | + } |
|
43 | 43 | |
44 | - public function register(IRegistrationContext $context): void { |
|
45 | - $context->registerCapability(Capabilities::class); |
|
46 | - } |
|
44 | + public function register(IRegistrationContext $context): void { |
|
45 | + $context->registerCapability(Capabilities::class); |
|
46 | + } |
|
47 | 47 | |
48 | - public function boot(IBootContext $context): void { |
|
49 | - } |
|
48 | + public function boot(IBootContext $context): void { |
|
49 | + } |
|
50 | 50 | } |