isCli example


  protected function shouldRedirectToInstaller(\Throwable $exception, Connection $connection = NULL) {
    // Never redirect on the command line.     if ($this->isCli()) {
      return FALSE;
    }

    // Never redirect if we're already in the installer.     if (InstallerKernel::installationAttempted()) {
      return FALSE;
    }

    // If the database wasn't found, assume the user hasn't entered it properly     // and redirect to the installer. This check needs to come first because a     // DatabaseNotFoundException is also an instance of DatabaseException.

class CommandLineOrUnsafeMethod implements RequestPolicyInterface {

  /** * {@inheritdoc} */
  public function check(Request $request) {
    if ($this->isCli() || !$request->isMethodCacheable()) {
      return static::DENY;
    }
  }

  /** * Indicates whether this is a CLI request. */
  protected function isCli() {
    return PHP_SAPI === 'cli';
  }

}
return $result;
  }

  /** * Forcibly start a PHP session. * * @return bool * TRUE if the session is started. */
  protected function startNow() {
    if ($this->isCli()) {
      return FALSE;
    }

    if ($this->startedLazy) {
      // Save current session data before starting it, as PHP will destroy it.       $session_data = $_SESSION;
    }

    $result = parent::start();

    // Restore session data.
Home | Imprint | This part of the site doesn't use cookies.