diff --git a/.github/workflows/image.yml b/.github/workflows/image.yml
index 1038b9f..a3594af 100644
--- a/.github/workflows/image.yml
+++ b/.github/workflows/image.yml
@@ -21,4 +21,4 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build image
- run: build/bin/build 5.8.0
\ No newline at end of file
+ run: build/bin/build "5.4.2 5.5.1 5.5.3 5.6.0 5.6.1 5.7.0 5.8.0"
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
index df32ded..ce8e1f6 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,6 +1,7 @@
ARG PHP_VERSION=7.4
ARG WP_VERSION=5.8.0
FROM --platform=${TARGETPLATFORM} wordpress:${WP_VERSION}-php${PHP_VERSION}-fpm-alpine AS wordpress-builder
+# As long as new version doesn't require changes to Dockerfile, we don't need separate files
USER root
@@ -54,5 +55,6 @@ ENV ENFORCE_DISABLE_WP_UPDATES true
ENV WP_CLI_DISABLE_AUTO_CHECK_UPDATE true
COPY ["wp-config.php", "/var/www/html"]
+COPY ["patches/${WP_VERSION}/wp-admin-update-core.patch", "/etc/wp-mods/wp-admin/update-core.php.patch"]
EXPOSE 80/TCP
diff --git a/build/bin/build b/build/bin/build
index 964b510..2bfb20f 100755
--- a/build/bin/build
+++ b/build/bin/build
@@ -1,11 +1,18 @@
#!/usr/bin/env sh
-WP_VERSION="${1:-}"
+WP_VERSIONS=${1:-""}
-if [ -z "${WP_VERSION}" ]; then
- echo "Error: WP_VERSION is null"
+if [ -z "${WP_VERSIONS}" ]; then
+ echo "Error: WP_VERSIONS is null"
exit 1
fi
docker buildx create --use --name build --node build --driver-opt network=host
-docker buildx build --pull --push --platform "linux/amd64,linux/armhf,linux/aarch64" --build-arg "WP_VERSION=${WP_VERSION}" --tag "nlss/wordpress:${WP_VERSION}" --tag "nlss/wordpress:latest" .
\ No newline at end of file
+
+# Loop through requested versions
+for TARGET_VERSION in ${WP_VERSIONS}
+do
+ echo "> Building WordPress ${TARGET_VERSION}"
+
+ docker buildx build --pull --push --build-arg "WP_VERSION=${TARGET_VERSION}" --platform "linux/amd64,linux/armhf,linux/aarch64" --tag "nlss/wordpress:${TARGET_VERSION}" .
+done
\ No newline at end of file
diff --git a/build/patch-util/01-create-patch.sh b/build/patch-util/01-create-patch.sh
index bfe0a85..e5e27a0 100755
--- a/build/patch-util/01-create-patch.sh
+++ b/build/patch-util/01-create-patch.sh
@@ -2,7 +2,7 @@
MOD_FILE="mod-update-core.php"
TARGET_FILE="update-core.php"
-PATCH_FILE="update-core.php.patch"
+PATCH_FILE="wp-admin-update-core.patch"
set -e
cd ./wp-src
@@ -45,7 +45,7 @@ sed -i "s/${MOD_FILE}/${TARGET_FILE}/g" "${PATCH_FILE}"
echo "> Patch file created ${PATCH_FILE}"
echo "> Please run: "
-echo " cp './wp-src/${PATCH_FILE}' '../../rootfs/etc/wp-mods/wp-admin/'"
+echo " cp './wp-src/${PATCH_FILE}' '../../patches/5.x.x/'"
echo ""
echo "> Don't forget to inspect the patch and THEN commit"
echo "> Finished"
\ No newline at end of file
diff --git a/patches/5.4.2/wp-admin-update-core.patch b/patches/5.4.2/wp-admin-update-core.patch
new file mode 100644
index 0000000..3cf0767
--- /dev/null
+++ b/patches/5.4.2/wp-admin-update-core.patch
@@ -0,0 +1,14 @@
+--- update-core.php 2020-10-04 19:03:07.898527934 +0200
++++ update-core-mod.php 2020-10-04 19:04:59.434908923 +0200
+@@ -915,6 +915,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-translations' );
+
+ require_once ABSPATH . 'wp-admin/admin-header.php';
diff --git a/patches/5.5.1/wp-admin-update-core.patch b/patches/5.5.1/wp-admin-update-core.patch
new file mode 100644
index 0000000..6b4b9e4
--- /dev/null
+++ b/patches/5.5.1/wp-admin-update-core.patch
@@ -0,0 +1,14 @@
+--- update-core.php 2020-10-04 19:51:51.874573636 +0200
++++ update-core-mod.php 2020-10-04 19:53:36.705858923 +0200
+@@ -917,6 +917,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.5.3/wp-admin-update-core.patch b/patches/5.5.3/wp-admin-update-core.patch
new file mode 100644
index 0000000..d22f790
--- /dev/null
+++ b/patches/5.5.3/wp-admin-update-core.patch
@@ -0,0 +1,14 @@
+--- update-core.php 2020-10-04 19:51:51.874573636 +0200
++++ update-core.php 2020-10-04 19:53:36.705858923 +0200
+@@ -917,6 +917,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.6.0/wp-admin-update-core.patch b/patches/5.6.0/wp-admin-update-core.patch
new file mode 100644
index 0000000..2f384cc
--- /dev/null
+++ b/patches/5.6.0/wp-admin-update-core.patch
@@ -0,0 +1,14 @@
+--- update-core.php 2021-01-11 20:24:28.531750881 +0100
++++ update-core.php 2021-01-11 20:27:11.200903166 +0100
+@@ -1049,6 +1049,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.6.1/wp-admin-update-core.patch b/patches/5.6.1/wp-admin-update-core.patch
new file mode 100644
index 0000000..2f384cc
--- /dev/null
+++ b/patches/5.6.1/wp-admin-update-core.patch
@@ -0,0 +1,14 @@
+--- update-core.php 2021-01-11 20:24:28.531750881 +0100
++++ update-core.php 2021-01-11 20:27:11.200903166 +0100
+@@ -1049,6 +1049,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.7.0/wp-admin-update-core.patch b/patches/5.7.0/wp-admin-update-core.patch
new file mode 100644
index 0000000..1ceb5dd
--- /dev/null
+++ b/patches/5.7.0/wp-admin-update-core.patch
@@ -0,0 +1,14 @@
+--- update-core.php 2021-03-19 19:23:29.391214787 +0100
++++ update-core.php 2021-03-19 19:26:23.798962792 +0100
+@@ -1050,6 +1050,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/rootfs/etc/wp-mods/wp-admin/update-core.php.patch b/patches/5.8.0/wp-admin-update-core.patch
similarity index 100%
rename from rootfs/etc/wp-mods/wp-admin/update-core.php.patch
rename to patches/5.8.0/wp-admin-update-core.patch
diff --git a/rootfs/etc/cont-init.d/10-init-wordpress b/rootfs/etc/cont-init.d/10-init-wordpress
index d3d27b9..4bed22f 100644
--- a/rootfs/etc/cont-init.d/10-init-wordpress
+++ b/rootfs/etc/cont-init.d/10-init-wordpress
@@ -12,7 +12,7 @@ WP_VERSION=$(echo "${WP_VERSION}" | sed --expression='s/.0//g');
function disableUpdatesPatch() {
if [ "${DISABLE_WP_UPDATES}" != "false" ]; then
echo "> Disabling WordPress updates..."
- patch /var/www/html/wp-admin/update-core.php