function _drush_site_install6_cookies

8.0.x site_install_6.inc _drush_site_install6_cookies($profile, $cookie = NULL)
6.x site_install_6.inc _drush_site_install6_cookies($profile, $cookie = NULL)
7.x site_install_6.inc _drush_site_install6_cookies($profile, $cookie = NULL)
4.x site_install_6.inc _drush_site_install6_cookies($profile, $cookie = NULL)
5.x site_install_6.inc _drush_site_install6_cookies($profile, $cookie = NULL)

Utility function to grab/set current "cli cookie".

2 calls to _drush_site_install6_cookies()
drush_core_site_install_version in commands/core/drupal/site_install_6.inc
Install Drupal 6.x
_drush_site_install6_stage in commands/core/drupal/site_install_6.inc
Submit a given op to install.php; if a meta "Refresh" tag is returned in the result, then submit that op as well.

File

commands/core/drupal/site_install_6.inc, line 98

Code

function _drush_site_install6_cookies($profile, $cookie = NULL) {
  $drupal_base_url = parse_url(drush_get_option('uri', 'http://default'));
  $output = '$_GET=array("profile"=>"' . $profile . '", "locale"=>"' . drush_get_option('locale', 'en') . '", "id"=>"1"); $_REQUEST=&$_GET;';
  $output .= 'define("DRUSH_SITE_INSTALL6", TRUE);$_SERVER["SERVER_SOFTWARE"] = NULL;';
  $output .= '$_SERVER["SCRIPT_NAME"] = "/install.php";';
  $output .= '$_SERVER["HTTP_HOST"] = "' . $drupal_base_url['host'] . '";';
  $output .= '$_SERVER["REMOTE_ADDR"] = "127.0.0.1";';

  if ($cookie) {
    $output .= sprintf('$_COOKIE=unserialize("%s");', str_replace('"', '\"', $cookie));
  }
  else {
    $output .= 'function _cli_cookie_print(){print(serialize(array(session_name()=>session_id())));}
register_shutdown_function("_cli_cookie_print");';
  }

  return $output;
}