Skip to content

Commit 5a0d85b

Browse files
committed
Exclude existing "pluggable" content in case it's been updated
If any directories like "wp-content/plugins/akismet" already exist, they're likely from a previous install where only "wp-content" was persisted and are likely to be already updated, so we should leave them alone.
1 parent bcdd405 commit 5a0d85b

File tree

10 files changed

+110
-0
lines changed

10 files changed

+110
-0
lines changed

docker-entrypoint.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,17 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
6969
# avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted"
7070
targetTarArgs+=( --no-overwrite-dir )
7171
fi
72+
# loop over "pluggable" content in the source, and if it already exists in the destination, skip it
73+
# https://github.com/docker-library/wordpress/issues/506 ("wp-content" persisted, "akismet" updated, WordPress container restarted/recreated, "akismet" downgraded)
74+
for contentDir in /usr/src/wordpress/wp-content/*/*/; do
75+
contentDir="${contentDir%/}"
76+
[ -d "$contentDir" ] || continue
77+
contentPath="${contentDir#/usr/src/wordpress/}" # "wp-content/plugins/akismet", etc.
78+
if [ -d "$PWD/$contentPath" ]; then
79+
echo >&2 "WARNING: '$PWD/$contentPath' exists! (not copying the WordPress version)"
80+
sourceTarArgs+=( --exclude "./$contentPath" )
81+
fi
82+
done
7283
tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}"
7384
echo >&2 "Complete! WordPress has been successfully copied to $PWD"
7485
if [ ! -e .htaccess ]; then

php7.2/apache/docker-entrypoint.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,17 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
6969
# avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted"
7070
targetTarArgs+=( --no-overwrite-dir )
7171
fi
72+
# loop over "pluggable" content in the source, and if it already exists in the destination, skip it
73+
# https://github.com/docker-library/wordpress/issues/506 ("wp-content" persisted, "akismet" updated, WordPress container restarted/recreated, "akismet" downgraded)
74+
for contentDir in /usr/src/wordpress/wp-content/*/*/; do
75+
contentDir="${contentDir%/}"
76+
[ -d "$contentDir" ] || continue
77+
contentPath="${contentDir#/usr/src/wordpress/}" # "wp-content/plugins/akismet", etc.
78+
if [ -d "$PWD/$contentPath" ]; then
79+
echo >&2 "WARNING: '$PWD/$contentPath' exists! (not copying the WordPress version)"
80+
sourceTarArgs+=( --exclude "./$contentPath" )
81+
fi
82+
done
7283
tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}"
7384
echo >&2 "Complete! WordPress has been successfully copied to $PWD"
7485
if [ ! -e .htaccess ]; then

php7.2/fpm-alpine/docker-entrypoint.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,17 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
6969
# avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted"
7070
targetTarArgs+=( --no-overwrite-dir )
7171
fi
72+
# loop over "pluggable" content in the source, and if it already exists in the destination, skip it
73+
# https://github.com/docker-library/wordpress/issues/506 ("wp-content" persisted, "akismet" updated, WordPress container restarted/recreated, "akismet" downgraded)
74+
for contentDir in /usr/src/wordpress/wp-content/*/*/; do
75+
contentDir="${contentDir%/}"
76+
[ -d "$contentDir" ] || continue
77+
contentPath="${contentDir#/usr/src/wordpress/}" # "wp-content/plugins/akismet", etc.
78+
if [ -d "$PWD/$contentPath" ]; then
79+
echo >&2 "WARNING: '$PWD/$contentPath' exists! (not copying the WordPress version)"
80+
sourceTarArgs+=( --exclude "./$contentPath" )
81+
fi
82+
done
7283
tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}"
7384
echo >&2 "Complete! WordPress has been successfully copied to $PWD"
7485
if [ ! -e .htaccess ]; then

php7.2/fpm/docker-entrypoint.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,17 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
6969
# avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted"
7070
targetTarArgs+=( --no-overwrite-dir )
7171
fi
72+
# loop over "pluggable" content in the source, and if it already exists in the destination, skip it
73+
# https://github.com/docker-library/wordpress/issues/506 ("wp-content" persisted, "akismet" updated, WordPress container restarted/recreated, "akismet" downgraded)
74+
for contentDir in /usr/src/wordpress/wp-content/*/*/; do
75+
contentDir="${contentDir%/}"
76+
[ -d "$contentDir" ] || continue
77+
contentPath="${contentDir#/usr/src/wordpress/}" # "wp-content/plugins/akismet", etc.
78+
if [ -d "$PWD/$contentPath" ]; then
79+
echo >&2 "WARNING: '$PWD/$contentPath' exists! (not copying the WordPress version)"
80+
sourceTarArgs+=( --exclude "./$contentPath" )
81+
fi
82+
done
7283
tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}"
7384
echo >&2 "Complete! WordPress has been successfully copied to $PWD"
7485
if [ ! -e .htaccess ]; then

php7.3/apache/docker-entrypoint.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,17 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
6969
# avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted"
7070
targetTarArgs+=( --no-overwrite-dir )
7171
fi
72+
# loop over "pluggable" content in the source, and if it already exists in the destination, skip it
73+
# https://github.com/docker-library/wordpress/issues/506 ("wp-content" persisted, "akismet" updated, WordPress container restarted/recreated, "akismet" downgraded)
74+
for contentDir in /usr/src/wordpress/wp-content/*/*/; do
75+
contentDir="${contentDir%/}"
76+
[ -d "$contentDir" ] || continue
77+
contentPath="${contentDir#/usr/src/wordpress/}" # "wp-content/plugins/akismet", etc.
78+
if [ -d "$PWD/$contentPath" ]; then
79+
echo >&2 "WARNING: '$PWD/$contentPath' exists! (not copying the WordPress version)"
80+
sourceTarArgs+=( --exclude "./$contentPath" )
81+
fi
82+
done
7283
tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}"
7384
echo >&2 "Complete! WordPress has been successfully copied to $PWD"
7485
if [ ! -e .htaccess ]; then

php7.3/fpm-alpine/docker-entrypoint.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,17 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
6969
# avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted"
7070
targetTarArgs+=( --no-overwrite-dir )
7171
fi
72+
# loop over "pluggable" content in the source, and if it already exists in the destination, skip it
73+
# https://github.com/docker-library/wordpress/issues/506 ("wp-content" persisted, "akismet" updated, WordPress container restarted/recreated, "akismet" downgraded)
74+
for contentDir in /usr/src/wordpress/wp-content/*/*/; do
75+
contentDir="${contentDir%/}"
76+
[ -d "$contentDir" ] || continue
77+
contentPath="${contentDir#/usr/src/wordpress/}" # "wp-content/plugins/akismet", etc.
78+
if [ -d "$PWD/$contentPath" ]; then
79+
echo >&2 "WARNING: '$PWD/$contentPath' exists! (not copying the WordPress version)"
80+
sourceTarArgs+=( --exclude "./$contentPath" )
81+
fi
82+
done
7283
tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}"
7384
echo >&2 "Complete! WordPress has been successfully copied to $PWD"
7485
if [ ! -e .htaccess ]; then

php7.3/fpm/docker-entrypoint.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,17 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
6969
# avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted"
7070
targetTarArgs+=( --no-overwrite-dir )
7171
fi
72+
# loop over "pluggable" content in the source, and if it already exists in the destination, skip it
73+
# https://github.com/docker-library/wordpress/issues/506 ("wp-content" persisted, "akismet" updated, WordPress container restarted/recreated, "akismet" downgraded)
74+
for contentDir in /usr/src/wordpress/wp-content/*/*/; do
75+
contentDir="${contentDir%/}"
76+
[ -d "$contentDir" ] || continue
77+
contentPath="${contentDir#/usr/src/wordpress/}" # "wp-content/plugins/akismet", etc.
78+
if [ -d "$PWD/$contentPath" ]; then
79+
echo >&2 "WARNING: '$PWD/$contentPath' exists! (not copying the WordPress version)"
80+
sourceTarArgs+=( --exclude "./$contentPath" )
81+
fi
82+
done
7283
tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}"
7384
echo >&2 "Complete! WordPress has been successfully copied to $PWD"
7485
if [ ! -e .htaccess ]; then

php7.4/apache/docker-entrypoint.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,17 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
6969
# avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted"
7070
targetTarArgs+=( --no-overwrite-dir )
7171
fi
72+
# loop over "pluggable" content in the source, and if it already exists in the destination, skip it
73+
# https://github.com/docker-library/wordpress/issues/506 ("wp-content" persisted, "akismet" updated, WordPress container restarted/recreated, "akismet" downgraded)
74+
for contentDir in /usr/src/wordpress/wp-content/*/*/; do
75+
contentDir="${contentDir%/}"
76+
[ -d "$contentDir" ] || continue
77+
contentPath="${contentDir#/usr/src/wordpress/}" # "wp-content/plugins/akismet", etc.
78+
if [ -d "$PWD/$contentPath" ]; then
79+
echo >&2 "WARNING: '$PWD/$contentPath' exists! (not copying the WordPress version)"
80+
sourceTarArgs+=( --exclude "./$contentPath" )
81+
fi
82+
done
7283
tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}"
7384
echo >&2 "Complete! WordPress has been successfully copied to $PWD"
7485
if [ ! -e .htaccess ]; then

php7.4/fpm-alpine/docker-entrypoint.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,17 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
6969
# avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted"
7070
targetTarArgs+=( --no-overwrite-dir )
7171
fi
72+
# loop over "pluggable" content in the source, and if it already exists in the destination, skip it
73+
# https://github.com/docker-library/wordpress/issues/506 ("wp-content" persisted, "akismet" updated, WordPress container restarted/recreated, "akismet" downgraded)
74+
for contentDir in /usr/src/wordpress/wp-content/*/*/; do
75+
contentDir="${contentDir%/}"
76+
[ -d "$contentDir" ] || continue
77+
contentPath="${contentDir#/usr/src/wordpress/}" # "wp-content/plugins/akismet", etc.
78+
if [ -d "$PWD/$contentPath" ]; then
79+
echo >&2 "WARNING: '$PWD/$contentPath' exists! (not copying the WordPress version)"
80+
sourceTarArgs+=( --exclude "./$contentPath" )
81+
fi
82+
done
7283
tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}"
7384
echo >&2 "Complete! WordPress has been successfully copied to $PWD"
7485
if [ ! -e .htaccess ]; then

php7.4/fpm/docker-entrypoint.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,17 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
6969
# avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted"
7070
targetTarArgs+=( --no-overwrite-dir )
7171
fi
72+
# loop over "pluggable" content in the source, and if it already exists in the destination, skip it
73+
# https://github.com/docker-library/wordpress/issues/506 ("wp-content" persisted, "akismet" updated, WordPress container restarted/recreated, "akismet" downgraded)
74+
for contentDir in /usr/src/wordpress/wp-content/*/*/; do
75+
contentDir="${contentDir%/}"
76+
[ -d "$contentDir" ] || continue
77+
contentPath="${contentDir#/usr/src/wordpress/}" # "wp-content/plugins/akismet", etc.
78+
if [ -d "$PWD/$contentPath" ]; then
79+
echo >&2 "WARNING: '$PWD/$contentPath' exists! (not copying the WordPress version)"
80+
sourceTarArgs+=( --exclude "./$contentPath" )
81+
fi
82+
done
7283
tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}"
7384
echo >&2 "Complete! WordPress has been successfully copied to $PWD"
7485
if [ ! -e .htaccess ]; then

0 commit comments

Comments
 (0)