Skip to content

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

@skoskie

Description

@skoskie

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:

$upload_dir = wp_upload_dir();

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions