db-checkpoint icon indicating copy to clipboard operation
db-checkpoint copied to clipboard

Request for hook (or arg) for setting db storage location.

Open skoskie opened this issue 4 years ago • 0 comments

I love your WP-CLI package, but I don't like storing backups in the web-accessible directories. Would it be possible to either place a hook here or add an argument to override the default so I can instead target ~ABSPATH . '../snapshots/?

The hook/arg would go about here: https://github.com/binarygary/db-checkpoint/blob/7e67f215eed00f6f361761aafc2fb0f447d34559/db-checkpoint.php#L43

Here's a quick example of a hook directly from the WP-CLI core project. It seems like it would be a pretty quick addition

// Set up hook for plugins and themes to conditionally add WP-CLI commands.
WP_CLI::add_wp_hook('init', static function () {				
    do_action( 'cli_init' );			
});

If using args, I believe (never done this before) you can use WP_CLI->parse_args() to get what you need. There are a few parsing functions, which begin here:

https://github.com/wp-cli/wp-cli/blob/ef150d3598b851c7acd12a359058c12823583a5c/php/WP_CLI/Configurator.php#L132

Many thanks for your time on this project.

skoskie avatar Jun 03 '21 19:06 skoskie