aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib/Migration
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/lib/Migration')
-rw-r--r--apps/files_sharing/lib/Migration/OwncloudGuestShareType.php19
-rw-r--r--apps/files_sharing/lib/Migration/SetAcceptedStatus.php16
-rw-r--r--apps/files_sharing/lib/Migration/SetPasswordColumn.php15
-rw-r--r--apps/files_sharing/lib/Migration/Version11300Date20201120141438.php8
-rw-r--r--apps/files_sharing/lib/Migration/Version31000Date20240821142813.php43
5 files changed, 63 insertions, 38 deletions
diff --git a/apps/files_sharing/lib/Migration/OwncloudGuestShareType.php b/apps/files_sharing/lib/Migration/OwncloudGuestShareType.php
index 23a2ded0968..3718306e380 100644
--- a/apps/files_sharing/lib/Migration/OwncloudGuestShareType.php
+++ b/apps/files_sharing/lib/Migration/OwncloudGuestShareType.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@@ -18,16 +19,10 @@ use OCP\Share\IShare;
*/
class OwncloudGuestShareType implements IRepairStep {
- /** @var IDBConnection */
- private $connection;
-
- /** @var IConfig */
- private $config;
-
-
- public function __construct(IDBConnection $connection, IConfig $config) {
- $this->connection = $connection;
- $this->config = $config;
+ public function __construct(
+ private IDBConnection $connection,
+ private IConfig $config,
+ ) {
}
/**
@@ -57,7 +52,7 @@ class OwncloudGuestShareType implements IRepairStep {
protected function shouldRun() {
$appVersion = $this->config->getAppValue('files_sharing', 'installed_version', '0.0.0');
- return $appVersion === '0.10.0' ||
- $this->config->getAppValue('core', 'vendor', '') === 'owncloud';
+ return $appVersion === '0.10.0'
+ || $this->config->getAppValue('core', 'vendor', '') === 'owncloud';
}
}
diff --git a/apps/files_sharing/lib/Migration/SetAcceptedStatus.php b/apps/files_sharing/lib/Migration/SetAcceptedStatus.php
index d54c22d3d7d..4da6aad4b33 100644
--- a/apps/files_sharing/lib/Migration/SetAcceptedStatus.php
+++ b/apps/files_sharing/lib/Migration/SetAcceptedStatus.php
@@ -17,16 +17,10 @@ use OCP\Share\IShare;
class SetAcceptedStatus implements IRepairStep {
- /** @var IDBConnection */
- private $connection;
-
- /** @var IConfig */
- private $config;
-
-
- public function __construct(IDBConnection $connection, IConfig $config) {
- $this->connection = $connection;
- $this->config = $config;
+ public function __construct(
+ private IDBConnection $connection,
+ private IConfig $config,
+ ) {
}
/**
@@ -52,7 +46,7 @@ class SetAcceptedStatus implements IRepairStep {
->update('share')
->set('accepted', $query->createNamedParameter(IShare::STATUS_ACCEPTED))
->where($query->expr()->in('share_type', $query->createNamedParameter([IShare::TYPE_USER, IShare::TYPE_GROUP, IShare::TYPE_USERGROUP], IQueryBuilder::PARAM_INT_ARRAY)));
- $query->execute();
+ $query->executeStatement();
}
protected function shouldRun() {
diff --git a/apps/files_sharing/lib/Migration/SetPasswordColumn.php b/apps/files_sharing/lib/Migration/SetPasswordColumn.php
index 0ce1e276566..f60af2817d4 100644
--- a/apps/files_sharing/lib/Migration/SetPasswordColumn.php
+++ b/apps/files_sharing/lib/Migration/SetPasswordColumn.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@@ -18,16 +19,10 @@ use OCP\Share\IShare;
*/
class SetPasswordColumn implements IRepairStep {
- /** @var IDBConnection */
- private $connection;
-
- /** @var IConfig */
- private $config;
-
-
- public function __construct(IDBConnection $connection, IConfig $config) {
- $this->connection = $connection;
- $this->config = $config;
+ public function __construct(
+ private IDBConnection $connection,
+ private IConfig $config,
+ ) {
}
/**
diff --git a/apps/files_sharing/lib/Migration/Version11300Date20201120141438.php b/apps/files_sharing/lib/Migration/Version11300Date20201120141438.php
index 21dbb64fef0..c9fe840d422 100644
--- a/apps/files_sharing/lib/Migration/Version11300Date20201120141438.php
+++ b/apps/files_sharing/lib/Migration/Version11300Date20201120141438.php
@@ -18,11 +18,9 @@ use OCP\Migration\SimpleMigrationStep;
class Version11300Date20201120141438 extends SimpleMigrationStep {
- /** @var IDBConnection */
- private $connection;
-
- public function __construct(IDBConnection $connection) {
- $this->connection = $connection;
+ public function __construct(
+ private IDBConnection $connection,
+ ) {
}
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
diff --git a/apps/files_sharing/lib/Migration/Version31000Date20240821142813.php b/apps/files_sharing/lib/Migration/Version31000Date20240821142813.php
new file mode 100644
index 00000000000..71b2c1817e6
--- /dev/null
+++ b/apps/files_sharing/lib/Migration/Version31000Date20240821142813.php
@@ -0,0 +1,43 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace OCA\Files_Sharing\Migration;
+
+use Closure;
+use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
+use OCP\Migration\Attributes\AddColumn;
+use OCP\Migration\Attributes\ColumnType;
+use OCP\Migration\IOutput;
+use OCP\Migration\SimpleMigrationStep;
+
+#[AddColumn(table: 'share', name: 'reminder_sent', type: ColumnType::BOOLEAN)]
+class Version31000Date20240821142813 extends SimpleMigrationStep {
+
+ /**
+ * @param IOutput $output
+ * @param Closure(): ISchemaWrapper $schemaClosure
+ * @param array $options
+ * @return null|ISchemaWrapper
+ */
+ public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
+ $schema = $schemaClosure();
+ $table = $schema->getTable('share');
+ if ($table->hasColumn('reminder_sent')) {
+ return null;
+ }
+
+ $table->addColumn('reminder_sent', Types::BOOLEAN, [
+ 'notnull' => false,
+ 'default' => false,
+ ]);
+ return $schema;
+ }
+
+}