Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow wordpress files to be updated if volume version differs from container #174

Closed
wants to merge 1 commit into from
Closed

Allow wordpress files to be updated if volume version differs from container #174

wants to merge 1 commit into from

Conversation

jonknapp
Copy link

This specifically ignores the wp-content directory from upgrades and allows
all other default wordpress files/folders to overwrite their equivalents.

This should fix #156 for installs that don't customize /entrypoint.sh.

…ntainer

This specifically ignores the `wp-content` directory from upgrades and allows
all other default wordpress files/folders to overrwrite their equivalents.
else
CONTAINER_WORDPRESS_VERSION=$(php -r "include('/usr/src/wordpress/wp-includes/version.php'); echo \$wp_version;")
INSTALLED_WORDPRESS_VERSION=$(php -r "include('wp-includes/version.php'); echo \$wp_version;")
if ! [ "$CONTAINER_WORDPRESS_VERSION" == "$INSTALLED_WORDPRESS_VERSION" ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are going to add this, it really needs to be a full version comparison and then only upgrade when container version is newer. Otherwise, if a user has WordPress set to auto-upgrade itself (which I believe is the default), then when the container restarts, they will get auto downgraded.

I wonder if this should also be behind a env flag of some sort so that users don't get unexpected upgrades when they start a new container.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the initial files installed by the container are owned by root, so wordpress cannot autoupdate itself with the current entrypoint script as of now.

Copy link
Author

@jonknapp jonknapp Sep 26, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In regards to putting it behind a flag, wouldn't this issue only occur for users that are pointing to latest instead of a set version? Otherwise, the container's version of wordpress would not change and would not trigger an upgrade of files.

(well, it would only occur for latest as long as wordpress cannot auto-update itself)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the files are correctly owned by www-data, since the tar cf - --one-file-system -C /usr/src/wordpress . | tar xf - preserves the user id from /usr/src/wordpress.

$ docker exec -it word bash
root@79cc11d29c37:/var/www/html# ls -l
total 188
-rw-r--r--  1 www-data www-data   418 Sep 25  2013 index.php
-rw-r--r--  1 www-data www-data 19935 Mar  5  2016 license.txt
-rw-r--r--  1 www-data www-data  7344 Aug 16 20:39 readme.html
-rw-r--r--  1 www-data www-data  5456 May 24 21:02 wp-activate.php
drwxr-xr-x  9 www-data www-data  4096 Sep 20 20:34 wp-admin
-rw-r--r--  1 www-data www-data   364 Dec 19  2015 wp-blog-header.php
-rw-r--r--  1 www-data www-data  1477 May 23 16:44 wp-comments-post.php
-rw-r--r--  1 www-data www-data  2853 Sep 26 18:31 wp-config-sample.php
-rw-r--r--  1 www-data www-data  3235 Sep 26 18:31 wp-config.php
drwxr-xr-x  4 www-data www-data  4096 Sep 20 20:34 wp-content
-rw-r--r--  1 www-data www-data  3286 May 24  2015 wp-cron.php
drwxr-xr-x 17 www-data www-data 12288 Sep 20 20:34 wp-includes
-rw-r--r--  1 www-data www-data  2382 May 23 16:44 wp-links-opml.php
-rw-r--r--  1 www-data www-data  3353 Apr 14 17:53 wp-load.php
-rw-r--r--  1 www-data www-data 34057 Jun 14 21:51 wp-login.php
-rw-r--r--  1 www-data www-data  7786 Jul 13 12:37 wp-mail.php
-rw-r--r--  1 www-data www-data 13920 Aug 13 16:02 wp-settings.php
-rw-r--r--  1 www-data www-data 29890 May 24 20:44 wp-signup.php
-rw-r--r--  1 www-data www-data  4035 Nov 30  2014 wp-trackback.php
-rw-r--r--  1 www-data www-data  3064 Jul  6 12:40 xmlrpc.php

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might have mistaken a WP upgrade issue with the /var/www/html volume being recreated with docker-compose until I specifically mapped that to a named volume.

@jonknapp
Copy link
Author

If the container can update it's own WP install, there's probably no need for this PR.

Not sure what issue @bdew ran into with #156, but I'll close this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Updating wordpress image does not actually update wordpress
2 participants