This change on line 213 breaks installs with wp-config.php one directory above ABSPATH. It ends up stripping (in my case) public_html from the real ABSPATH path. So an attempt to download a backup zip using the path calculated in admin/actions.php (https://github.com/humanmade/backupwordpress/blob/master/admin/actions.php#L125) it ends up looking like http//mydomain.com/public_html/wp-content/backupwordpress-xxxx... where the public_html should not be there.
Two things:
Why do you think you cannot trust ABSPATH? WordPress has already worked it out in wp-load.php
Why are the path calculations not based on WP_CONTENT_DIR/WP_CONTENT_URL/wp_upload_dir() as they seem to be in other places in the code?
This is definitely a regression, I've opened #64 so we can fix.
Why do you think you cannot trust ABSPATH? WordPress has already worked it out in wp-load.php
ABSPATH is the path equivalent of site_url(), thus if WordPress is installed in a subdirectory ABSPATH is the path to the subdirectory, we need the path to the root of the site (as that is where we backup from).
Why are the path calculations not based on WP_CONTENT_DIR/WP_CONTENT_URL/wp_upload_dir() as they seem to be in other places in the code?
The backup download url could be calculated using WP_CONTENT_URL however that would break download urls for people who store backups in a folder outside of WP_CONTENT_DIR but still inside web root (admittedly that's probably not something many/anyone is doing).
HM_Backup::get_home_path() needs unit tests ideally.
This comment has been minimized.
This change on line 213 breaks installs with wp-config.php one directory above ABSPATH. It ends up stripping (in my case) public_html from the real ABSPATH path. So an attempt to download a backup zip using the path calculated in admin/actions.php (https://github.com/humanmade/backupwordpress/blob/master/admin/actions.php#L125) it ends up looking like http//mydomain.com/public_html/wp-content/backupwordpress-xxxx... where the public_html should not be there.
Two things:
This comment has been minimized.
This is definitely a regression, I've opened #64 so we can fix.
ABSPATH
is the path equivalent ofsite_url()
, thus if WordPress is installed in a subdirectoryABSPATH
is the path to the subdirectory, we need the path to the root of the site (as that is where we backup from).The backup download url could be calculated using
WP_CONTENT_URL
however that would break download urls for people who store backups in a folder outside ofWP_CONTENT_DIR
but still inside web root (admittedly that's probably not something many/anyone is doing).HM_Backup::get_home_path()
needs unit tests ideally.