You are here

function Provision_Service_http_https_nginx::verify_server_cmd in Aegir HTTPS 7.3

Verify server.

Overrides Provision_Service_http_https::verify_server_cmd

File

submodules/nginx_https/drush/Provision/Service/http/https/nginx.php, line 103

Class

Provision_Service_http_https_nginx
Nginx HTTPS service class.

Code

function verify_server_cmd() {

  // Find nginx executable.
  if (provision_file()
    ->exists('/usr/local/sbin/nginx')
    ->status()) {
    $path = "/usr/local/sbin/nginx";
  }
  elseif (provision_file()
    ->exists('/usr/sbin/nginx')
    ->status()) {
    $path = "/usr/sbin/nginx";
  }
  elseif (provision_file()
    ->exists('/usr/local/bin/nginx')
    ->status()) {
    $path = "/usr/local/bin/nginx";
  }
  else {
    return;
  }

  // Check if some nginx features are supported and save them for later.
  $this->server
    ->shell_exec($path . ' -V');
  $this->server->nginx_is_modern = preg_match("/nginx\\/1\\.((1\\.(8|9|(1[0-9]+)))|((2|3|4|5|6|7|8|9|[1-9][0-9]+)\\.))/", implode('', drush_shell_exec_output()), $match);
  $this->server->nginx_has_http2 = preg_match("/http_v2_module/", implode('', drush_shell_exec_output()), $match);
  $this->server->nginx_has_upload_progress = preg_match("/upload/", implode('', drush_shell_exec_output()), $match);
  $this->server->nginx_has_gzip = preg_match("/http_gzip_static_module/", implode('', drush_shell_exec_output()), $match);

  // Use basic nginx configuration if this control file exists.
  $nginx_config_mode_file = "/etc/nginx/basic_nginx.conf";
  if (provision_file()
    ->exists($nginx_config_mode_file)
    ->status()) {
    $this->server->nginx_config_mode = 'basic';
    drush_log(dt('Basic Nginx Config Active -VERIFY- YES control file found @path.', array(
      '@path' => $nginx_config_mode_file,
    )));
  }
  else {
    $this->server->nginx_config_mode = 'extended';
    drush_log(dt('Extended Nginx Config Active -VERIFY- NO control file found @path.', array(
      '@path' => $nginx_config_mode_file,
    )));
  }

  // Check if there is php-fpm listening on unix socket, otherwise use port 9000 to connect
  $this->server->phpfpm_mode = Provision_Service_http_nginx::getPhpFpmMode('verify');

  // Check if there is BOA specific global.inc file to enable extra Nginx locations
  if (provision_file()
    ->exists('/data/conf/global.inc')
    ->status()) {
    $this->server->satellite_mode = 'boa';
    drush_log(dt('BOA mode detected -VERIFY- YES file found @path.', array(
      '@path' => '/data/conf/global.inc',
    )));
  }
  else {
    $this->server->satellite_mode = 'vanilla';
    drush_log(dt('Vanilla mode detected -VERIFY- NO file found @path.', array(
      '@path' => '/data/conf/global.inc',
    )));
  }

  // Call the parent at the end. it will restart the server when it finishes.
  parent::verify_server_cmd();
}