Oefenweb / ansible-wordpress

Ansible role to set up (multiple) wordpress installations in Debian-like systems (using wp-cli)
MIT License
79 stars 37 forks source link

"check download" is not reliable #46

Closed betrcode closed 8 years ago

betrcode commented 8 years ago

In tasks/core.yml we do shell: "ls {{ item.path }} | grep -q 'wp-'" to check if we need to do wp-cli core download.

When using this role for local development using Vagrant, and mounting a synced folder with the theme, there is a wp-content folder in the www root before this tasks run. Therefore it will think that it doesn't need to download the core, so it will skip the "download" task and then fail on the "configure" task.

Proposal: Instead of doing the ls | grep -q 'wp-' trick, I propose we do the same as the wp-cli does.

$wordpress_present = is_readable( $download_dir . 'wp-load.php' );

See: https://github.com/wp-cli/wp-cli/blob/master/php/commands/core.php#L115

I think this would do the trick: shell: "[ -f {{ item.path }}/wp-load.php ];"

tersmitten commented 8 years ago

Great idea, can you make a pull request? I personally would use test -f with the command module

betrcode commented 8 years ago

@tersmitten Will make a PR. You just taught me about the test command. Thanks!