function _drush_backend_generate_command

8.0.x backend.inc _drush_backend_generate_command($site_record, $command, $args = array(), $command_options = array(), $backend_options = array())
6.x backend.inc _drush_backend_generate_command($site_record, $command, $args = array(), $command_options = array(), $backend_options = array())
7.x backend.inc _drush_backend_generate_command($site_record, $command, $args = array(), $command_options = array(), $backend_options = array())
3.x backend.inc _drush_backend_generate_command($command, $args, &$data, $method = 'GET', $drush_path = null, $hostname = null, $username = null, $ssh_options = NULL)
4.x backend.inc _drush_backend_generate_command($command, $args, &$data, $method = 'GET', $drush_path = null, $hostname = null, $username = null, $ssh_options = NULL)
5.x backend.inc _drush_backend_generate_command($site_record, $command, $args = array(), $command_options = array(), $backend_options = array())
master backend.inc _drush_backend_generate_command($site_record, $command, $args = array(), $command_options = array(), $backend_options = array())

Generate a command to execute.

@deprecated Is not as flexible as recommended command.

Parameters

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.

drush_path: 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.

hostname: Optional. A remote host to execute the drush command on.

username: Optional. Defaults to the current user. If you specify this, you can choose which module to send.

Return value

A text string representing a fully escaped command.

See also

_drush_backend_generate_command_sitealias().

2 calls to _drush_backend_generate_command()
drush_backend_fork in includes/backend.inc
A small utility function to call a drush command in the background.
drush_backend_invoke_args in includes/backend.inc
A variant of drush_backend_invoke() which specifies command and arguments separately.

File

includes/backend.inc, line 453
Drush backend API

Code

function _drush_backend_generate_command($command, $args, &$data, $method = 'GET', $drush_path = null, $hostname = null, $username = null, $ssh_options = NULL) {
  return _drush_backend_generate_command_sitealias(array(
    'remote-host' => $hostname,
    'remote-user' => $username,
    'ssh-options' => $ssh_options,
    'path-aliases' => array(
      '%drush-script' => $drush_path,
    ),
  ), $command, $args, $data, $method);
}