You are here

function hostingService_http_apache::default_restart_cmd in Hosting 7.4

Same name and namespace in other branches
  1. 6.2 web_server/hosting_web_server.service.inc \hostingService_http_apache::default_restart_cmd()
  2. 7.3 web_server/hosting_web_server.service.inc \hostingService_http_apache::default_restart_cmd()

Overrides hostingService::default_restart_cmd

1 call to hostingService_http_apache::default_restart_cmd()
hostingService_http_apache::provisionProperties in web_server/hosting_web_server.service.inc
Return service properties to Provision CLI.

File

web_server/hosting_web_server.service.inc, line 35
Hosting service classes for the Hosting web server module.osting service classes for the Hosting web server module.

Class

hostingService_http_apache

Code

function default_restart_cmd() {
  $command = '/usr/sbin/apache2ctl';

  # a proper default for most of the world
  if (isset($_SERVER['PATH'])) {
    foreach (explode(':', $_SERVER['PATH']) as $path) {
      $options[] = "{$path}/apache2ctl";
      $options[] = "{$path}/apachectl";
    }
  }

  # try to detect the apache restart command
  $options[] = '/usr/local/sbin/apachectl';

  # freebsd
  $options[] = '/usr/sbin/apache2ctl';

  # debian + apache2
  $options[] = $command;
  foreach ($options as $test) {
    if (is_executable($test)) {
      $command = $test;
      break;
    }
  }
  return "sudo {$command} graceful";
}