welaika / wordmove

Multi-stage command line deploy/mirroring and task runner for Wordpress
https://wptools.it/wordmove
MIT License
1.87k stars 165 forks source link

WordPress in a subdirectory #72

Closed nlemoine closed 8 years ago

nlemoine commented 10 years ago

Hi,

I'm using WordPress in a subdirectory and I'm setting my own content, plugins, plugins-mu directories. Here's my folder structure:

|-www
 |---content
 |---plugins
 |---plugins-mu
 |---wp

Although Wordmove plays nicely with custom directories (with paths), it doesn't deal with WordPress in a subdirectory. From what I observed, it takes the WordPress path and adds the custom paths behind. I'm for example ending up with something like:

/my/path/to/project/www/wp/content/

instead of:

/my/path/to/project/www/content/

As I'm mostly using Wordmove for database migration, it's fine and I can deal with this "issue" by setting paths like:

content: "../content"

But it would be nice that Wordmove considers content, plugins, uploads, etc. folders as not necessarily contained by wordpress directory (e.g. sometimes absolute content path isn't wordpress absolute path + content relative path). Maybe by detecting absolute path in paths?

tikot commented 9 years ago

+1 This is a good idea to have WordPress core in subdirectory. Specially if your are using version control like git.

garypburton commented 9 years ago

+1 From me also. Would be great to have support for this.

jasonlmann commented 9 years ago

+1. @nlemoine I have a similar setup. (I used Mark Jaquith's WP-Skeleton to add Wordpress as a Git submodule.)

When I try your method above like this:

  paths: # you can customize wordpress internal paths
    wp_content: "../content"
    uploads: "../content/uploads"
    plugins: "../content/plugins"
    themes: "../content/themes"

The directory it looks for is:

 :/home/jasonlmann/wwf.kinggin.com/wp/../content/themes
rsync: Failed to exec sshpass: No such file or directory (2)

Were you able to get this to work?

nlemoine commented 9 years ago

@jasonlmann, sure, it should work this way.

/home/jasonlmann/wwf.kinggin.com/wp/../content/themes equals /home/jasonlmann/wwf.kinggin.com/content/themes

Are you certain that the directory exists?

onlyskyguy commented 8 years ago

I'm having a similar issue when trying to pull DB from remote to local vvv install:

I have WP installed on a remote server in a subdirectory called "wp"

So the path to wp-content on remote is:

httpdocs/wp/wp-content

Without setting anything other than the Wordpress path for the remote server in the movefile:

production:
  vhost: "http://mywebsite.com"
  wordpress_path: "/httpdocs/wp/" 

..all plugin, theme, and upload files pulled fine into my vvv setup!

BUT pulling the database throws an error:

`open_http': 404 Not Found (OpenURI::HTTPError)

...because it's looking for the dump file on remote in the wrong place... (disregarding the wp subdirectory). Here's the full error (real paths are changed for this post):

vagrant@vvv:/srv/www/mysite$ wordmove pull -e production -v -d

▬▬ ✓ Using Movefile: ./Movefile ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

▬▬ ✓ Pulling Database ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
mysqldump --host=127.0.0.1 --user=wp --password=wp mysite --result-file=/srv/www/mysite/htdocs/wp-content/local-backup-1449213259.sql
    local | mysqldump --host=127.0.0.1 --user=wp --password=wp mysite --result-file=/srv/www/mysite/htdocs/wp-content/local-backup-1449213259.sql
   remote | write /httpdocs/wp/wp-content/dump.php
    local | download http://mysite.com/wp-content/dump.php?shared_key=32c679c4ff9d27f04f7a8391c9fe9154798fecd46ff07163c7aeb73f34c3517f034a582678865acd > /srv/www/mysite/htdocs/wp-content/dump.sql
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/open-uri.rb:358:in `open_http': 404 Not Found (OpenURI::HTTPError)
    from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/open-uri.rb:736:in `buffer_open'
    from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/open-uri.rb:211:in `block in open_loop'
    from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/open-uri.rb:209:in `catch'
    from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/open-uri.rb:209:in `open_loop'
    from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/open-uri.rb:150:in `open_uri'
    from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/open-uri.rb:716:in `open'
    from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/open-uri.rb:34:in `open'
    from /usr/local/rvm/gems/ruby-2.2.1/gems/wordmove-1.3.1/lib/wordmove/deployer/base.rb:145:in `block in download'
    from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/open-uri.rb:36:in `open'
    from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/open-uri.rb:36:in `open'
    from /usr/local/rvm/gems/ruby-2.2.1/gems/wordmove-1.3.1/lib/wordmove/deployer/base.rb:144:in `download'
    from /usr/local/rvm/gems/ruby-2.2.1/gems/wordmove-1.3.1/lib/wordmove/deployer/ftp.rb:101:in `download_remote_db'
    from /usr/local/rvm/gems/ruby-2.2.1/gems/wordmove-1.3.1/lib/wordmove/deployer/ftp.rb:40:in `pull_db'
    from /usr/local/rvm/gems/ruby-2.2.1/gems/wordmove-1.3.1/lib/wordmove/cli.rb:49:in `block in pull'
    from /usr/local/rvm/gems/ruby-2.2.1/gems/wordmove-1.3.1/lib/wordmove/cli.rb:36:in `block in handle_options'
    from /usr/local/rvm/gems/ruby-2.2.1/gems/wordmove-1.3.1/lib/wordmove/cli.rb:34:in `each'
    from /usr/local/rvm/gems/ruby-2.2.1/gems/wordmove-1.3.1/lib/wordmove/cli.rb:34:in `handle_options'
    from /usr/local/rvm/gems/ruby-2.2.1/gems/wordmove-1.3.1/lib/wordmove/cli.rb:48:in `pull'
    from /usr/local/rvm/gems/ruby-2.2.1/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    from /usr/local/rvm/gems/ruby-2.2.1/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /usr/local/rvm/gems/ruby-2.2.1/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
    from /usr/local/rvm/gems/ruby-2.2.1/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    from /usr/local/rvm/gems/ruby-2.2.1/gems/wordmove-1.3.1/exe/wordmove:6:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-2.2.1/bin/wordmove:23:in `load'
    from /usr/local/rvm/gems/ruby-2.2.1/bin/wordmove:23:in `<main>'
    from /usr/local/rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `eval'
    from /usr/local/rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `<main>'

The problem is here:

local | download http://mysite.com/wp-content/dump.php...

How come it doesn't look for the dump download in the right place on remote? Like I said before, no problems with plugins, theme, or uploads, and it seems to know where to CREATE the dump on the remote in the first place.

Thanks for any help with this!

Ikaring commented 8 years ago

@onlyskyguy, as I have commented on #228, I had same situation. You can achieve pull -d by setting movefile like:

production: vhost: "http://mywebsite.com/wp" wordpress_path: "/httpdocs/wp"

And add the following( or your local domain ) to wp-config.php to force setting wp_home option:

define( 'WP_HOME', 'http://mywebsite.com' ); define( 'WP_SITEURL', 'http://mywebsite.com/wp' );

mukkoo commented 8 years ago

We consider this resolved. Add these instructions to documentation.

nghh commented 5 years ago

Hi, I'm having a similar setup and can't get it to work.

a wordpress core push is working perfectly fine

wordmove push -e staging -w

but none of the wp-content pushes are working. e.g.:

wordmove push -e staging -u

gives me:

▬▬ Pushing Uploads ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
   remote | put_directory: /Users/me/Sites/clients/client/wwwroot/wp /vhosts/domain/subdomains/dev/wwwroot/wp /../content/* /../* .git/ .gitignore .gitmodules .envnode_modules/ bin/ tmp/* Gemfile* Movefile movefile movefile.yml movefile.yaml wp-config.php wp-content/*.sql.gz *.orig /* /../content/uploads/ /../content/ /../
    ℹ️  info | rsync --progress -e 'ssh onside' -rlpt --compress --omit-dir-times --delete --include /../content/uploads/ --include /../content/ --include /../ --exclude /../content/\* --exclude /../\* --exclude .git/ --exclude .gitignore --exclude .gitmodules --exclude .env --exclude node_modules/ --exclude bin/ --exclude tmp/\* --exclude Gemfile\* --exclude Movefile --exclude movefile --exclude movefile.yml --exclude movefile.yaml --exclude wp-config.php --exclude wp-content/\*.sql.gz --exclude \*.orig --exclude /\* /Users/me/Sites/clients/client/wwwroot/wp/ :/vhosts/domain/subdomains/dev/wwwroot/wp
building file list ...
1 file to consider

sent 361 bytes  received 20 bytes  254.00 bytes/sec
total size is 0  speedup is 0.00

but in my content/uploads are some files

pushing DB gives me this error:

local | wp search-replace https://client.local/wp http://dev.client.com/wp --quiet --skip-columns=guid --all-tables --allow-root
Error: This does not seem to be a WordPress installation.

last but not least:

wordmove doctor

gives me following error

Validating movefile section: local ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
    ❌  error | [/paths] key 'paths:' is undefined.

anyone can help me? thx jan

folder structure

|-movefile.yml
|-wwwroot
|--content # my custom wp-content folder
|---themes
|---uploads
|---plugins
|--wp # wordpress core folder
|--wp-config.php

movefile.yml

local:
  vhost: https://client.local/wp
  wordpress_path: /Users/me/Sites/clients/client/wwwroot/wp

  paths:
    uploads: ../content/uploads
    plugins: ../content/plugins
    themes: ../content/themes

staging:
  vhost: https://dev.client.com/wp
  wordpress_path: /vhosts/domain/subdomains/dev/wwwroot/wp

  paths:
    uploads: ../content/uploads
    plugins: ../content/plugins
    themes: ../content/themes

wp-config.php

define('WP_SITEURL', 'https://client.local/wp');
define('WP_HOME', 'https://client.local');