protected function SjApiClient::prepareCommandArguments in Acquia Cloud Site Factory Connector 8
Same name and namespace in other branches
- 8.2 acsf_sj/src/Api/SjApiClient.php \Drupal\acsf_sj\Api\SjApiClient::prepareCommandArguments()
Compiles the argument to the sjadd command.
Parameters
string $drush_command: A drush command to run.
string $reason: The purpose of this job.
int $timestamp: Unix timestamp when the command should be run or NULL to run ASAP.
string $domain: The domain to use when calling the drush command or NULL for the class to determine.
int $timeout: How long in seconds the process should be allowed to run or NULL for system default.
string $drush_executable: The drush binary to use, 'drush' by default. i.e. drush9.
string $drush_options: A list of drush options that will be applied to the drush command. If none are provided, "-y" will be used.
Return value
string The sjadd command.
2 calls to SjApiClient::prepareCommandArguments()
- SjApiClient::addJob in acsf_sj/
src/ Api/ SjApiClient.php - Adds a scheduled job.
- SjLocalDevClient::addJob in acsf_sj/
src/ Api/ SjLocalDevClient.php - Adds a scheduled job.
File
- acsf_sj/
src/ Api/ SjApiClient.php, line 146
Class
- SjApiClient
- Provides a Scheduled Jobs API client.
Namespace
Drupal\acsf_sj\ApiCode
protected function prepareCommandArguments($drush_command, $reason, $timestamp, $domain, $timeout, $drush_executable, $drush_options) {
/*
* Options for sjadd should be placed before its arguments so as to not be
* mistaken for drush options.
*
* Argument order:
* TIMESTAMP DOMAIN [DRUSH_COMMAND] [DRUSH_EXECUTABLE] [DRUSH_OPTIONS...]
*/
$arguments = '';
if (!empty($reason)) {
$arguments .= sprintf('--reason=%s ', escapeshellarg($reason));
}
if (!empty($timeout) && is_numeric($timeout)) {
$arguments .= sprintf('--max-exec-time=%ds ', $timeout);
}
$arguments .= sprintf('%d %s %s %s %s', intval($timestamp), escapeshellarg($domain), escapeshellarg($drush_command), escapeshellarg($drush_executable), escapeshellarg($drush_options));
return $arguments;
}