function drush_backend_invoke_sitealias

4.x drush_backend_invoke_sitealias($site_record, $command, $args, $data = array(), $method = 'GET', $integrate = TRUE)

Execute a new local or remote command in a new process.

@deprecated; do not call directly.


site_record: An array containing information used to generate the command. 'remote-host' Optional. A remote host to execute the drush command on. 'remote-user' Optional. Defaults to the current user. If you specify this, you can choose which module to send. 'ssh-options' Optional. Defaults to "-o PasswordAuthentication=no" 'path-aliases' Optional; contains paths to folders and executables useful to the command. '%drush-script' Optional. Defaults to the current drush.php file on the local machine, and to simply 'drush' (the drush script in the current PATH) on remote servers. You may also specify a different drush.php script explicitly. You will need to set this when calling drush on a remote server if 'drush' is not in the PATH on that machine.

command: A defined drush command such as 'cron', 'status' or any of the available ones such as 'drush pm'.

args: An array of arguments for the command.

data: Optional. An array containing options to pass to the remote script. Array items with a numeric key are treated as optional arguments to the command. This parameter is a reference, as any options that have been represented as either an option, or an argument will be removed. This allows you to pass the left over options as a JSON encoded string, without duplicating data.

method: Optional. Defaults to 'GET'. If this parameter is set to 'POST', the $data array will be passed to the script being called as a JSON encoded string over the STDIN pipe of that process. This is preferable if you have to pass sensitive data such as passwords and the like. For any other value, the $data array will be collapsed down into a set of command line options to the script.

integrate: Optional. Defaults to TRUE. If TRUE, any error statuses or log messages will be integrated into the current process. This might not be what you want, if you are writing a command that operates on multiple sites.

Return value

A text string representing a fully escaped command.

See also

drush_invoke_process($site_record, $command, $args, $data) for a better option.

1 call to drush_backend_invoke_sitealias()
drush_do_site_command in includes/
Run a command on the site specified by the provided command record.


includes/, line 368
Drush backend API


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);
  return _drush_backend_invoke($cmd, $data, array_key_exists('#integrate', $data) ? $data['#integrate'] : $integrate);