You are here

public function SjApiClient::addJob in Acquia Cloud Site Factory Connector 8

Same name and namespace in other branches
  1. 8.2 acsf_sj/src/Api/SjApiClient.php \Drupal\acsf_sj\Api\SjApiClient::addJob()

Adds a scheduled job.

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

bool Returns TRUE on a non-zero exit code signaling that the sjadd command succeeded.

Overrides SjClientInterface::addJob

1 method overrides SjApiClient::addJob()
SjLocalDevClient::addJob in acsf_sj/src/Api/SjLocalDevClient.php
Adds a scheduled job.

File

acsf_sj/src/Api/SjApiClient.php, line 53

Class

SjApiClient
Provides a Scheduled Jobs API client.

Namespace

Drupal\acsf_sj\Api

Code

public function addJob($drush_command, $reason = NULL, $timestamp = NULL, $domain = NULL, $timeout = NULL, $drush_executable = NULL, $drush_options = NULL) {
  try {
    $this
      ->inputValidation($drush_command, $timestamp, $domain, $timeout, $drush_executable, $drush_options);
  } catch (\Exception $e) {
    $this->logger
      ->log(LogLevel::ERROR, 'Unable to add the scheduled job: @message', [
      '@message' => $e
        ->getMessage(),
    ]);
    return FALSE;
  }
  $sjadd_arguments = $this
    ->prepareCommandArguments($drush_command, $reason, $timestamp, $domain, $timeout, $drush_executable, $drush_options);
  return $this
    ->executeSjAdd($sjadd_arguments);
}