From f2d68e2d5540bcad6ea805fba66014bf08dcc9af Mon Sep 17 00:00:00 2001 From: xZero707 Date: Sun, 6 Aug 2023 22:25:41 +0200 Subject: [PATCH] Introduce WP_PATCH_VERSION that allows reusing patch across the versions In most cases, there is no need for new patch, as it's exactly the same. There were no changes recorded between versions 5.9.1 and 6.2.2 --- Dockerfile | 6 ++++- build/docker-bake.hcl | 29 ++++++++++++------------ patches/5.9.2/wp-admin-update-core.patch | 14 ------------ patches/5.9.3/wp-admin-update-core.patch | 14 ------------ patches/6.0.0/wp-admin-update-core.patch | 14 ------------ patches/6.0.1/wp-admin-update-core.patch | 14 ------------ patches/6.0.2/wp-admin-update-core.patch | 14 ------------ patches/6.0.3/wp-admin-update-core.patch | 14 ------------ patches/6.1.0/wp-admin-update-core.patch | 14 ------------ patches/6.1.1/wp-admin-update-core.patch | 14 ------------ patches/6.2.0/wp-admin-update-core.patch | 14 ------------ patches/6.2.1/wp-admin-update-core.patch | 14 ------------ patches/6.2.2/wp-admin-update-core.patch | 14 ------------ 13 files changed, 20 insertions(+), 169 deletions(-) delete mode 100644 patches/5.9.2/wp-admin-update-core.patch delete mode 100644 patches/5.9.3/wp-admin-update-core.patch delete mode 100644 patches/6.0.0/wp-admin-update-core.patch delete mode 100644 patches/6.0.1/wp-admin-update-core.patch delete mode 100644 patches/6.0.2/wp-admin-update-core.patch delete mode 100644 patches/6.0.3/wp-admin-update-core.patch delete mode 100644 patches/6.1.0/wp-admin-update-core.patch delete mode 100644 patches/6.1.1/wp-admin-update-core.patch delete mode 100644 patches/6.2.0/wp-admin-update-core.patch delete mode 100644 patches/6.2.1/wp-admin-update-core.patch delete mode 100644 patches/6.2.2/wp-admin-update-core.patch diff --git a/Dockerfile b/Dockerfile index 55236f0..9e676a5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ ARG PHP_VERSION=8.1 ARG WP_VERSION=6.1.0 +ARG WP_PATCH_VERSION=5.9.1 # WordPress resources FROM --platform=${TARGETPLATFORM} wordpress:cli-php${PHP_VERSION} AS wp-cli @@ -18,11 +19,12 @@ COPY ["./rootfs/", "/"] # Configuration and patches ARG WP_VERSION +ARG WP_PATCH_VERSION # Copy WordPress source from the official image COPY --from=wp-src ["/usr/src/wordpress/", "/var/www/html/"] -COPY ["patches/${WP_VERSION}/wp-admin-update-core.patch", "/etc/wp-mods/"] +COPY ["patches/${WP_PATCH_VERSION}/wp-admin-update-core.patch", "/etc/wp-mods/"] # Stage 3 - Final @@ -38,7 +40,9 @@ RUN set -eux \ && wp-apply-patch "/etc/wp-mods/wp-admin-update-core.patch" "/var/www/html/wp-admin/update-core.php" "true" ARG WP_VERSION +ARG WP_PATCH_VERSION ENV WP_VERSION="${WP_VERSION}" +ENV WP_PATCH_VERSION="${WP_PATCH_VERSION}" ENV ENFORCE_DISABLE_WP_UPDATES=true ENV WP_CLI_DISABLE_AUTO_CHECK_UPDATE=true ENV CRON_ENABLED=true diff --git a/build/docker-bake.hcl b/build/docker-bake.hcl index 865bdad..c40abbb 100644 --- a/build/docker-bake.hcl +++ b/build/docker-bake.hcl @@ -38,9 +38,10 @@ variable "REGISTRY_CACHE" { # Get the arguments for the build function "get-args" { - params = [version] + params = [version, patch_version] result = { WP_VERSION = version + WP_PATCH_VERSION = patch_version) } } @@ -88,7 +89,7 @@ target "5_9_0" { cache-from = get-cache-from("5.9.0") cache-to = get-cache-to("5.9.0") tags = get-tags("5.9.0", []) - args = get-args("5.9.0") + args = get-args("5.9.0", "5.9.0") } target "5_9_1" { @@ -96,7 +97,7 @@ target "5_9_1" { cache-from = get-cache-from("5.9.1") cache-to = get-cache-to("5.9.1") tags = get-tags("5.9.1", []) - args = get-args("5.9.1") + args = get-args("5.9.1", "5.9.1") } target "5_9_2" { @@ -104,7 +105,7 @@ target "5_9_2" { cache-from = get-cache-from("5.9.2") cache-to = get-cache-to("5.9.2") tags = get-tags("5.9.2", []) - args = get-args("5.9.2") + args = get-args("5.9.2", "5.9.1") } target "5_9_3" { @@ -112,7 +113,7 @@ target "5_9_3" { cache-from = get-cache-from("5.9.3") cache-to = get-cache-to("5.9.3") tags = get-tags("5.9.3", ["5", "5.9"]) - args = get-args("5.9.3") + args = get-args("5.9.3", "5.9.1") } target "6_0_0" { @@ -120,7 +121,7 @@ target "6_0_0" { cache-from = get-cache-from("6.0.0") cache-to = get-cache-to("6.0.0") tags = get-tags("6.0.0", []) - args = get-args("6.0.0") + args = get-args("6.0.0", "5.9.1") } target "6_0_1" { @@ -128,7 +129,7 @@ target "6_0_1" { cache-from = get-cache-from("6.0.1") cache-to = get-cache-to("6.0.1") tags = get-tags("6.0.1", []) - args = get-args("6.0.1") + args = get-args("6.0.1", "5.9.1") } target "6_0_2" { @@ -136,7 +137,7 @@ target "6_0_2" { cache-from = get-cache-from("6.0.2") cache-to = get-cache-to("6.0.2") tags = get-tags("6.0.2", []) - args = get-args("6.0.2") + args = get-args("6.0.2", "5.9.1") } target "6_0_3" { @@ -144,7 +145,7 @@ target "6_0_3" { cache-from = get-cache-from("6.0.3") cache-to = get-cache-to("6.0.3") tags = get-tags("6.0.3", ["6.0"]) - args = get-args("6.0.3") + args = get-args("6.0.3", "5.9.1") } target "6_1_0" { @@ -152,7 +153,7 @@ target "6_1_0" { cache-from = get-cache-from("6.1.0") cache-to = get-cache-to("6.1.0") tags = get-tags("6.1.0", []) - args = get-args("6.1.0") + args = get-args("6.1.0", "5.9.1") } target "6_1_1" { @@ -160,7 +161,7 @@ target "6_1_1" { cache-from = get-cache-from("6.1.1") cache-to = get-cache-to("6.1.1") tags = get-tags("6.1.1", ["6.1"]) - args = get-args("6.1.1") + args = get-args("6.1.1", "5.9.1") } target "6_2_0" { @@ -168,7 +169,7 @@ target "6_2_0" { cache-from = get-cache-from("6.2.0") cache-to = get-cache-to("6.2.0") tags = get-tags("6.2.0", []) - args = get-args("6.2.0") + args = get-args("6.2.0", "5.9.1") } target "6_2_1" { @@ -176,7 +177,7 @@ target "6_2_1" { cache-from = get-cache-from("6.2.1") cache-to = get-cache-to("6.2.1") tags = get-tags("6.2.1", []) - args = get-args("6.2.1") + args = get-args("6.2.1", "5.9.1") } target "6_2_2" { @@ -184,5 +185,5 @@ target "6_2_2" { cache-from = get-cache-from("6.2.2") cache-to = get-cache-to("6.2.2") tags = get-tags("6.2.2", ["6", "6.2", "latest"]) - args = get-args("6.2.2") + args = get-args("6.2.2", "5.9.1") } diff --git a/patches/5.9.2/wp-admin-update-core.patch b/patches/5.9.2/wp-admin-update-core.patch deleted file mode 100644 index b4c9d38..0000000 --- a/patches/5.9.2/wp-admin-update-core.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- update-core.php 2022-03-22 19:22:19.921705536 +0100 -+++ update-core.php 2022-03-22 19:22:41.242213723 +0100 -@@ -1096,6 +1096,11 @@ - wp_die( __( 'Sorry, you are not allowed to update this site.' ) ); - } - -+ wp_die( -+ __( 'Sorry, you are not allowed to update this site.' ) . -+ ' Click here to learn why.' -+ ); -+ - check_admin_referer( 'upgrade-core' ); - - // Do the (un)dismiss actions before headers, so that they can redirect. diff --git a/patches/5.9.3/wp-admin-update-core.patch b/patches/5.9.3/wp-admin-update-core.patch deleted file mode 100644 index 2ac21b9..0000000 --- a/patches/5.9.3/wp-admin-update-core.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- update-core.php 2022-05-25 19:16:03.906128294 +0200 -+++ update-core.php 2022-05-25 19:16:56.079812565 +0200 -@@ -1096,6 +1096,11 @@ - wp_die( __( 'Sorry, you are not allowed to update this site.' ) ); - } - -+ wp_die( -+ __( 'Sorry, you are not allowed to update this site.' ) . -+ ' Click here to learn why.' -+ ); -+ - check_admin_referer( 'upgrade-core' ); - - // Do the (un)dismiss actions before headers, so that they can redirect. diff --git a/patches/6.0.0/wp-admin-update-core.patch b/patches/6.0.0/wp-admin-update-core.patch deleted file mode 100644 index fab2606..0000000 --- a/patches/6.0.0/wp-admin-update-core.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- update-core.php 2022-07-25 23:31:49.413445800 +0200 -+++ update-core.php 2022-07-25 23:35:11.026340149 +0200 -@@ -1096,6 +1096,11 @@ - wp_die( __( 'Sorry, you are not allowed to update this site.' ) ); - } - -+ wp_die( -+ __( 'Sorry, you are not allowed to update this site.' ) . -+ ' Click here to learn why.' -+ ); -+ - check_admin_referer( 'upgrade-core' ); - - // Do the (un)dismiss actions before headers, so that they can redirect. diff --git a/patches/6.0.1/wp-admin-update-core.patch b/patches/6.0.1/wp-admin-update-core.patch deleted file mode 100644 index 84597ca..0000000 --- a/patches/6.0.1/wp-admin-update-core.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- update-core.php 2022-07-25 23:40:10.667406949 +0200 -+++ update-core.php 2022-07-25 23:41:52.068913892 +0200 -@@ -1096,6 +1096,11 @@ - wp_die( __( 'Sorry, you are not allowed to update this site.' ) ); - } - -+ wp_die( -+ __( 'Sorry, you are not allowed to update this site.' ) . -+ ' Click here to learn why.' -+ ); -+ - check_admin_referer( 'upgrade-core' ); - - // Do the (un)dismiss actions before headers, so that they can redirect. diff --git a/patches/6.0.2/wp-admin-update-core.patch b/patches/6.0.2/wp-admin-update-core.patch deleted file mode 100644 index 1258c2a..0000000 --- a/patches/6.0.2/wp-admin-update-core.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- update-core.php 2022-09-10 03:36:26.120553829 +0200 -+++ update-core.php 2022-09-10 03:37:29.638236917 +0200 -@@ -1096,6 +1096,11 @@ - wp_die( __( 'Sorry, you are not allowed to update this site.' ) ); - } - -+ wp_die( -+ __( 'Sorry, you are not allowed to update this site.' ) . -+ ' Click here to learn why.' -+ ); -+ - check_admin_referer( 'upgrade-core' ); - - // Do the (un)dismiss actions before headers, so that they can redirect. diff --git a/patches/6.0.3/wp-admin-update-core.patch b/patches/6.0.3/wp-admin-update-core.patch deleted file mode 100644 index 9e0d1b8..0000000 --- a/patches/6.0.3/wp-admin-update-core.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- update-core.php 2022-11-02 21:28:47.121321629 +0100 -+++ update-core.php 2022-11-02 21:31:38.007567026 +0100 -@@ -1096,6 +1096,11 @@ - wp_die( __( 'Sorry, you are not allowed to update this site.' ) ); - } - -+ wp_die( -+ __( 'Sorry, you are not allowed to update this site.' ) . -+ ' Click here to learn why.' -+ ); -+ - check_admin_referer( 'upgrade-core' ); - - // Do the (un)dismiss actions before headers, so that they can redirect. diff --git a/patches/6.1.0/wp-admin-update-core.patch b/patches/6.1.0/wp-admin-update-core.patch deleted file mode 100644 index 0a9d3f8..0000000 --- a/patches/6.1.0/wp-admin-update-core.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- update-core.php 2022-11-02 21:35:23.068067797 +0100 -+++ update-core.php 2022-11-02 21:36:03.955439331 +0100 -@@ -1096,6 +1096,11 @@ - wp_die( __( 'Sorry, you are not allowed to update this site.' ) ); - } - -+ wp_die( -+ __( 'Sorry, you are not allowed to update this site.' ) . -+ ' Click here to learn why.' -+ ); -+ - check_admin_referer( 'upgrade-core' ); - - // Do the (un)dismiss actions before headers, so that they can redirect. diff --git a/patches/6.1.1/wp-admin-update-core.patch b/patches/6.1.1/wp-admin-update-core.patch deleted file mode 100644 index 5313c1c..0000000 --- a/patches/6.1.1/wp-admin-update-core.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- update-core.php 2023-01-20 13:36:28.762998072 +0100 -+++ update-core.php 2023-01-20 13:38:35.335180877 +0100 -@@ -1096,6 +1096,11 @@ - wp_die( __( 'Sorry, you are not allowed to update this site.' ) ); - } - -+ wp_die( -+ __( 'Sorry, you are not allowed to update this site.' ) . -+ ' Click here to learn why.' -+ ); -+ - check_admin_referer( 'upgrade-core' ); - - // Do the (un)dismiss actions before headers, so that they can redirect. diff --git a/patches/6.2.0/wp-admin-update-core.patch b/patches/6.2.0/wp-admin-update-core.patch deleted file mode 100644 index 278c0cd..0000000 --- a/patches/6.2.0/wp-admin-update-core.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- update-core.php 2023-04-02 20:27:00.420010509 +0200 -+++ update-core.php 2023-04-02 20:28:07.478135707 +0200 -@@ -1096,6 +1096,11 @@ - wp_die( __( 'Sorry, you are not allowed to update this site.' ) ); - } - -+ wp_die( -+ __( 'Sorry, you are not allowed to update this site.' ) . -+ ' Click here to learn why.' -+ ); -+ - check_admin_referer( 'upgrade-core' ); - - // Do the (un)dismiss actions before headers, so that they can redirect. diff --git a/patches/6.2.1/wp-admin-update-core.patch b/patches/6.2.1/wp-admin-update-core.patch deleted file mode 100644 index 1498210..0000000 --- a/patches/6.2.1/wp-admin-update-core.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- update-core.php 2023-05-22 23:14:59.041737945 +0200 -+++ update-core.php 2023-05-22 23:17:12.572278041 +0200 -@@ -1096,6 +1096,11 @@ - wp_die( __( 'Sorry, you are not allowed to update this site.' ) ); - } - -+ wp_die( -+ __( 'Sorry, you are not allowed to update this site.' ) . -+ ' Click here to learn why.' -+ ); -+ - check_admin_referer( 'upgrade-core' ); - - // Do the (un)dismiss actions before headers, so that they can redirect. diff --git a/patches/6.2.2/wp-admin-update-core.patch b/patches/6.2.2/wp-admin-update-core.patch deleted file mode 100644 index ceff038..0000000 --- a/patches/6.2.2/wp-admin-update-core.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- update-core.php 2023-08-06 22:01:15.849226997 +0200 -+++ update-core.php 2023-08-06 22:02:42.945892647 +0200 -@@ -1096,6 +1096,11 @@ - wp_die( __( 'Sorry, you are not allowed to update this site.' ) ); - } - -+ wp_die( -+ __( 'Sorry, you are not allowed to update this site.' ) . -+ ' Click here to learn why.' -+ ); -+ - check_admin_referer( 'upgrade-core' ); - - // Do the (un)dismiss actions before headers, so that they can redirect.