function hostmaster_bootstrap in Hostmaster (Aegir) 5.x
Same name and namespace in other branches
- 6.2 hostmaster.profile \hostmaster_bootstrap()
- 6 hostmaster.profile \hostmaster_bootstrap()
- 7.4 hostmaster.install \hostmaster_bootstrap()
- 7.3 hostmaster.install \hostmaster_bootstrap()
1 call to hostmaster_bootstrap()
File
- ./
hostmaster.profile, line 188
Code
function hostmaster_bootstrap() {
/* Default node types and default node */
$types = node_types_rebuild();
variable_set('install_profile', 'hostmaster');
global $user;
// Initialize the hosting defines
hosting_init();
/* Default client */
$node = new stdClass();
$node->uid = 1;
$node->type = 'client';
$node->email = $user->mail;
$node->client_name = $user->name;
$node->status = 1;
node_save($node);
variable_set('hosting_default_client', $node->nid);
/* Default database server */
global $db_url;
$url = parse_url($db_url);
$node = new stdClass();
$node->uid = 1;
$node->type = 'db_server';
$node->title = $url['host'];
$node->db_type = $url['scheme'];
$node->db_user = $url['user'];
$node->db_passwd = $url['pass'];
$node->status = 1;
node_save($node);
variable_set('hosting_default_db_server', $node->nid);
variable_set('hosting_own_db_server', $node->nid);
$node = new stdClass();
$node->uid = 1;
$node->type = 'web_server';
$node->title = $_SERVER['HTTP_HOST'];
$node->script_user = HOSTING_DEFAULT_SCRIPT_USER;
$node->web_group = HOSTING_DEFAULT_WEB_GROUP;
$node->status = 1;
node_save($node);
variable_set('hosting_default_web_server', $node->nid);
$node = new stdClass();
$node->uid = 1;
$node->title = 'Drupal';
$node->type = 'package';
$node->package_type = 'platform';
$node->short_name = 'drupal';
$node->status = 1;
node_save($node);
$package_id = $node->nid;
$node = new stdClass();
$node->uid = 1;
$node->type = 'platform';
$node->title = $_SERVER['HTTP_HOST'] . ' (Drupal ' . VERSION . ')';
$node->publish_path = $_SERVER['DOCUMENT_ROOT'];
$node->web_server = variable_get('hosting_default_web_server', 3);
$node->status = 1;
node_save($node);
variable_set('hosting_default_platform', $node->nid);
variable_set('hosting_own_platform', $node->nid);
$instance = new stdClass();
$instance->rid = $node->nid;
$instance->version = VERSION;
$instance->schema_version = drupal_get_installed_schema_version('system');
$instance->package_id = $package_id;
$instance->status = 0;
hosting_package_instance_save($instance);
variable_set('site_frontpage', 'hosting/sites');
// do not allow user registration: the signup form will do that
variable_set('user_register', 0);
// This is saved because the config generation script is running via drush, and does not have access to this value
variable_set('install_url', $GLOBALS['base_url']);
}