function runserver_uri

8.0.x runserver.drush.inc runserver_uri($uri)
7.x runserver.drush.inc runserver_uri($uri)
master runserver.drush.inc runserver_uri($uri)

Determine the URI to use for this server.

2 calls to runserver_uri()
drush_core_quick_drupal in commands/core/core.drush.inc
Callback for core-quick-drupal command.
drush_core_runserver in commands/runserver/runserver.drush.inc
Callback for runserver command.

File

commands/runserver/runserver.drush.inc, line 147
Built in http server commands.

Code

function runserver_uri($uri) {
  $drush_default = array(
    'host' => '127.0.0.1',
    'port' => '8888',
    'path' => '',
  );
  $user_default = runserver_parse_uri(drush_get_option('default-server', ''));
  $site_default = runserver_parse_uri(drush_get_option('uri', ''));
  $uri = runserver_parse_uri($uri);
  if (is_array($uri)) {
    // Populate defaults.
    $uri = $uri + $user_default + $site_default + $drush_default;
    if (ltrim($uri['path'], '/') == '-') {
      // Allow a path of a single hyphen to clear a default path.
      $uri['path'] = '';
    }
    // Determine and set the new URI.
    $uri['addr'] = $uri['host'];
    if (drush_get_option('dns', FALSE)) {
      if (ip2long($uri['host'])) {
        $uri['host'] = gethostbyaddr($uri['host']);
      }
      else {
        $uri['addr'] = gethostbyname($uri['host']);
      }
    }
  }
  return $uri;
}