You are here

function automatic_updates_console_command in Automatic Updates 8

Helper method to execute console command.

Parameters

string $command_argument: The command argument.

Return value

\Symfony\Component\Process\Process The console command process.

4 calls to automatic_updates_console_command()
DatabaseUpdate::executeDatabaseUpdates in src/Command/DatabaseUpdate.php
Execute all outstanding database updates.
ExecuteUpdates::execute in src/Plugin/DatabaseUpdateHandler/ExecuteUpdates.php
Handle database updates.
InPlaceUpdate::cacheRebuild in src/Services/InPlaceUpdate.php
Clear cache on successful update.
InPlaceUpdate::update in src/Services/InPlaceUpdate.php
Update a project to the next release.

File

./automatic_updates.module, line 183
Contains automatic_updates.module..

Code

function automatic_updates_console_command($command_argument) {
  $module_path = drupal_get_path('module', 'automatic_updates');
  $command = [
    (new PhpExecutableFinder())
      ->find(),
    $module_path . '/scripts/automatic_update_tools',
    $command_argument,
    '--script-filename',
    \Drupal::request()->server
      ->get('SCRIPT_FILENAME'),
    '--base-url',
    \Drupal::request()
      ->getBaseUrl(),
    '--base-path',
    \Drupal::request()
      ->getBasePath(),
  ];
  $process = new Process($command, (string) \Drupal::root(), NULL, NULL, NULL);
  $process
    ->run();
  return $process;
}