diff --git a/includes/backend.inc b/includes/backend.inc index f09a7bf4a45e03c3990899372298a8f9f5644d34..fd4cb1fc84148f8f1998bedef034e4eb6af9207c 100644 --- a/includes/backend.inc +++ b/includes/backend.inc @@ -298,7 +298,7 @@ function _drush_proc_open($cmd, $data = NULL, $context = NULL) { * Optional. Defaults to the current user. If you specify this, you can choose which module to send. * * @deprecated Command name includes arguments, and these are not quote-escaped in any way. - * @see drush_backend_invoke_args and @see drush_invoke_process for better options. + * @see drush_invoke_process("@self", $command, array($arg1, $arg2, ...), $data) for a better option. * * @return * If the command could not be completed successfully, FALSE. @@ -313,9 +313,8 @@ function drush_backend_invoke($command, $data = array(), $method = 'GET', $integ /** * A variant of drush_backend_invoke() which specifies command and arguments separately. * - * @deprecated Is not as extensible as drush_backend_invoke_sitealias; @see http://drupal.org/node/766080 - * @see drush_invoke_sitealias_args() and @see drush_invoke_process and - * @see drush_backend_invoke_sitealias() for better options. + * @deprecated; do not call directly. + * @see drush_invoke_process("@self", $command, $args, $data) for a better option. */ function drush_backend_invoke_args($command, $args, $data = array(), $method = 'GET', $integrate = TRUE, $drush_path = NULL, $hostname = NULL, $username = NULL, $ssh_options = NULL) { $cmd = _drush_backend_generate_command($command, $args, $data, $method, $drush_path, $hostname, $username, $ssh_options); @@ -362,6 +361,9 @@ function drush_backend_invoke_args($command, $args, $data = array(), $method = ' * * @return * A text string representing a fully escaped command. + * + * @deprecated; do not call directly. + * @see drush_invoke_process($site_record, $command, $args, $data) for a better option. */ function drush_backend_invoke_sitealias($site_record, $command, $args, $data = array(), $method = 'GET', $integrate = TRUE) { $cmd = _drush_backend_generate_command_sitealias($site_record, $command, $args, $data, $method); diff --git a/includes/command.inc b/includes/command.inc index c133b85f667fb787154ccdabc7a08e7a75322360..de876c54b20fef97ff16ce42a536c3bbede08a6f 100644 --- a/includes/command.inc +++ b/includes/command.inc @@ -221,20 +221,41 @@ function drush_dispatch($command, $arguments = array()) { } /** - * Invoke a command in a new process. + * Invoke a command in a new process, targeting the site specified by + * the provided site alias record. * - * @param command_name - * The drush command to execute. + * @param array $site_alias_record + * The site record to execute the command on. + * @param string $command_name + * The command to invoke. + * @param array $commandline_args + * The arguments to pass to the command. + * @param array $commandline_options + * The options (e.g. --select) to provide to the command. * @return * If the command could not be completed successfully, FALSE. * If the command was completed, this will return an associative * array containing the results of the API call. * @see drush_backend_get_result() + * + * This function may also be called via its deprecated function signature + * (drush-3.x compatible): drush_invoke_process($command_name, $arg1, $arg2, ...); + * Instead of this old form, prefer: drush_invoke_process("@self", $command_name, array($arg1, $arg2, ...)); */ -function drush_invoke_process($command_name) { - $args = func_get_args(); - array_shift($args); - return drush_invoke_process_args($command_name, $args); +function drush_invoke_process($site_alias_record /*, $command_name, $commandline_args = array(), $commandline_options = array() */) { + if (is_array($site_alias_record)) { + $args = func_get_args(); + array_shift($args); + $command_name = array_shift($args); + $commandline_args = empty($args) ? array() : array_shift($args); + $commandline_options = empty($args) ? array() : array_shift($args); + return drush_invoke_sitealias_args($site_alias_record, $command_name, $commandline_args, $commandline_options); + } + else { + $args = func_get_args(); + $command_name = array_shift($args); + return drush_invoke_process_args($command_name, $args); + } } /** @@ -247,6 +268,7 @@ function drush_invoke_process($command_name) { * If the command was completed, this will return an associative * array containing the results of the API call. * @see drush_backend_get_result() + * @deprecated; @see drush_invoke_process("@self", $command_name, $commandline_args, $commandline_options) for a better option */ function drush_invoke_process_args($command_name, $commandline_args, $commandline_options = array()) { return drush_backend_invoke_args($command_name, $commandline_args, $commandline_options); @@ -265,6 +287,7 @@ function drush_invoke_process_args($command_name, $commandline_args, $commandlin * If the command was completed, this will return an associative * array containing the results of the API call. * @see drush_backend_get_result() + * @deprecated; @see drush_invoke_process($site_alias_record, $command_name, array($arg1, $arg2, ...)) for a better option */ function drush_invoke_sitealias($site_alias_record, $command_name) { $args = func_get_args(); @@ -291,6 +314,7 @@ function drush_invoke_sitealias($site_alias_record, $command_name) { * If the command was completed, this will return an associative * array containing the results of the API call. * @see drush_backend_get_result() + * @deprecated; @see drush_invoke_process($site_alias_record, $command_name, $commandline_args, $commandline_options) for a better option */ function drush_invoke_sitealias_args($site_alias_record, $command_name, $commandline_args, $commandline_options = array()) { // If the first parameter is not a site alias record,