@@ 235-285 (lines=51) @@ | ||
232 | /** |
|
233 | * {@inheritdoc} |
|
234 | */ |
|
235 | public function validateDrupalSite() { |
|
236 | if ('default' !== $this->uri) { |
|
237 | // Fake the necessary HTTP headers that Drupal needs: |
|
238 | $drupal_base_url = parse_url($this->uri); |
|
239 | // If there's no url scheme set, add http:// and re-parse the url |
|
240 | // so the host and path values are set accurately. |
|
241 | if (!array_key_exists('scheme', $drupal_base_url)) { |
|
242 | $drupal_base_url = parse_url($this->uri); |
|
243 | } |
|
244 | // Fill in defaults. |
|
245 | $drupal_base_url += array( |
|
246 | 'path' => NULL, |
|
247 | 'host' => NULL, |
|
248 | 'port' => NULL, |
|
249 | ); |
|
250 | $_SERVER['HTTP_HOST'] = $drupal_base_url['host']; |
|
251 | ||
252 | if ($drupal_base_url['port']) { |
|
253 | $_SERVER['HTTP_HOST'] .= ':' . $drupal_base_url['port']; |
|
254 | } |
|
255 | $_SERVER['SERVER_PORT'] = $drupal_base_url['port']; |
|
256 | ||
257 | if (array_key_exists('path', $drupal_base_url)) { |
|
258 | $_SERVER['PHP_SELF'] = $drupal_base_url['path'] . '/index.php'; |
|
259 | } |
|
260 | else { |
|
261 | $_SERVER['PHP_SELF'] = '/index.php'; |
|
262 | } |
|
263 | } |
|
264 | else { |
|
265 | $_SERVER['HTTP_HOST'] = 'default'; |
|
266 | $_SERVER['PHP_SELF'] = '/index.php'; |
|
267 | } |
|
268 | ||
269 | $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF']; |
|
270 | $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; |
|
271 | $_SERVER['REQUEST_METHOD'] = NULL; |
|
272 | ||
273 | $_SERVER['SERVER_SOFTWARE'] = NULL; |
|
274 | $_SERVER['HTTP_USER_AGENT'] = NULL; |
|
275 | ||
276 | $conf_path = conf_path(TRUE, TRUE); |
|
277 | $conf_file = $this->drupalRoot . "/$conf_path/settings.php"; |
|
278 | if (!file_exists($conf_file)) { |
|
279 | throw new BootstrapException(sprintf('Could not find a Drupal settings.php file at "%s"', $conf_file)); |
|
280 | } |
|
281 | $drushrc_file = $this->drupalRoot . "/$conf_path/drushrc.php"; |
|
282 | if (file_exists($drushrc_file)) { |
|
283 | require_once $drushrc_file; |
|
284 | } |
|
285 | } |
|
286 | ||
287 | /** |
|
288 | * Expands properties on the given entity object to the expected structure. |
@@ 205-255 (lines=51) @@ | ||
202 | /** |
|
203 | * {@inheritdoc} |
|
204 | */ |
|
205 | public function validateDrupalSite() { |
|
206 | if ('default' !== $this->uri) { |
|
207 | // Fake the necessary HTTP headers that Drupal needs: |
|
208 | $drupal_base_url = parse_url($this->uri); |
|
209 | // If there's no url scheme set, add http:// and re-parse the url |
|
210 | // so the host and path values are set accurately. |
|
211 | if (!array_key_exists('scheme', $drupal_base_url)) { |
|
212 | $drupal_base_url = parse_url($this->uri); |
|
213 | } |
|
214 | // Fill in defaults. |
|
215 | $drupal_base_url += array( |
|
216 | 'path' => NULL, |
|
217 | 'host' => NULL, |
|
218 | 'port' => NULL, |
|
219 | ); |
|
220 | $_SERVER['HTTP_HOST'] = $drupal_base_url['host']; |
|
221 | ||
222 | if ($drupal_base_url['port']) { |
|
223 | $_SERVER['HTTP_HOST'] .= ':' . $drupal_base_url['port']; |
|
224 | } |
|
225 | $_SERVER['SERVER_PORT'] = $drupal_base_url['port']; |
|
226 | ||
227 | if (array_key_exists('path', $drupal_base_url)) { |
|
228 | $_SERVER['PHP_SELF'] = $drupal_base_url['path'] . '/index.php'; |
|
229 | } |
|
230 | else { |
|
231 | $_SERVER['PHP_SELF'] = '/index.php'; |
|
232 | } |
|
233 | } |
|
234 | else { |
|
235 | $_SERVER['HTTP_HOST'] = 'default'; |
|
236 | $_SERVER['PHP_SELF'] = '/index.php'; |
|
237 | } |
|
238 | ||
239 | $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF']; |
|
240 | $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; |
|
241 | $_SERVER['REQUEST_METHOD'] = NULL; |
|
242 | ||
243 | $_SERVER['SERVER_SOFTWARE'] = NULL; |
|
244 | $_SERVER['HTTP_USER_AGENT'] = NULL; |
|
245 | ||
246 | $conf_path = conf_path(TRUE, TRUE); |
|
247 | $conf_file = $this->drupalRoot . "/$conf_path/settings.php"; |
|
248 | if (!file_exists($conf_file)) { |
|
249 | throw new BootstrapException(sprintf('Could not find a Drupal settings.php file at "%s"', $conf_file)); |
|
250 | } |
|
251 | $drushrc_file = $this->drupalRoot . "/$conf_path/drushrc.php"; |
|
252 | if (file_exists($drushrc_file)) { |
|
253 | require_once $drushrc_file; |
|
254 | } |
|
255 | } |
|
256 | ||
257 | /** |
|
258 | * Expands properties on the given entity object to the expected structure. |