Apply patch during build time

This commit is contained in:
2023-01-24 01:24:46 +01:00
parent bb3f62ef10
commit fedfaeafc4
3 changed files with 39 additions and 19 deletions

View File

@@ -16,17 +16,6 @@ function scriptExitHandler() {
exit "${LAST_EXIT_CODE}"
}
# Applies patch for making WordPress updates impossible
function disableUpdatesPatch() {
DISABLE_WP_UPDATES="${ENFORCE_DISABLE_WP_UPDATES:-true}"
if [ "${DISABLE_WP_UPDATES}" != "false" ]; then
echo "> Disabling WordPress updates..."
patch /var/www/html/wp-admin/update-core.php </etc/wp-mods/wp-admin-update-core.patch
echo "> Marking the patched file read-only..."
chmod 0440 /var/www/html/wp-admin/update-core.php
fi
}
# Main function
function main() {
# Removes trailing zero if found
@@ -53,13 +42,6 @@ function main() {
return 0
else
echo "> Identified 'WordPress ${WP_VERSION}'"
# This will apply patch once and again only if container is recreated
if [ ! -f "/var/www/patch-applied" ]; then
disableUpdatesPatch
touch "/var/www/patch-applied"
fi
fi
}