You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which ends up in Path::get_home_path through Path::get_root and Path::get_calculated_root. In Path::get_home_path a check is being made, whether the siteurl and home are the same.
In a case where the installation has a different home than siteurl, this enters this branch, and then it is tried to set the home_path based on the SCRIPT_FILENAME.
However, if backupwordpress is used through wp-cli, the SCRIPT_FILENAME for example is the phar file of wp-cli, (e.g. /usr/libexec/wp-cli/wp-cli.phar) and so everything breaks and home is set to an empty string in the end, meaning root is an empty string and so the above error is fired.
When we pass --root=/foo on the cli to the backup command, everything works, as Path::get_calculated_root returns the manually set root-directory.
As I don't fully understand the reasoning behind the branch in Path::get_home_path and the tricks behind using SCRIPT_FILENAME, I'm not really able to say how it should be fixed and I guess somebody with more experience behind this particular code has to look into it.
The text was updated successfully, but these errors were encountered:
duritong
added a commit
to duritong/puppet-wordpress
that referenced
this issue
Jan 19, 2017
This is mainly to work around a bug in backupwordpress if home and
siteurl are not the same.
See xibodevelopment/backupwordpress#1162 for
technical details
Description of issue
Running backupwordpress through wp-cli, on an installation that has a different home and site url, always failed with: "Invalid root path"
Using
--root
on the cli works around this problem.Details
I tracked this down to https://github.com/humanmade/backupwordpress/blob/master/classes/class-backupwordpress-wp-cli-command.php#L68-L70
Which ends up in
Path::get_home_path
throughPath::get_root
andPath::get_calculated_root
. InPath::get_home_path
a check is being made, whether the siteurl and home are the same.https://github.com/humanmade/backupwordpress/blob/master/classes/class-path.php#L110
In a case where the installation has a different home than siteurl, this enters this branch, and then it is tried to set the home_path based on the
SCRIPT_FILENAME
.https://github.com/humanmade/backupwordpress/blob/master/classes/class-path.php#L113
However, if backupwordpress is used through wp-cli, the
SCRIPT_FILENAME
for example is the phar file of wp-cli, (e.g./usr/libexec/wp-cli/wp-cli.phar
) and so everything breaks and home is set to an empty string in the end, meaning root is an empty string and so the above error is fired.When we pass
--root=/foo
on the cli to the backup command, everything works, asPath::get_calculated_root
returns the manually set root-directory.As I don't fully understand the reasoning behind the branch in
Path::get_home_path
and the tricks behind usingSCRIPT_FILENAME
, I'm not really able to say how it should be fixed and I guess somebody with more experience behind this particular code has to look into it.The text was updated successfully, but these errors were encountered: