Drush: commands/runserver/runserver.drush.inc Source File

  1. 7.x doxygen/html/runserver_8drush_8inc_source.html
  2. master doxygen/html/runserver_8drush_8inc_source.html
Go to the documentation of this file.
1 <?php
2 
3 /**
4  * @file
5  * Built in http server commands.
6  */
7 
8 /**
9  * Implements hook_drush_help().
10  */
11 function runserver_drush_help($section) {
12  switch ($section) {
13  case 'meta:runserver:title':
14  return dt("Runserver commands");
15  case 'meta:runserver:summary':
16  return dt('Launch the built-in PHP webserver.');
17  case 'drush:runserver':
18  return dt("Runs a lightweight built in http server for development.
19  - Don't use this for production, it is neither scalable nor secure for this use.
20  - If you run multiple servers simultaneously, you will need to assign each a unique port.
21  - Use Ctrl-C or equivalent to stop the server when complete.");
22  }
23 }
24 
25 /**
26  * Implements hook_drush_command().
27  */
29  $items = array();
30 
31  $items['runserver'] = array(
32  'description' => 'Runs PHP\'s built-in http server for development.',
33  'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
34  'arguments' => array(
35  'addr:port/path' => 'Host IP address and port number to bind to and path to open in web browser. Format is addr:port/path, default 127.0.0.1:8888, all elements optional. See examples for shorthand.',
36  ),
37  'options' => array(
38  'variables' => 'Key-value array of variables to override in the $conf array for the running site. By default disables drupal_http_request_fails to avoid errors on Windows (which supports only one connection at a time). Comma delimited list of name=value pairs (or array in drushrc).',
39  'default-server' => 'A default addr:port/path to use for any values not specified as an argument.',
40  'user' => 'If opening a web browser, automatically log in as this user (user ID or username).',
41  'browser' => 'If opening a web browser, which browser to user (defaults to operating system default).',
42  'dns' => 'Resolve hostnames/IPs using DNS/rDNS (if possible) to determine binding IPs and/or human friendly hostnames for URLs and browser.',
43  ),
44  'aliases' => array('rs'),
45  'examples' => array(
46  'drush rs 8080' => 'Start runserver on 127.0.0.1, port 8080.',
47  'drush rs 10.0.0.28:80' => 'Start runserver on 10.0.0.28, port 80.',
48  'drush rs [::1]:80' => 'Start runserver on IPv6 localhost ::1, port 80.',
49  'drush rs --dns localhost:8888/user' => 'Start runserver on localhost (using rDNS to determine binding IP), port 8888, and open /user in browser.',
50  'drush rs /' => 'Start runserver on default IP/port (127.0.0.1, port 8888), and open / in browser.',
51  'drush rs --default-server=127.0.0.1:8080/ -' => 'Use a default (would be specified in your drushrc) that starts runserver on port 8080, and opens a browser to the front page. Set path to a single hyphen path in argument to prevent opening browser for this session.',
52  'drush rs :9000/admin' => 'Start runserver on 127.0.0.1, port 9000, and open /admin in browser. Note that you need a colon when you specify port and path, but no IP.',
53  ),
54  );
55  return $items;
56 }
57 
58 /**
59  * Callback for runserver command.
60  */
61 function drush_core_runserver($uri = NULL) {
62  global $user, $base_url;
63 
64  // Determine active configuration.
65  $drush_default = array(
66  'host' => '127.0.0.1',
67  'port' => '8888',
68  'path' => '',
69  );
70  $user_default = runserver_parse_uri(drush_get_option('default-server', '127.0.0.1:8888'));
71  $uri = runserver_parse_uri($uri);
72  if (!$uri) {
73  return $uri;
74  }
75  // Populate defaults.
76  $uri = $uri + $user_default + $drush_default;
77  if (ltrim($uri['path'], '/') == '-') {
78  // Allow a path of a single hyphen to clear a default path.
79  $uri['path'] = '';
80  }
81  // Remove any leading slashes from the path, since that is what url() expects.
82  $path = ltrim($uri['path'], '/');
83 
84  // Determine and set the new URI.
85  $hostname = $addr = $uri['host'];
86  if (drush_get_option('dns', FALSE)) {
87  if (ip2long($hostname)) {
88  $hostname = gethostbyaddr($hostname);
89  }
90  else {
91  $addr = gethostbyname($hostname);
92  }
93  }
94  drush_set_context('DRUSH_URI', 'http://' . $hostname . ':' . $uri['port']);
95 
96  // We pass in the currently logged in user (if set via the --user option),
97  // which will automatically log this user in the browser during the first
98  // request.
99  if (drush_get_option('user', FALSE)) {
101  }
102 
103  // We delete any registered files here, since they are not caught by Ctrl-C.
105 
106  // We set the effective base_url, since we have now detected the current site,
107  // and need to ensure generated URLs point to our runserver host.
108  // We also pass in the effective base_url to our auto_prepend_script via the
109  // CGI environment. This allows Drupal to generate working URLs to this http
110  // server, whilst finding the correct multisite from the HTTP_HOST header.
111  $base_url = 'http://' . $addr . ':' . $uri['port'];
112  $env['RUNSERVER_BASE_URL'] = $base_url;
113 
114  // We pass in an array of $conf overrides using the same approach.
115  // This is available as an option for developers to pass in their own
116  // favorite $conf overrides (e.g. disabling css aggregation).
117  $current_override = drush_get_option_list('variables', array());
118  $override = array();
119  foreach ($current_override as $name => $value) {
120  if (is_numeric($name) && (strpos($value, '=') !== FALSE)) {
121  list($name, $value) = explode('=', $value, 2);
122  }
123  $override[$name] = $value;
124  }
125  $env['RUNSERVER_CONF'] = urlencode(serialize($override));
126 
127  // We log in with the specified user ID (if set) via the password reset URL.
128  $user_message = '';
129  $usersingle = drush_user_get_class()->getCurrentUserAsSingle();
130  if ($usersingle->id()) {
131  $browse = $usersingle->passResetUrl($path);
132  $user_message = ', logged in as ' . $usersingle->getUsername();
133  }
134  else {
135  $browse = drush_url($path);
136  }
137 
138  drush_print(dt('HTTP server listening on !addr, port !port (see http://!hostname:!port/!path), serving site !site!user...', array('!addr' => $addr, '!hostname' => $hostname, '!port' => $uri['port'], '!path' => $path, '!site' => drush_get_context('DRUSH_DRUPAL_SITE', 'default'), '!user' => $user_message)));
139  // Start php 5.4 builtin server.
140  // Store data used by runserver-prepend.php in the shell environment.
141  foreach ($env as $key => $value) {
142  putenv($key . '=' . $value);
143  }
144  if (!empty($uri['path'])) {
145  // Start a browser if desired. Include a 2 second delay to allow the
146  // server to come up.
147  drush_start_browser($browse, 2);
148  }
149  // Start the server using 'php -S'.
150  $php = drush_get_option('php');
151  drush_shell_exec_interactive($php . ' -S ' . $addr . ':' . $uri['port'] . ' --define auto_prepend_file="' . DRUSH_BASE_PATH . '/commands/runserver/runserver-prepend.php"');
152 }
153 
154 /**
155  * Parse a URI or partial URI (including just a port, host IP or path).
156  *
157  * @param string $uri
158  * String that can contain partial URI.
159  *
160  * @return array
161  * URI array as returned by parse_url.
162  */
163 function runserver_parse_uri($uri) {
164  if ($uri[0] == ':') {
165  // ':port/path' shorthand, insert a placeholder hostname to allow parsing.
166  $uri = 'placeholder-hostname' . $uri;
167  }
168  // FILTER_VALIDATE_IP expects '[' and ']' to be removed from IPv6 addresses.
169  // We check for colon from the right, since IPv6 addresses contain colons.
170  $to_path = trim(substr($uri, 0, strpos($uri, '/')), '[]');
171  $to_port = trim(substr($uri, 0, strrpos($uri, ':')), '[]');
172  if (filter_var(trim($uri, '[]'), FILTER_VALIDATE_IP) || filter_var($to_path, FILTER_VALIDATE_IP) || filter_var($to_port, FILTER_VALIDATE_IP)) {
173  // 'IP', 'IP/path' or 'IP:port' shorthand, insert a schema to allow parsing.
174  $uri = 'http://' . $uri;
175  }
176  $uri = parse_url($uri);
177  if (empty($uri)) {
178  return drush_set_error('RUNSERVER_INVALID_ADDRPORT', dt('Invalid argument - should be in the "host:port/path" format, numeric (port only) or non-numeric (path only).'));
179  }
180  if (count($uri) == 1 && isset($uri['path'])) {
181  if (is_numeric($uri['path'])) {
182  // Port only shorthand.
183  $uri['port'] = $uri['path'];
184  unset($uri['path']);
185  }
186  }
187  if (isset($uri['host']) && $uri['host'] == 'placeholder-hostname') {
188  unset($uri['host']);
189  }
190  return $uri;
191 }

File

doxygen/html/runserver_8drush_8inc_source.html
View source
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Drush: commands/runserver/runserver.drush.inc Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Drush
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.1.2 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_afac61274991793aa7e9133a8f4f291e.html">commands</a></li><li class="navelem"><a class="el" href="dir_16fe9915ffd7b912cab2b20df6383591.html">runserver</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">runserver.drush.inc</div>  </div>
</div><!--header-->
<div class="contents">
<a href="runserver_8drush_8inc.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;&lt;?php</div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * @file</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> * Built in http server commands.</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> * Implements hook_drush_help().</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00011"></a><span class="lineno"><a class="code" href="runserver_8drush_8inc.html#ac7d75940098cbae4a2222603912b6b05">   11</a></span>&#160;<span class="keyword">function</span> <a class="code" href="runserver_8drush_8inc.html#ac7d75940098cbae4a2222603912b6b05">runserver_drush_help</a>($section) {</div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;  <span class="keywordflow">switch</span> ($section) {</div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;    <span class="keywordflow">case</span> <span class="stringliteral">&#39;meta:runserver:title&#39;</span>:</div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;      <span class="keywordflow">return</span> <a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&quot;Runserver commands&quot;</span>);</div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;    <span class="keywordflow">case</span> <span class="stringliteral">&#39;meta:runserver:summary&#39;</span>:</div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;      <span class="keywordflow">return</span> <a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;Launch the built-in PHP webserver.&#39;</span>);</div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;    <span class="keywordflow">case</span> <span class="stringliteral">&#39;drush:runserver&#39;</span>:</div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;      <span class="keywordflow">return</span> <a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&quot;Runs a lightweight built in http server for development.</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="stringliteral"> - Don&#39;t use this for production, it is neither scalable nor secure for this use.</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="stringliteral"> - If you run multiple servers simultaneously, you will need to assign each a unique port.</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="stringliteral"> - Use Ctrl-C or equivalent to stop the server when complete.&quot;</span>);</div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;  }</div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;}</div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="comment"> * Implements hook_drush_command().</span></div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00028"></a><span class="lineno"><a class="code" href="runserver_8drush_8inc.html#ac2e927a6bc2378dc6239cc87bbd985d3">   28</a></span>&#160;<span class="keyword">function</span> <a class="code" href="runserver_8drush_8inc.html#ac2e927a6bc2378dc6239cc87bbd985d3">runserver_drush_command</a>() {</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;  $items = array();</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;  $items[<span class="stringliteral">&#39;runserver&#39;</span>] = array(</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;    <span class="stringliteral">&#39;description&#39;</span> =&gt; <span class="stringliteral">&#39;Runs PHP\&#39;s built-in http server for development.&#39;</span>,</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;    <span class="stringliteral">&#39;bootstrap&#39;</span> =&gt; <a class="code" href="lib_2Drush_2Boot_2bootstrap_8inc.html#a6ea86b0ce6756b159a3fdef78fdff159">DRUSH_BOOTSTRAP_DRUPAL_FULL</a>,</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;    <span class="stringliteral">&#39;arguments&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;      <span class="stringliteral">&#39;addr:port/path&#39;</span> =&gt; <span class="stringliteral">&#39;Host IP address and port number to bind to and path to open in web browser. Format is addr:port/path, default 127.0.0.1:8888, all elements optional. See examples for shorthand.&#39;</span>,</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;    ),</div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;    <span class="stringliteral">&#39;options&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;      <span class="stringliteral">&#39;variables&#39;</span> =&gt; <span class="stringliteral">&#39;Key-value array of variables to override in the $conf array for the running site. By default disables drupal_http_request_fails to avoid errors on Windows (which supports only one connection at a time). Comma delimited list of name=value pairs (or array in drushrc).&#39;</span>,</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;      <span class="stringliteral">&#39;default-server&#39;</span> =&gt; <span class="stringliteral">&#39;A default addr:port/path to use for any values not specified as an argument.&#39;</span>,</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;      <span class="stringliteral">&#39;user&#39;</span> =&gt; <span class="stringliteral">&#39;If opening a web browser, automatically log in as this user (user ID or username).&#39;</span>,</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;      <span class="stringliteral">&#39;browser&#39;</span> =&gt; <span class="stringliteral">&#39;If opening a web browser, which browser to user (defaults to operating system default).&#39;</span>,</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;      <span class="stringliteral">&#39;dns&#39;</span> =&gt; <span class="stringliteral">&#39;Resolve hostnames/IPs using DNS/rDNS (if possible) to determine binding IPs and/or human friendly hostnames for URLs and browser.&#39;</span>,</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;    ),</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;    <span class="stringliteral">&#39;aliases&#39;</span> =&gt; array(<span class="stringliteral">&#39;rs&#39;</span>),</div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;    <span class="stringliteral">&#39;examples&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;      <span class="stringliteral">&#39;drush rs 8080&#39;</span> =&gt; <span class="stringliteral">&#39;Start runserver on 127.0.0.1, port 8080.&#39;</span>,</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;      <span class="stringliteral">&#39;drush rs 10.0.0.28:80&#39;</span> =&gt; <span class="stringliteral">&#39;Start runserver on 10.0.0.28, port 80.&#39;</span>,</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;      <span class="stringliteral">&#39;drush rs [::1]:80&#39;</span> =&gt; <span class="stringliteral">&#39;Start runserver on IPv6 localhost ::1, port 80.&#39;</span>,</div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;      <span class="stringliteral">&#39;drush rs --dns localhost:8888/user&#39;</span> =&gt; <span class="stringliteral">&#39;Start runserver on localhost (using rDNS to determine binding IP), port 8888, and open /user in browser.&#39;</span>,</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;      <span class="stringliteral">&#39;drush rs /&#39;</span> =&gt; <span class="stringliteral">&#39;Start runserver on default IP/port (127.0.0.1, port 8888), and open / in browser.&#39;</span>,</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;      <span class="stringliteral">&#39;drush rs --default-server=127.0.0.1:8080/ -&#39;</span> =&gt; <span class="stringliteral">&#39;Use a default (would be specified in your drushrc) that starts runserver on port 8080, and opens a browser to the front page. Set path to a single hyphen path in argument to prevent opening browser for this session.&#39;</span>,</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;      <span class="stringliteral">&#39;drush rs :9000/admin&#39;</span> =&gt; <span class="stringliteral">&#39;Start runserver on 127.0.0.1, port 9000, and open /admin in browser. Note that you need a colon when you specify port and path, but no IP.&#39;</span>,</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;    ),</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;  );</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;  <span class="keywordflow">return</span> $items;</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;}</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;<span class="comment"> * Callback for runserver command.</span></div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00061"></a><span class="lineno"><a class="code" href="runserver_8drush_8inc.html#a8db8226cf620f67826b59f6091142f60">   61</a></span>&#160;<span class="keyword">function</span> <a class="code" href="runserver_8drush_8inc.html#a8db8226cf620f67826b59f6091142f60">drush_core_runserver</a>($uri = NULL) {</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;  global $user, $base_url;</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;  <span class="comment">// Determine active configuration.</span></div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;  $drush_default = array(</div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;    <span class="stringliteral">&#39;host&#39;</span> =&gt; <span class="stringliteral">&#39;127.0.0.1&#39;</span>,</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;    <span class="stringliteral">&#39;port&#39;</span> =&gt; <span class="stringliteral">&#39;8888&#39;</span>,</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;    <span class="stringliteral">&#39;path&#39;</span> =&gt; <span class="stringliteral">&#39;&#39;</span>,</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;  );</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;  $user_default = <a class="code" href="runserver_8drush_8inc.html#a9d96e677a3d7578ccae0f9c821dd6aa6">runserver_parse_uri</a>(<a class="code" href="context_8inc.html#afe91fb3e5219ecb2208c3b036b1f0cb8">drush_get_option</a>(<span class="stringliteral">&#39;default-server&#39;</span>, <span class="stringliteral">&#39;127.0.0.1:8888&#39;</span>));</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;  $uri = <a class="code" href="runserver_8drush_8inc.html#a9d96e677a3d7578ccae0f9c821dd6aa6">runserver_parse_uri</a>($uri);</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;  <span class="keywordflow">if</span> (!$uri) {</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;    <span class="keywordflow">return</span> $uri;</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;  }</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;  <span class="comment">// Populate defaults.</span></div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;  $uri = $uri + $user_default + $drush_default;</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;  <span class="keywordflow">if</span> (ltrim($uri[<span class="stringliteral">&#39;path&#39;</span>], <span class="charliteral">&#39;/&#39;</span>) == <span class="charliteral">&#39;-&#39;</span>) {</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;    <span class="comment">// Allow a path of a single hyphen to clear a default path.</span></div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;    $uri[<span class="stringliteral">&#39;path&#39;</span>] = <span class="stringliteral">&#39;&#39;</span>;</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;  }</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;  <span class="comment">// Remove any leading slashes from the path, since that is what url() expects.</span></div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;  $path = ltrim($uri[<span class="stringliteral">&#39;path&#39;</span>], <span class="charliteral">&#39;/&#39;</span>);</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;  <span class="comment">// Determine and set the new URI.</span></div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;  $hostname = $addr = $uri[<span class="stringliteral">&#39;host&#39;</span>];</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;  <span class="keywordflow">if</span> (<a class="code" href="context_8inc.html#afe91fb3e5219ecb2208c3b036b1f0cb8">drush_get_option</a>(<span class="stringliteral">&#39;dns&#39;</span>, FALSE)) {</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;    <span class="keywordflow">if</span> (ip2long($hostname)) {</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;      $hostname = gethostbyaddr($hostname);</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;    }</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;    <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;      $addr = gethostbyname($hostname);</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;    }</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;  }</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;  <a class="code" href="context_8inc.html#af983acfe90e7d7bbdbd67c57f93708ba">drush_set_context</a>(<span class="stringliteral">&#39;DRUSH_URI&#39;</span>, <span class="stringliteral">&#39;http://&#39;</span> . $hostname . <span class="charliteral">&#39;:&#39;</span> . $uri[<span class="stringliteral">&#39;port&#39;</span>]);</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;  <span class="comment">// We pass in the currently logged in user (if set via the --user option),</span></div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;  <span class="comment">// which will automatically log this user in the browser during the first</span></div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;  <span class="comment">// request.</span></div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;  <span class="keywordflow">if</span> (<a class="code" href="context_8inc.html#afe91fb3e5219ecb2208c3b036b1f0cb8">drush_get_option</a>(<span class="stringliteral">&#39;user&#39;</span>, FALSE)) {</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;    <a class="code" href="lib_2Drush_2Boot_2bootstrap_8inc.html#adb325e52092d83c685acdee827af1085">drush_bootstrap_max</a>(<a class="code" href="lib_2Drush_2Boot_2bootstrap_8inc.html#a63c1b849db2ac6689f3de9685b12a122">DRUSH_BOOTSTRAP_DRUPAL_LOGIN</a>);</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;  }</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;  <span class="comment">// We delete any registered files here, since they are not caught by Ctrl-C.</span></div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;  <a class="code" href="group__filesystemfunctions.html#ga6ee4f2d02364120bb883cfdf8cd2cfab">_drush_delete_registered_files</a>();</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;  <span class="comment">// We set the effective base_url, since we have now detected the current site,</span></div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;  <span class="comment">// and need to ensure generated URLs point to our runserver host.</span></div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;  <span class="comment">// We also pass in the effective base_url to our auto_prepend_script via the</span></div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;  <span class="comment">// CGI environment. This allows Drupal to generate working URLs to this http</span></div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;  <span class="comment">// server, whilst finding the correct multisite from the HTTP_HOST header.</span></div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;  $base_url = <span class="stringliteral">&#39;http://&#39;</span> . $addr . <span class="charliteral">&#39;:&#39;</span> . $uri[<span class="stringliteral">&#39;port&#39;</span>];</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;  $env[<span class="stringliteral">&#39;RUNSERVER_BASE_URL&#39;</span>] = $base_url;</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;  <span class="comment">// We pass in an array of $conf overrides using the same approach.</span></div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;  <span class="comment">// This is available as an option for developers to pass in their own</span></div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;  <span class="comment">// favorite $conf overrides (e.g. disabling css aggregation).</span></div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;  $current_override = <a class="code" href="context_8inc.html#ade60e65f76863ed34db22f5e7f83a150">drush_get_option_list</a>(<span class="stringliteral">&#39;variables&#39;</span>, array());</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;  $override = array();</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;  <span class="keywordflow">foreach</span> ($current_override as $name =&gt; $value) {</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;    <span class="keywordflow">if</span> (is_numeric($name) &amp;&amp; (strpos($value, <span class="charliteral">&#39;=&#39;</span>) !== FALSE)) {</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;      list($name, $value) = explode(<span class="charliteral">&#39;=&#39;</span>, $value, 2);</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;    }</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;    $override[$name] = $value;</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;  }</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;  $env[<span class="stringliteral">&#39;RUNSERVER_CONF&#39;</span>] = urlencode(serialize($override));</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;  <span class="comment">// We log in with the specified user ID (if set) via the password reset URL.</span></div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;  $user_message = <span class="stringliteral">&#39;&#39;</span>;</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;  $usersingle = <a class="code" href="user_8drush_8inc.html#a9391875688c0d7b0ba392d6e0adbe704">drush_user_get_class</a>()-&gt;getCurrentUserAsSingle();</div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;  <span class="keywordflow">if</span> ($usersingle-&gt;id()) {</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;    $browse = $usersingle-&gt;passResetUrl($path);</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;    $user_message = <span class="stringliteral">&#39;, logged in as &#39;</span> . $usersingle-&gt;getUsername();</div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;  }</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;  <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;    $browse = drush_url($path);</div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;  }</div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;  <a class="code" href="group__outputfunctions.html#ga63acbb94925d6d2693e235e966bba740">drush_print</a>(<a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;HTTP server listening on !addr, port !port (see http://!hostname:!port/!path), serving site !site!user...&#39;</span>, array(<span class="stringliteral">&#39;!addr&#39;</span> =&gt; $addr, <span class="stringliteral">&#39;!hostname&#39;</span> =&gt; $hostname, <span class="stringliteral">&#39;!port&#39;</span> =&gt; $uri[<span class="stringliteral">&#39;port&#39;</span>], <span class="stringliteral">&#39;!path&#39;</span> =&gt; $path, <span class="stringliteral">&#39;!site&#39;</span> =&gt; <a class="code" href="context_8inc.html#ad25559f8d7d753f636fbeac347c29fc5">drush_get_context</a>(<span class="stringliteral">&#39;DRUSH_DRUPAL_SITE&#39;</span>, <span class="stringliteral">&#39;default&#39;</span>), <span class="stringliteral">&#39;!user&#39;</span> =&gt; $user_message)));</div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;  <span class="comment">// Start php 5.4 builtin server.</span></div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;  <span class="comment">// Store data used by runserver-prepend.php in the shell environment.</span></div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;  <span class="keywordflow">foreach</span> ($env as $key =&gt; $value) {</div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;    putenv($key . <span class="charliteral">&#39;=&#39;</span> . $value);</div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;  }</div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;  <span class="keywordflow">if</span> (!empty($uri[<span class="stringliteral">&#39;path&#39;</span>])) {</div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;    <span class="comment">// Start a browser if desired. Include a 2 second delay to allow the</span></div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;    <span class="comment">// server to come up.</span></div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;    <a class="code" href="group__commandwrappers.html#ga53d0f833f21b8a22e0824e8c6bbe2260">drush_start_browser</a>($browse, 2);</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;  }</div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;  <span class="comment">// Start the server using &#39;php -S&#39;.</span></div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;  $php = <a class="code" href="context_8inc.html#afe91fb3e5219ecb2208c3b036b1f0cb8">drush_get_option</a>(<span class="stringliteral">&#39;php&#39;</span>);</div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;  <a class="code" href="group__commandwrappers.html#gad0b72e62d81d339d68dc2d3d36db75d6">drush_shell_exec_interactive</a>($php . <span class="stringliteral">&#39; -S &#39;</span> . $addr . <span class="charliteral">&#39;:&#39;</span> . $uri[<span class="stringliteral">&#39;port&#39;</span>] . <span class="stringliteral">&#39; --define auto_prepend_file=&quot;&#39;</span> . DRUSH_BASE_PATH . <span class="stringliteral">&#39;/commands/runserver/runserver-prepend.php&quot;&#39;</span>);</div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;}</div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;<span class="comment"> * Parse a URI or partial URI (including just a port, host IP or path).</span></div>
<div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;<span class="comment"> * @param string $uri</span></div>
<div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;<span class="comment"> *   String that can contain partial URI.</span></div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;<span class="comment"> * @return array</span></div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;<span class="comment"> *   URI array as returned by parse_url.</span></div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00163"></a><span class="lineno"><a class="code" href="runserver_8drush_8inc.html#a9d96e677a3d7578ccae0f9c821dd6aa6">  163</a></span>&#160;<span class="keyword">function</span> <a class="code" href="runserver_8drush_8inc.html#a9d96e677a3d7578ccae0f9c821dd6aa6">runserver_parse_uri</a>($uri) {</div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;  <span class="keywordflow">if</span> ($uri[0] == <span class="charliteral">&#39;:&#39;</span>) {</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;    <span class="comment">// &#39;:port/path&#39; shorthand, insert a placeholder hostname to allow parsing.</span></div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;    $uri = <span class="stringliteral">&#39;placeholder-hostname&#39;</span> . $uri;</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;  }</div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;  <span class="comment">// FILTER_VALIDATE_IP expects &#39;[&#39; and &#39;]&#39; to be removed from IPv6 addresses.</span></div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;  <span class="comment">// We check for colon from the right, since IPv6 addresses contain colons.</span></div>
<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;  $to_path = trim(substr($uri, 0, strpos($uri, <span class="charliteral">&#39;/&#39;</span>)), <span class="stringliteral">&#39;[]&#39;</span>);</div>
<div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;  $to_port = trim(substr($uri, 0, strrpos($uri, <span class="charliteral">&#39;:&#39;</span>)), <span class="stringliteral">&#39;[]&#39;</span>);</div>
<div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;  <span class="keywordflow">if</span> (filter_var(trim($uri, <span class="stringliteral">&#39;[]&#39;</span>), FILTER_VALIDATE_IP) || filter_var($to_path, FILTER_VALIDATE_IP) || filter_var($to_port, FILTER_VALIDATE_IP)) {</div>
<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;    <span class="comment">// &#39;IP&#39;, &#39;IP/path&#39; or &#39;IP:port&#39; shorthand, insert a schema to allow parsing.</span></div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;    $uri = <span class="stringliteral">&#39;http://&#39;</span> . $uri;</div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;  }</div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;  $uri = parse_url($uri);</div>
<div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;  <span class="keywordflow">if</span> (empty($uri)) {</div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="group__errorhandling.html#ga23fe9e1e8c1e5ade39256106044b6da4">drush_set_error</a>(<span class="stringliteral">&#39;RUNSERVER_INVALID_ADDRPORT&#39;</span>, <a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;Invalid argument - should be in the &quot;host:port/path&quot; format, numeric (port only) or non-numeric (path only).&#39;</span>));</div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;  }</div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;  <span class="keywordflow">if</span> (count($uri) == 1 &amp;&amp; isset($uri[<span class="stringliteral">&#39;path&#39;</span>])) {</div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;    <span class="keywordflow">if</span> (is_numeric($uri[<span class="stringliteral">&#39;path&#39;</span>])) {</div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;      <span class="comment">// Port only shorthand.</span></div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;      $uri[<span class="stringliteral">&#39;port&#39;</span>] = $uri[<span class="stringliteral">&#39;path&#39;</span>];</div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;      unset($uri[<span class="stringliteral">&#39;path&#39;</span>]);</div>
<div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;    }</div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;  }</div>
<div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;  <span class="keywordflow">if</span> (isset($uri[<span class="stringliteral">&#39;host&#39;</span>]) &amp;&amp; $uri[<span class="stringliteral">&#39;host&#39;</span>] == <span class="stringliteral">&#39;placeholder-hostname&#39;</span>) {</div>
<div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;    unset($uri[<span class="stringliteral">&#39;host&#39;</span>]);</div>
<div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;  }</div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;  <span class="keywordflow">return</span> $uri;</div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;}</div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Wed Oct 8 2014 09:04:54 for Drush by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.1.2
</small></address>
</body>
</html>