You are here

public function PhpSapi::run in Automatic Updates 8

Run check.

Return value

array An array of translatable strings.

Overrides ReadinessCheckerInterface::run

File

src/ReadinessChecker/PhpSapi.php, line 34

Class

PhpSapi
Warn if PHP SAPI changes between checker executions.

Namespace

Drupal\automatic_updates\ReadinessChecker

Code

public function run() {
  $messages = [];
  $php_sapi = $this->state
    ->get('automatic_updates.php_sapi', PHP_SAPI);
  if ($php_sapi !== PHP_SAPI) {
    $messages[] = $this
      ->t('PHP changed from running as "@previous" to "@current". This can lead to inconsistent and misleading results.', [
      '@previous' => $php_sapi,
      '@current' => PHP_SAPI,
    ]);
  }
  $this->state
    ->set('automatic_updates.php_sapi', PHP_SAPI);
  return $messages;
}