Skip to content

Commit 5a7623d

Browse files
authored
Merge pull request #507 from infosiftr/exclude-extra-content
Exclude existing "pluggable" content in case it's been updated
2 parents bcdd405 + 5a0d85b commit 5a7623d

10 files changed

Lines changed: 110 additions & 0 deletions

File tree

‎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+
forcontentDirin /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+
forcontentDirin /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+
forcontentDirin /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+
forcontentDirin /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+
forcontentDirin /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+
forcontentDirin /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+
forcontentDirin /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+
forcontentDirin /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+
forcontentDirin /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+
forcontentDirin /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)