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

Wordmove and WordPress in a subdirectory #591

Closed
nlemoine opened this issue Apr 17, 2020 · 4 comments · Fixed by #597
Closed

Wordmove and WordPress in a subdirectory #591

nlemoine opened this issue Apr 17, 2020 · 4 comments · Fixed by #597
Labels

Comments

@nlemoine
Copy link
Contributor

Hi!

I'm a WordMove user since the early beginning and I ❤️ it!

I'm opening this issue to discuss how WordPress in a subdirectory (Bedrock, etc.) could be handled a bit better. Like @matthewnw in #479, I'm only using Wordmove to sync data between stages (-du) but I'm a bit frustrated because WordMove does not play well in this kind of environment.

What is the right structure ?

When using WordPress in a subdirectory, you usually end up with a structure like this:

├── composer.json             # → Manage versions of WordPress, plugins & dependencies
├── vendor                    # → Composer packages (never edit)
└── web                       # → Web root (document root on your webserver)
    ├── app                   # → wp-content equivalent
    │   ├── mu-plugins        # → Must use plugins
    │   ├── plugins           # → Plugins
    │   ├── themes            # → Themes
    │   └── uploads           # → Uploads
    ├── wp-config.php         # → Required by WP (never edit)
    ├── index.php             # → WordPress view bootstrapper
    └── wp                    # → WordPress core (never edit)

This example is pasted from Bedrock but all the project templates I've stumbled upon (Wordplate, etc.) are almost the same besides folder names.

There are 2 ways to translate this kind of structure in Wordmove.

wordpress_path set to WordPress "package" path

stage:
  wordpress_path: /path/to/project/web/wp
  paths:
    wp_content: ../app
    plugins: ../app/plugins
    mu_plugins: ../app/mu-plugins
    uploads: ../app/uploads
    languages: ../app/languages
    themes: ../app/themes

This structure works well for -d but will fail for -u. And will probably fail for -c.

wordpress_path set to project path

stage:
  wordpress_path: /path/to/project
  paths:
    wp_content: web/app
    plugins: web/app/plugins
    mu_plugins: web/app/mu-plugins
    uploads: web/app/uploads
    languages: web/app/languages
    themes: web/app/themes

This structure works well for -u but will fail for -d: This does not seem to be a WordPress installation because /path/to/project isn't the WordPress directory.

Right now, I have to switch between those two wordmove config depending what I want to sync (-d or -u).

How can Wordmove handle better those cases?

WP-CLI provides a way to set the WordPress path with a wp-cli.yml file at the root of the project.

WP-CLI also find its way to WordPress in some cases. It will then work fine when executed from /path/to/project/web so the wordmove config could be like:

stage:
  wordpress_path: /path/to/project/web
  paths:
    wp_content: app
    plugins: app/plugins
    mu_plugins: app/mu-plugins
    uploads: app/uploads
    languages: app/languages
    themes: app/themes

The main issue here is that Wordmove is specifying a --path on each wp commands.

One way to deal with this would be to remove the --path option. WP-CLI is smart enough to handle various scenarios.

Or maybe check for the existence of a wp-cli.yml file at the root of the wordpress_path and if one is found, remove the --path.

Let me know what you think or if I can help. It would nice to make everything work fine on those widely used folder structures.

Cheers!

@alessandro-fazzi
Copy link
Member

Further reading maybe related #479

@alessandro-fazzi
Copy link
Member

For sure related reading #513

@nlemoine
Copy link
Contributor Author

#479 is already mentionned ;)

@nlemoine
Copy link
Contributor Author

Very interesting PR #513, that's where the --path comes from!

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

Successfully merging a pull request may close this issue.

2 participants