From 7435087d9602587ab5818108fc0445af1ff6d90e Mon Sep 17 00:00:00 2001 From: unteem Date: Wed, 21 Jun 2023 12:00:49 +0200 Subject: [PATCH 1/5] fix: patch postgresqlMigrator --- base/0001-fixed-quotes.patch | 26 ++++++++++++++++++++++++++ base/Dockerfile | 2 ++ 2 files changed, 28 insertions(+) create mode 100644 base/0001-fixed-quotes.patch diff --git a/base/0001-fixed-quotes.patch b/base/0001-fixed-quotes.patch new file mode 100644 index 0000000..ef55690 --- /dev/null +++ b/base/0001-fixed-quotes.patch @@ -0,0 +1,26 @@ +From 2211721c2bacb1c7b45a56cd8d3cd0020220ea71 Mon Sep 17 00:00:00 2001 +From: dartcafe +Date: Tue, 20 Jun 2023 18:32:49 +0200 +Subject: [PATCH] fixed quotes + +Signed-off-by: dartcafe +--- + lib/private/DB/PostgreSqlMigrator.php | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/private/DB/PostgreSqlMigrator.php b/lib/private/DB/PostgreSqlMigrator.php +index ec153658735..92a0842e1a7 100644 +--- a/lib/private/DB/PostgreSqlMigrator.php ++++ b/lib/private/DB/PostgreSqlMigrator.php +@@ -42,7 +42,7 @@ class PostgreSqlMigrator extends Migrator { + } + $fromDefault = $column->fromColumn->getDefault(); + $toDefault = $column->column->getDefault(); +- $fromDefault = trim((string) $fromDefault, "()"); ++ $fromDefault = trim((string) $fromDefault, '()'); + + // by intention usage of != + return $fromDefault != $toDefault; +-- +2.41.0 + diff --git a/base/Dockerfile b/base/Dockerfile index 34d7c47..d699e52 100644 --- a/base/Dockerfile +++ b/base/Dockerfile @@ -25,6 +25,8 @@ COPY ./img/logo /usr/src/nextcloud/core/img/logo COPY ./img/favicon.ico /usr/src/nextcloud/core/img/favicon.ico COPY install.sh /install.sh COPY refresh_config.sh /refresh_config.sh +COPY 0001-fixed-quotes.patch /usr/src/nextcloud/0001-fixed-quotes.patch +RUN patch -p0 < 0001-fixed-quotes.patch && rm 0001-fixed-quotes.patch RUN for app in $(cat /usr/src/nextcloud/apps/remove-list);do \ echo "removing app $app"; \ rm -R /usr/src/nextcloud/apps/$app; \ -- GitLab From 0c2ba5f2568f4be2350be16bbd268ec5b1a74dfc Mon Sep 17 00:00:00 2001 From: unteem Date: Wed, 21 Jun 2023 12:12:31 +0200 Subject: [PATCH 2/5] fix: patch --- base/0001-fixed-quotes.patch | 26 -------------------------- base/Dockerfile | 4 ++-- base/fix-pgmigrator.patch | 11 +++++++++++ 3 files changed, 13 insertions(+), 28 deletions(-) delete mode 100644 base/0001-fixed-quotes.patch create mode 100644 base/fix-pgmigrator.patch diff --git a/base/0001-fixed-quotes.patch b/base/0001-fixed-quotes.patch deleted file mode 100644 index ef55690..0000000 --- a/base/0001-fixed-quotes.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 2211721c2bacb1c7b45a56cd8d3cd0020220ea71 Mon Sep 17 00:00:00 2001 -From: dartcafe -Date: Tue, 20 Jun 2023 18:32:49 +0200 -Subject: [PATCH] fixed quotes - -Signed-off-by: dartcafe ---- - lib/private/DB/PostgreSqlMigrator.php | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/lib/private/DB/PostgreSqlMigrator.php b/lib/private/DB/PostgreSqlMigrator.php -index ec153658735..92a0842e1a7 100644 ---- a/lib/private/DB/PostgreSqlMigrator.php -+++ b/lib/private/DB/PostgreSqlMigrator.php -@@ -42,7 +42,7 @@ class PostgreSqlMigrator extends Migrator { - } - $fromDefault = $column->fromColumn->getDefault(); - $toDefault = $column->column->getDefault(); -- $fromDefault = trim((string) $fromDefault, "()"); -+ $fromDefault = trim((string) $fromDefault, '()'); - - // by intention usage of != - return $fromDefault != $toDefault; --- -2.41.0 - diff --git a/base/Dockerfile b/base/Dockerfile index d699e52..ec0152c 100644 --- a/base/Dockerfile +++ b/base/Dockerfile @@ -25,8 +25,8 @@ COPY ./img/logo /usr/src/nextcloud/core/img/logo COPY ./img/favicon.ico /usr/src/nextcloud/core/img/favicon.ico COPY install.sh /install.sh COPY refresh_config.sh /refresh_config.sh -COPY 0001-fixed-quotes.patch /usr/src/nextcloud/0001-fixed-quotes.patch -RUN patch -p0 < 0001-fixed-quotes.patch && rm 0001-fixed-quotes.patch +COPY fix-pgmigrator.patch /usr/src/nextcloud/fix-pgmigrator.patch +RUN patch -p0 < fix-pgmigrator.patch && rm fix-pgmigrator.patch RUN for app in $(cat /usr/src/nextcloud/apps/remove-list);do \ echo "removing app $app"; \ rm -R /usr/src/nextcloud/apps/$app; \ diff --git a/base/fix-pgmigrator.patch b/base/fix-pgmigrator.patch new file mode 100644 index 0000000..2887522 --- /dev/null +++ b/base/fix-pgmigrator.patch @@ -0,0 +1,11 @@ +--- lib/private/DB/PostgreSqlMigrator.php 2023-06-21 12:07:32.451928839 +0200 ++++ ../PostgreSqlMigrator.php 2023-06-21 12:07:28.165261718 +0200 +@@ -42,7 +42,7 @@ + } + $fromDefault = $column->fromColumn->getDefault(); + $toDefault = $column->column->getDefault(); +- $fromDefault = trim($fromDefault, "()"); ++ $fromDefault = trim((string) $fromDefault, '()'); + + // by intention usage of != + return $fromDefault != $toDefault; -- GitLab From a108203668481c32ba98526c2c83f7007ae7c8da Mon Sep 17 00:00:00 2001 From: unteem Date: Wed, 21 Jun 2023 12:53:39 +0200 Subject: [PATCH 3/5] fix: add patch for polls & refactor --- base/Dockerfile | 8 ++++-- base/patches/TableManager-patch.diff | 25 +++++++++++++++++++ .../pgmigrator-patch.diff} | 0 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 base/patches/TableManager-patch.diff rename base/{fix-pgmigrator.patch => patches/pgmigrator-patch.diff} (100%) diff --git a/base/Dockerfile b/base/Dockerfile index ec0152c..ecb5e2a 100644 --- a/base/Dockerfile +++ b/base/Dockerfile @@ -25,8 +25,12 @@ COPY ./img/logo /usr/src/nextcloud/core/img/logo COPY ./img/favicon.ico /usr/src/nextcloud/core/img/favicon.ico COPY install.sh /install.sh COPY refresh_config.sh /refresh_config.sh -COPY fix-pgmigrator.patch /usr/src/nextcloud/fix-pgmigrator.patch -RUN patch -p0 < fix-pgmigrator.patch && rm fix-pgmigrator.patch +COPY patches /usr/src/nextcloud/patches +RUN for patch in /usr/src/nextcloud/patches/*.diff; \ + do \ + patch -p0 < $patch; \ + done; \ + rm -r /usr/src/nextcloud/patches/; RUN for app in $(cat /usr/src/nextcloud/apps/remove-list);do \ echo "removing app $app"; \ rm -R /usr/src/nextcloud/apps/$app; \ diff --git a/base/patches/TableManager-patch.diff b/base/patches/TableManager-patch.diff new file mode 100644 index 0000000..f022047 --- /dev/null +++ b/base/patches/TableManager-patch.diff @@ -0,0 +1,25 @@ +--- lib/Db/TableManager.php 2023-06-21 12:38:02.300193982 +0200 ++++ lib/Db/TableManager-patched.php 2023-06-21 12:48:45.144957659 +0200 +@@ -312,12 +312,18 @@ + if ($this->schema->hasTable($this->dbPrefix . $table)) { + // identify duplicates + $selection = $qb->selectDistinct('t1.id') +- ->from($table, 't1') +- ->innerJoin('t1', $table, 't2') +- ->where($qb->expr()->lt('t1.id', 't2.id')); ++ ->from($table, 't1') ++ ->innerJoin('t1', $table, 't2', $qb->expr()->eq('t1.id', 't2.id')); ++ ++ $i = 0; + + foreach ($columns as $column) { +- $selection->andWhere($qb->expr()->eq('t1.' . $column, 't2.' . $column)); ++ if ($i > 0) { ++ $selection->andWhere($qb->expr()->eq('t1.' . $column, 't2.' . $column)); ++ } else { ++ $selection->where($qb->expr()->eq('t1.' . $column, 't2.' . $column)); ++ } ++ $i++; + } + + $duplicates = $qb->executeQuery()->fetchAll(PDO::FETCH_COLUMN); diff --git a/base/fix-pgmigrator.patch b/base/patches/pgmigrator-patch.diff similarity index 100% rename from base/fix-pgmigrator.patch rename to base/patches/pgmigrator-patch.diff -- GitLab From f6ac030d6896cded85913607b6a6789e861b72d0 Mon Sep 17 00:00:00 2001 From: unteem Date: Wed, 21 Jun 2023 12:57:45 +0200 Subject: [PATCH 4/5] fix: patch path --- base/patches/TableManager-patch.diff | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base/patches/TableManager-patch.diff b/base/patches/TableManager-patch.diff index f022047..c54b767 100644 --- a/base/patches/TableManager-patch.diff +++ b/base/patches/TableManager-patch.diff @@ -1,5 +1,5 @@ ---- lib/Db/TableManager.php 2023-06-21 12:38:02.300193982 +0200 -+++ lib/Db/TableManager-patched.php 2023-06-21 12:48:45.144957659 +0200 +--- apps/polls/lib/Db/TableManager.php 2023-06-21 12:38:02.300193982 +0200 ++++ apps/polls/lib/Db/TableManager-patched.php 2023-06-21 12:48:45.144957659 +0200 @@ -312,12 +312,18 @@ if ($this->schema->hasTable($this->dbPrefix . $table)) { // identify duplicates -- GitLab From cbb0cde31c77546519fb1be5ca6d533018de0a89 Mon Sep 17 00:00:00 2001 From: unteem Date: Wed, 21 Jun 2023 15:05:11 +0200 Subject: [PATCH 5/5] fix: patch --- base/patches/TableManager-patch.diff | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/patches/TableManager-patch.diff b/base/patches/TableManager-patch.diff index c54b767..600b3da 100644 --- a/base/patches/TableManager-patch.diff +++ b/base/patches/TableManager-patch.diff @@ -8,7 +8,7 @@ - ->innerJoin('t1', $table, 't2') - ->where($qb->expr()->lt('t1.id', 't2.id')); + ->from($table, 't1') -+ ->innerJoin('t1', $table, 't2', $qb->expr()->eq('t1.id', 't2.id')); ++ ->innerJoin('t1', $table, 't2', $qb->expr()->lt('t1.id', 't2.id')); + + $i = 0; -- GitLab