@@ -33,30 +33,30 @@ |
||
33 | 33 | |
34 | 34 | class Version1000Date20201111130204 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 | - /** @var ISchemaWrapper $schema */ |
|
44 | - $schema = $schemaClosure(); |
|
45 | - |
|
46 | - $result = $this->ensureColumnIsNullable($schema, 'user_status', 'is_user_defined'); |
|
47 | - |
|
48 | - return $result ? $schema : null; |
|
49 | - } |
|
50 | - |
|
51 | - protected function ensureColumnIsNullable(ISchemaWrapper $schema, string $tableName, string $columnName): bool { |
|
52 | - $table = $schema->getTable($tableName); |
|
53 | - $column = $table->getColumn($columnName); |
|
54 | - |
|
55 | - if ($column->getNotnull()) { |
|
56 | - $column->setNotnull(false); |
|
57 | - return true; |
|
58 | - } |
|
59 | - |
|
60 | - return false; |
|
61 | - } |
|
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 | + /** @var ISchemaWrapper $schema */ |
|
44 | + $schema = $schemaClosure(); |
|
45 | + |
|
46 | + $result = $this->ensureColumnIsNullable($schema, 'user_status', 'is_user_defined'); |
|
47 | + |
|
48 | + return $result ? $schema : null; |
|
49 | + } |
|
50 | + |
|
51 | + protected function ensureColumnIsNullable(ISchemaWrapper $schema, string $tableName, string $columnName): bool { |
|
52 | + $table = $schema->getTable($tableName); |
|
53 | + $column = $table->getColumn($columnName); |
|
54 | + |
|
55 | + if ($column->getNotnull()) { |
|
56 | + $column->setNotnull(false); |
|
57 | + return true; |
|
58 | + } |
|
59 | + |
|
60 | + return false; |
|
61 | + } |
|
62 | 62 | } |
@@ -32,44 +32,44 @@ |
||
32 | 32 | use OCP\Migration\SimpleMigrationStep; |
33 | 33 | |
34 | 34 | class Version21000Date20201202095923 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 | - if (!$schema->hasTable('accounts_data')) { |
|
46 | - $table = $schema->createTable('accounts_data'); |
|
47 | - $table->addColumn('id', Types::BIGINT, [ |
|
48 | - 'autoincrement' => true, |
|
49 | - 'notnull' => true, |
|
50 | - 'length' => 20, |
|
51 | - ]); |
|
52 | - $table->addColumn('uid', Types::STRING, [ |
|
53 | - 'notnull' => true, |
|
54 | - 'length' => 64, |
|
55 | - ]); |
|
56 | - $table->addColumn('name', Types::STRING, [ |
|
57 | - 'notnull' => true, |
|
58 | - 'length' => 64, |
|
59 | - ]); |
|
60 | - $table->addColumn('value', Types::STRING, [ |
|
61 | - 'notnull' => false, |
|
62 | - 'length' => 255, |
|
63 | - 'default' => '', |
|
64 | - ]); |
|
65 | - $table->setPrimaryKey(['id']); |
|
66 | - $table->addIndex(['uid'], 'accounts_data_uid'); |
|
67 | - $table->addIndex(['name'], 'accounts_data_name'); |
|
68 | - $table->addIndex(['value'], 'accounts_data_value'); |
|
45 | + if (!$schema->hasTable('accounts_data')) { |
|
46 | + $table = $schema->createTable('accounts_data'); |
|
47 | + $table->addColumn('id', Types::BIGINT, [ |
|
48 | + 'autoincrement' => true, |
|
49 | + 'notnull' => true, |
|
50 | + 'length' => 20, |
|
51 | + ]); |
|
52 | + $table->addColumn('uid', Types::STRING, [ |
|
53 | + 'notnull' => true, |
|
54 | + 'length' => 64, |
|
55 | + ]); |
|
56 | + $table->addColumn('name', Types::STRING, [ |
|
57 | + 'notnull' => true, |
|
58 | + 'length' => 64, |
|
59 | + ]); |
|
60 | + $table->addColumn('value', Types::STRING, [ |
|
61 | + 'notnull' => false, |
|
62 | + 'length' => 255, |
|
63 | + 'default' => '', |
|
64 | + ]); |
|
65 | + $table->setPrimaryKey(['id']); |
|
66 | + $table->addIndex(['uid'], 'accounts_data_uid'); |
|
67 | + $table->addIndex(['name'], 'accounts_data_name'); |
|
68 | + $table->addIndex(['value'], 'accounts_data_value'); |
|
69 | 69 | |
70 | - return $schema; |
|
71 | - } |
|
70 | + return $schema; |
|
71 | + } |
|
72 | 72 | |
73 | - return null; |
|
74 | - } |
|
73 | + return null; |
|
74 | + } |
|
75 | 75 | } |
@@ -33,55 +33,55 @@ |
||
33 | 33 | use OCP\Migration\SimpleMigrationStep; |
34 | 34 | |
35 | 35 | class Version1010Date20200630192639 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('files_trash')) { |
|
47 | - $table = $schema->createTable('files_trash'); |
|
48 | - $table->addColumn('auto_id', Types::BIGINT, [ |
|
49 | - 'autoincrement' => true, |
|
50 | - 'notnull' => true, |
|
51 | - ]); |
|
52 | - $table->addColumn('id', Types::STRING, [ |
|
53 | - 'notnull' => true, |
|
54 | - 'length' => 250, |
|
55 | - 'default' => '', |
|
56 | - ]); |
|
57 | - $table->addColumn('user', Types::STRING, [ |
|
58 | - 'notnull' => true, |
|
59 | - 'length' => 64, |
|
60 | - 'default' => '', |
|
61 | - ]); |
|
62 | - $table->addColumn('timestamp', Types::STRING, [ |
|
63 | - 'notnull' => true, |
|
64 | - 'length' => 12, |
|
65 | - 'default' => '', |
|
66 | - ]); |
|
67 | - $table->addColumn('location', Types::STRING, [ |
|
68 | - 'notnull' => true, |
|
69 | - 'length' => 512, |
|
70 | - 'default' => '', |
|
71 | - ]); |
|
72 | - $table->addColumn('type', Types::STRING, [ |
|
73 | - 'notnull' => false, |
|
74 | - 'length' => 4, |
|
75 | - ]); |
|
76 | - $table->addColumn('mime', Types::STRING, [ |
|
77 | - 'notnull' => false, |
|
78 | - 'length' => 255, |
|
79 | - ]); |
|
80 | - $table->setPrimaryKey(['auto_id']); |
|
81 | - $table->addIndex(['id'], 'id_index'); |
|
82 | - $table->addIndex(['timestamp'], 'timestamp_index'); |
|
83 | - $table->addIndex(['user'], 'user_index'); |
|
84 | - } |
|
85 | - return $schema; |
|
86 | - } |
|
46 | + if (!$schema->hasTable('files_trash')) { |
|
47 | + $table = $schema->createTable('files_trash'); |
|
48 | + $table->addColumn('auto_id', Types::BIGINT, [ |
|
49 | + 'autoincrement' => true, |
|
50 | + 'notnull' => true, |
|
51 | + ]); |
|
52 | + $table->addColumn('id', Types::STRING, [ |
|
53 | + 'notnull' => true, |
|
54 | + 'length' => 250, |
|
55 | + 'default' => '', |
|
56 | + ]); |
|
57 | + $table->addColumn('user', Types::STRING, [ |
|
58 | + 'notnull' => true, |
|
59 | + 'length' => 64, |
|
60 | + 'default' => '', |
|
61 | + ]); |
|
62 | + $table->addColumn('timestamp', Types::STRING, [ |
|
63 | + 'notnull' => true, |
|
64 | + 'length' => 12, |
|
65 | + 'default' => '', |
|
66 | + ]); |
|
67 | + $table->addColumn('location', Types::STRING, [ |
|
68 | + 'notnull' => true, |
|
69 | + 'length' => 512, |
|
70 | + 'default' => '', |
|
71 | + ]); |
|
72 | + $table->addColumn('type', Types::STRING, [ |
|
73 | + 'notnull' => false, |
|
74 | + 'length' => 4, |
|
75 | + ]); |
|
76 | + $table->addColumn('mime', Types::STRING, [ |
|
77 | + 'notnull' => false, |
|
78 | + 'length' => 255, |
|
79 | + ]); |
|
80 | + $table->setPrimaryKey(['auto_id']); |
|
81 | + $table->addIndex(['id'], 'id_index'); |
|
82 | + $table->addIndex(['timestamp'], 'timestamp_index'); |
|
83 | + $table->addIndex(['user'], 'user_index'); |
|
84 | + } |
|
85 | + return $schema; |
|
86 | + } |
|
87 | 87 | } |
@@ -34,37 +34,37 @@ |
||
34 | 34 | use OCP\Migration\SimpleMigrationStep; |
35 | 35 | |
36 | 36 | class Version21000Date20201223143245 extends SimpleMigrationStep { |
37 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
38 | - /** @var ISchemaWrapper $schema */ |
|
39 | - $schema = $schemaClosure(); |
|
37 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
38 | + /** @var ISchemaWrapper $schema */ |
|
39 | + $schema = $schemaClosure(); |
|
40 | 40 | |
41 | - if ($schema->hasTable('share_external')) { |
|
42 | - $table = $schema->getTable('share_external'); |
|
43 | - $changed = false; |
|
44 | - if (!$table->hasColumn('parent')) { |
|
45 | - $table->addColumn('parent', Types::BIGINT, [ |
|
46 | - 'notnull' => false, |
|
47 | - 'default' => -1, |
|
48 | - ]); |
|
49 | - $changed = true; |
|
50 | - } |
|
51 | - if (!$table->hasColumn('share_type')) { |
|
52 | - $table->addColumn('share_type', Types::INTEGER, [ |
|
53 | - 'notnull' => false, |
|
54 | - 'length' => 4, |
|
55 | - ]); |
|
56 | - $changed = true; |
|
57 | - } |
|
58 | - if ($table->hasColumn('lastscan')) { |
|
59 | - $table->dropColumn('lastscan'); |
|
60 | - $changed = true; |
|
61 | - } |
|
41 | + if ($schema->hasTable('share_external')) { |
|
42 | + $table = $schema->getTable('share_external'); |
|
43 | + $changed = false; |
|
44 | + if (!$table->hasColumn('parent')) { |
|
45 | + $table->addColumn('parent', Types::BIGINT, [ |
|
46 | + 'notnull' => false, |
|
47 | + 'default' => -1, |
|
48 | + ]); |
|
49 | + $changed = true; |
|
50 | + } |
|
51 | + if (!$table->hasColumn('share_type')) { |
|
52 | + $table->addColumn('share_type', Types::INTEGER, [ |
|
53 | + 'notnull' => false, |
|
54 | + 'length' => 4, |
|
55 | + ]); |
|
56 | + $changed = true; |
|
57 | + } |
|
58 | + if ($table->hasColumn('lastscan')) { |
|
59 | + $table->dropColumn('lastscan'); |
|
60 | + $changed = true; |
|
61 | + } |
|
62 | 62 | |
63 | - if ($changed) { |
|
64 | - return $schema; |
|
65 | - } |
|
66 | - } |
|
63 | + if ($changed) { |
|
64 | + return $schema; |
|
65 | + } |
|
66 | + } |
|
67 | 67 | |
68 | - return null; |
|
69 | - } |
|
68 | + return null; |
|
69 | + } |
|
70 | 70 | } |
@@ -31,42 +31,42 @@ |
||
31 | 31 | use Doctrine\DBAL\Events; |
32 | 32 | |
33 | 33 | class SQLiteSessionInit implements EventSubscriber { |
34 | - /** |
|
35 | - * @var bool |
|
36 | - */ |
|
37 | - private $caseSensitiveLike; |
|
34 | + /** |
|
35 | + * @var bool |
|
36 | + */ |
|
37 | + private $caseSensitiveLike; |
|
38 | 38 | |
39 | - /** |
|
40 | - * @var string |
|
41 | - */ |
|
42 | - private $journalMode; |
|
39 | + /** |
|
40 | + * @var string |
|
41 | + */ |
|
42 | + private $journalMode; |
|
43 | 43 | |
44 | - /** |
|
45 | - * Configure case sensitive like for each connection |
|
46 | - * |
|
47 | - * @param bool $caseSensitiveLike |
|
48 | - * @param string $journalMode |
|
49 | - */ |
|
50 | - public function __construct($caseSensitiveLike, $journalMode) { |
|
51 | - $this->caseSensitiveLike = $caseSensitiveLike; |
|
52 | - $this->journalMode = $journalMode; |
|
53 | - } |
|
44 | + /** |
|
45 | + * Configure case sensitive like for each connection |
|
46 | + * |
|
47 | + * @param bool $caseSensitiveLike |
|
48 | + * @param string $journalMode |
|
49 | + */ |
|
50 | + public function __construct($caseSensitiveLike, $journalMode) { |
|
51 | + $this->caseSensitiveLike = $caseSensitiveLike; |
|
52 | + $this->journalMode = $journalMode; |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * @param ConnectionEventArgs $args |
|
57 | - * @return void |
|
58 | - */ |
|
59 | - public function postConnect(ConnectionEventArgs $args) { |
|
60 | - $sensitive = $this->caseSensitiveLike ? 'true' : 'false'; |
|
61 | - $args->getConnection()->executeUpdate('PRAGMA case_sensitive_like = ' . $sensitive); |
|
62 | - $args->getConnection()->executeUpdate('PRAGMA journal_mode = ' . $this->journalMode); |
|
63 | - /** @var \Doctrine\DBAL\Driver\PDO\Connection $connection */ |
|
64 | - $connection = $args->getConnection()->getWrappedConnection(); |
|
65 | - $pdo = $connection->getWrappedConnection(); |
|
66 | - $pdo->sqliteCreateFunction('md5', 'md5', 1); |
|
67 | - } |
|
55 | + /** |
|
56 | + * @param ConnectionEventArgs $args |
|
57 | + * @return void |
|
58 | + */ |
|
59 | + public function postConnect(ConnectionEventArgs $args) { |
|
60 | + $sensitive = $this->caseSensitiveLike ? 'true' : 'false'; |
|
61 | + $args->getConnection()->executeUpdate('PRAGMA case_sensitive_like = ' . $sensitive); |
|
62 | + $args->getConnection()->executeUpdate('PRAGMA journal_mode = ' . $this->journalMode); |
|
63 | + /** @var \Doctrine\DBAL\Driver\PDO\Connection $connection */ |
|
64 | + $connection = $args->getConnection()->getWrappedConnection(); |
|
65 | + $pdo = $connection->getWrappedConnection(); |
|
66 | + $pdo->sqliteCreateFunction('md5', 'md5', 1); |
|
67 | + } |
|
68 | 68 | |
69 | - public function getSubscribedEvents() { |
|
70 | - return [Events::postConnect]; |
|
71 | - } |
|
69 | + public function getSubscribedEvents() { |
|
70 | + return [Events::postConnect]; |
|
71 | + } |
|
72 | 72 | } |
@@ -35,21 +35,21 @@ |
||
35 | 35 | * Auto-generated migration step: Please modify to your needs! |
36 | 36 | */ |
37 | 37 | class Version21000Date20210119195004 extends SimpleMigrationStep { |
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 | - $table = $schema->getTable('authtoken'); |
|
49 | - if ($table->hasIndex('authtoken_version_index')) { |
|
50 | - $table->dropIndex('authtoken_version_index'); |
|
51 | - } |
|
48 | + $table = $schema->getTable('authtoken'); |
|
49 | + if ($table->hasIndex('authtoken_version_index')) { |
|
50 | + $table->dropIndex('authtoken_version_index'); |
|
51 | + } |
|
52 | 52 | |
53 | - return $schema; |
|
54 | - } |
|
53 | + return $schema; |
|
54 | + } |
|
55 | 55 | } |
@@ -31,24 +31,24 @@ |
||
31 | 31 | use OCP\Migration\SimpleMigrationStep; |
32 | 32 | |
33 | 33 | class Version14000Date20180518120534 extends SimpleMigrationStep { |
34 | - public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
35 | - /** @var ISchemaWrapper $schema */ |
|
36 | - $schema = $schemaClosure(); |
|
34 | + public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
35 | + /** @var ISchemaWrapper $schema */ |
|
36 | + $schema = $schemaClosure(); |
|
37 | 37 | |
38 | - $table = $schema->getTable('authtoken'); |
|
39 | - $table->addColumn('private_key', 'text', [ |
|
40 | - 'notnull' => false, |
|
41 | - ]); |
|
42 | - $table->addColumn('public_key', 'text', [ |
|
43 | - 'notnull' => false, |
|
44 | - ]); |
|
45 | - $table->addColumn('version', 'smallint', [ |
|
46 | - 'notnull' => true, |
|
47 | - 'default' => 1, |
|
48 | - 'unsigned' => true, |
|
49 | - ]); |
|
50 | - $table->addIndex(['uid'], 'authtoken_uid_index'); |
|
38 | + $table = $schema->getTable('authtoken'); |
|
39 | + $table->addColumn('private_key', 'text', [ |
|
40 | + 'notnull' => false, |
|
41 | + ]); |
|
42 | + $table->addColumn('public_key', 'text', [ |
|
43 | + 'notnull' => false, |
|
44 | + ]); |
|
45 | + $table->addColumn('version', 'smallint', [ |
|
46 | + 'notnull' => true, |
|
47 | + 'default' => 1, |
|
48 | + 'unsigned' => true, |
|
49 | + ]); |
|
50 | + $table->addIndex(['uid'], 'authtoken_uid_index'); |
|
51 | 51 | |
52 | - return $schema; |
|
53 | - } |
|
52 | + return $schema; |
|
53 | + } |
|
54 | 54 | } |
@@ -30,24 +30,24 @@ |
||
30 | 30 | * @template T |
31 | 31 | */ |
32 | 32 | class ServiceRegistration extends ARegistration { |
33 | - /** |
|
34 | - * @var string |
|
35 | - * @psalm-var class-string<T> |
|
36 | - */ |
|
37 | - private $service; |
|
33 | + /** |
|
34 | + * @var string |
|
35 | + * @psalm-var class-string<T> |
|
36 | + */ |
|
37 | + private $service; |
|
38 | 38 | |
39 | - /** |
|
40 | - * @psalm-param class-string<T> $service |
|
41 | - */ |
|
42 | - public function __construct(string $appId, string $service) { |
|
43 | - parent::__construct($appId); |
|
44 | - $this->service = $service; |
|
45 | - } |
|
39 | + /** |
|
40 | + * @psalm-param class-string<T> $service |
|
41 | + */ |
|
42 | + public function __construct(string $appId, string $service) { |
|
43 | + parent::__construct($appId); |
|
44 | + $this->service = $service; |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * @psalm-return class-string<T> |
|
49 | - */ |
|
50 | - public function getService(): string { |
|
51 | - return $this->service; |
|
52 | - } |
|
47 | + /** |
|
48 | + * @psalm-return class-string<T> |
|
49 | + */ |
|
50 | + public function getService(): string { |
|
51 | + return $this->service; |
|
52 | + } |
|
53 | 53 | } |
@@ -29,14 +29,14 @@ |
||
29 | 29 | use OCP\Files\FileInfo; |
30 | 30 | |
31 | 31 | class WebP extends Image { |
32 | - /** |
|
33 | - * {@inheritDoc} |
|
34 | - */ |
|
35 | - public function getMimeType(): string { |
|
36 | - return '/image\/webp/'; |
|
37 | - } |
|
32 | + /** |
|
33 | + * {@inheritDoc} |
|
34 | + */ |
|
35 | + public function getMimeType(): string { |
|
36 | + return '/image\/webp/'; |
|
37 | + } |
|
38 | 38 | |
39 | - public function isAvailable(FileInfo $file): bool { |
|
40 | - return (bool)(imagetypes() & IMG_WEBP); |
|
41 | - } |
|
39 | + public function isAvailable(FileInfo $file): bool { |
|
40 | + return (bool)(imagetypes() & IMG_WEBP); |
|
41 | + } |
|
42 | 42 | } |