On WordPress.com, we'd like to add --blog_id=<id> as a global argument. WordPress.com has all sorts domain transformation logic in a long sunrise.php so, in certain cases, it would be more reliable to pass a specific --blog_id=<id> argument.
The idea was originally discussed in #854 (comment)
Because --blog_id=<id> still requires some blog id -> URL lookup, I'm still not convinced it's something WP-CLI should be responsible for. However, third-party code (via sunrise.php or similar) could easily perform this logic, so it would be nice if it was possible to register --blog_id=<id> as a global argument.
A couple of ideas:
- Have some form of filtering mechanism for the return values of
WP_CLI::get_configurator():
|
public static function get_configurator() { |
|
static $configurator; |
|
|
|
if ( ! $configurator ) { |
|
$configurator = new Configurator( WP_CLI_ROOT . '/php/config-spec.php' ); |
|
} |
|
|
|
return $configurator; |
|
} |
- Allow a custom path to be defined for
config-spec.php:
|
$configurator = new Configurator( WP_CLI_ROOT . '/php/config-spec.php' ); |
I kind of like the second option, which would give the environment control over which global arguments were available. I'm not sure what breaks when you remove one, though.
On WordPress.com, we'd like to add
--blog_id=<id>as a global argument. WordPress.com has all sorts domain transformation logic in a longsunrise.phpso, in certain cases, it would be more reliable to pass a specific--blog_id=<id>argument.The idea was originally discussed in #854 (comment)
Because
--blog_id=<id>still requires some blog id -> URL lookup, I'm still not convinced it's something WP-CLI should be responsible for. However, third-party code (viasunrise.phpor similar) could easily perform this logic, so it would be nice if it was possible to register--blog_id=<id>as a global argument.A couple of ideas:
WP_CLI::get_configurator():wp-cli/php/class-wp-cli.php
Lines 61 to 69 in 0c427c5
config-spec.php:wp-cli/php/class-wp-cli.php
Line 65 in 0c427c5
I kind of like the second option, which would give the environment control over which global arguments were available. I'm not sure what breaks when you remove one, though.