Commit cebd680a authored by ergonlogic's avatar ergonlogic

Merge branch '6.x-2.x' into move_sites

Conflicts:
	modules/hosting/server/hosting_server.install
parents 4aed0fb3 2ac05286
modules/admin_menu/
modules/install_profile_api/
modules/jquery_ui/
modules/modalframe/
modules/openidadmin/
modules/*
!modules/hosting
......@@ -10,6 +10,7 @@ projects[modalframe][version] = "1.6"
; These are contrib modules, but come under the Aegir 'umbrella' of control.
projects[hosting_platform_pathauto][version] = "2.0-beta1"
projects[eldir][version] = "2.0-alpha1"
; Libraries
libraries[jquery_ui][download][type] = "get"
......
......@@ -7,10 +7,9 @@ function hosting_client_hosting_feature() {
$features['client'] = array(
'title' => t('Clients'),
'description' => t('Track and manage ownership of hosted sites.'),
'status' => HOSTING_FEATURE_DISABLED,
'status' => HOSTING_FEATURE_ENABLED,
'module' => 'hosting_client',
'node' => 'client',
'group' => 'experimental',
);
return $features;
}
......@@ -297,3 +297,26 @@ function hosting_client_update_6002() {
$ret[0]['success'] = TRUE; // never fail
return $ret;
}
/**
* Remove duplicate client nodes.
*
* Those may have been created in development versions of 2.x code, see
* https://drupal.org/node/1146014
*/
function hosting_client_update_6003() {
$q = db_query("SELECT n.nid FROM {node} n LEFT JOIN {hosting_client} hc ON n.nid = hc.nid WHERE n.type = 'client' AND hc.nid IS NULL;");
while ($nid = db_result($q)) {
node_delete($nid);
}
return array(); // never fail
}
/**
* Make all sites with client relationship lost owned by the default client.
*/
function hosting_client_update_6004() {
$ret = array();
$ret[] = update_sql("UPDATE {hosting_site} SET client = %d WHERE client = 0", HOSTING_DEFAULT_CLIENT);
return $ret;
}
......@@ -231,7 +231,7 @@ function hosting_client_validate(&$node) {
} else {
$node->uname = hosting_client_sanitize($node->title);
}
$nid = db_result(db_query("SELECT nid FROM {hosting_client} WHERE uname LIKE '%s'", $node->uname));
$nid = db_result(db_query("SELECT nid FROM {hosting_client} WHERE uname LIKE '%s'", addcslashes($node->uname, '\%_')));
if ($nid && $node->nid != $nid) {
$suggestion = hosting_client_validate_suggest($node);
if ($suggestion) {
......@@ -264,7 +264,7 @@ function hosting_client_validate(&$node) {
function hosting_client_validate_suggest($node) {
$suggestion = FALSE;
for ($i = 0; $i < 10; $i++) {
$nid = db_result(db_query("SELECT nid FROM {hosting_client} WHERE uname LIKE '%s'", hosting_client_sanitize($node->title) . $i));
$nid = db_result(db_query("SELECT nid FROM {hosting_client} WHERE uname LIKE '%s%%'", addcslashes(hosting_client_sanitize($node->title) . $i, '\%_')));
if (!$nid) {
$suggestion = $node->title . $i;
break;
......@@ -294,7 +294,7 @@ function hosting_client_insert($node) {
if (isset($node->new_user)) {
$user = user_load(array('name' => $node->new_user));
if ($user) {
db_query('INSERT INTO {hosting_client_user} (client, user, contact_type) VALUES (%d, %d, "%s")', $node->nid, $user->uid, '');
db_query("INSERT INTO {hosting_client_user} (client, user, contact_type) VALUES (%d, %d, '%s')", $node->nid, $user->uid, '');
}
}
}
......@@ -522,6 +522,13 @@ function hosting_client_view($node, $teaser = FALSE, $page = FALSE) {
return $node;
}
/**
* Implements hook_hosting_site_site_list_filters().
*/
function hosting_client_hosting_site_site_list_filters() {
return array('client');
}
/**
* Helper function to generate new client node during import.
*
......@@ -531,7 +538,7 @@ function hosting_client_view($node, $teaser = FALSE, $page = FALSE) {
* The nid of the generated client.
*/
function hosting_import_client($name) {
$client = hosting_get_client($name);
$client = hosting_get_client_by_uname($name);
if (!$client) {
$client = new stdClass();
......@@ -784,7 +791,7 @@ function hosting_client_autocomplete($type, $keyword) {
$matches = array();
if ($type == 'client') {
$query = db_query(db_rewrite_sql('SELECT * FROM {node} n WHERE type = "%s" AND title LIKE "%s"'), $type, $keyword. "%");
$query = db_query(db_rewrite_sql("SELECT * FROM {node} n WHERE type = '%s' AND title LIKE '%s%%'"), $type, addcslashes($keyword, '\%_'));
while ($result = db_fetch_object($query)) {
$matches[$result->title] = $result->title;
}
......
......@@ -3,6 +3,7 @@
*/
.hosting-site-list {clear:both;}
#hosting-package-usage {clear:both;}
#hosting-site-list-form {
position: relative;
}
......
......@@ -34,11 +34,14 @@ function hosting_feature($feature) {
if (!sizeof($features)) {
$features = hosting_get_features();
}
if ($features[$feature]['module']) {
if (isset($features[$feature]['status']) && ($features[$feature]['status'] == HOSTING_FEATURE_REQUIRED)) {
$return = HOSTING_FEATURE_REQUIRED;
}
elseif (isset($features[$feature]['module'])) {
$return = (module_exists($features[$feature]['module'])) ? HOSTING_FEATURE_ENABLED : HOSTING_FEATURE_DISABLED;
}
else {
$return = variable_get('hosting_feature_' . $feature, $features[$feature]['status']);
$return = variable_get('hosting_feature_' . $feature, !empty($features[$feature]['status']));
}
return $return;
}
......@@ -76,6 +79,7 @@ function hosting_features_form() {
'#description' => $info['description'],
'#default_value' => hosting_feature($feature),
'#required' => hosting_feature($feature) == HOSTING_FEATURE_REQUIRED,
'#disabled' => hosting_feature($feature) == HOSTING_FEATURE_REQUIRED,
);
if ($info['group'] == 'experimental') {
$experimental[$feature] = $element;
......@@ -117,18 +121,10 @@ function hosting_features_form_submit($form, &$form_state) {
include_once('includes/install.inc');
$modules = array($module);
$files = module_rebuild_cache();
$file = $files[$module];
if (isset($file->info['dependencies']) && is_array($file->info['dependencies'])) {
foreach ($file->info['dependencies'] as $dependency) {
$modules[] = $dependency;
}
}
// turn on module
// Enable the module.
drupal_set_message(t("Enabling %module module", array('%module' => implode(",", $modules))));
drupal_install_modules($modules);
module_enable($modules);
}
if (function_exists($callback = $features[$feature]['enable'])) {
$callback();
......@@ -148,7 +144,7 @@ function hosting_features_form_submit($form, &$form_state) {
}
if ($dependencies) {
form_set_error('', t("You cannot disable %module because %dep depends on it", array('%module' => $module, '%dep' => implode(',', $dependencies))));
form_set_error('', t("You cannot disable %module because %dep depends on it", array('%module' => $module, '%dep' => implode(', ', $dependencies))));
}
else {
drupal_set_message(t("Disabling %module module", array('%module' => implode(",", $modules))));
......
......@@ -360,3 +360,41 @@ function hosting_update_6014() {
$ret[] = update_sql("UPDATE {system} SET weight = 0 WHERE type='module' and name='hosting'");
return $ret;
}
/**
* Delete URL aliases for sites that have been deleted.
*
* Ideally we'd do this in a single DB query, but there isn't a nice performant
* way to do it, so we do more DB queries instead of using potentially a lot of
* memory. Basically this may take a long time to run, but it shouldn't run out
* of resources doing so.
*/
function hosting_update_6015(&$sandbox) {
$ret = array();
if (!isset($sandbox['progress'])) {
$sandbox['progress'] = 0;
$sandbox['current_pid'] = 0;
$sandbox['max'] = db_result(db_query('SELECT COUNT(pid) FROM {url_alias}'));
}
$aliases = db_query_range("SELECT pid, src, dst FROM {url_alias} WHERE dst LIKE 'hosting/c/%' AND pid > %d ORDER BY pid ASC", $sandbox['current_pid'], 0, 50);
while ($alias = db_fetch_object($aliases)) {
// Get the node ID for the alias.
$nid = preg_replace('#^node/#', '', $alias->src);
if (is_numeric($nid)) {
// Check to see if the corresponding context has been deleted.
if (!db_result(db_query('SELECT COUNT(nid) FROM {hosting_context} WHERE nid = %d', $nid))) {
db_query('DELETE FROM {url_alias} WHERE pid = %d', $alias->pid);
}
}
$sandbox['progress']++;
$sandbox['current_pid'] = $alias->pid;
}
$ret['#finished'] = empty($sandbox['max']) ? 1 : ($sandbox['progress'] / $sandbox['max']);
return $ret;
}
......@@ -139,8 +139,10 @@ function hosting_menu_alter(&$items) {
}
// These node types should remain hidden, and provide no user interface.
unset($items['node/add/package']);
unset($items['node/add/task']);
$items['node/add/package']['page callback'] = 'drupal_access_denied';
$items['node/add/task']['page callback'] = 'drupal_access_denied';
$items['node/add/package']['type'] = MENU_CALLBACK;
$items['node/add/task']['type'] = MENU_CALLBACK;
}
/**
......@@ -191,7 +193,7 @@ function hosting_nodeapi(&$node, $op, $arg1, $arg2) {
if (in_array($node->type, hosting_context_node_types())) {
switch ($op) {
case 'presave':
if (!$node->uid) {
if (!isset($node->uid)) {
$node->uid = $user->uid;
}
break;
......@@ -489,7 +491,6 @@ function _hosting_setup_cron() {
}
}
/**
* Replacement node/add page.
*
......@@ -503,9 +504,6 @@ function _hosting_node_add($type = '') {
$types = node_get_types();
$type = ($type) ? str_replace('-', '_', $type) : NULL;
if ($type == 'package') {
drupal_access_denied();
}
// If a node type has been specified, validate its existence.
if (isset($types[$type]) && user_access('create ' . $type) && (hosting_feature($type) !== HOSTING_FEATURE_DISABLED)) {
// Initialize settings:
......@@ -642,6 +640,9 @@ function hosting_queues_configure() {
'#maxlength' => 3,
'#default_value' => $info['items'],
'#suffix' => t(' %items every ', array('%items' => $info['plural'])),
'#attributes' => array(
'class' => 'hosting-select-frequency-items'
),
);
}
foreach (array_reverse(array_keys($units)) as $length) {
......@@ -657,12 +658,18 @@ function hosting_queues_configure() {
'#type' => 'textfield',
'#default_value' => $frequency_ticks,
'#maxlength' => 5,
'#size' => 5
'#size' => 5,
'#attributes' => array(
'class' => 'hosting-select-frequency-ticks'
),
);
$form[$queue]['frequency']["unit"] = array(
'#type' => 'select',
'#options' => $units,
'#default_value' => $frequency_length,
'#attributes' => array(
'class' => 'hosting-select-frequency-unit'
),
);
}
$form['help'] = array(
......@@ -740,6 +747,12 @@ function hosting_queues_configure_submit($form, &$form_state) {
* Implementation of hook_form_alter().
*/
function hosting_form_alter(&$form, &$form_state, $form_id) {
// Do not allow package or task nodes to be edited through the interface.
if ($form_id == 'package_node_form' || $form_id == 'task_node_form') {
drupal_access_denied();
exit;
}
// Alter the 'Add User' form to remind users that this is not the New Client form
if ($form_id == 'user_register') {
$form[user_registration_help] = array(
......@@ -751,11 +764,6 @@ function hosting_form_alter(&$form, &$form_state, $form_id) {
);
}
if ($form_id == 'package_node_form') {
drupal_access_denied();
}
// Remove additional UI added by core modules, that conflict with the hosting UI.
$node_types = array('site', 'platform', 'server', 'client');
foreach ($node_types as $type) {
......@@ -847,6 +855,7 @@ function hosting_context_register($nid, $name) {
* The nid of the node to remove the association from.
*/
function hosting_context_delete($nid) {
db_query("DELETE FROM {url_alias} WHERE src='node/%d'", $nid);
db_query("DELETE FROM {hosting_context} WHERE nid=%d", $nid);
}
......@@ -862,6 +871,9 @@ function hosting_context_delete($nid) {
*/
function hosting_context_name($nid) {
$node = node_load($nid);
if (!$node) {
drupal_set_message(t('Error: cannot load node id %nid to find its context', array('%nid' => $nid)), 'error');
}
return '@' . $node->hosting_name;
}
......
......@@ -90,14 +90,36 @@ function hosting_package_instance_create(&$instance) {
_hosting_package_instance_languages($instance);
}
/**
* Get the first package instance object that maches given parameters.
*
* @see hosting_package_instances_load()
*/
function hosting_package_instance_load($param) {
return _hosting_package_instances_load($param);
}
/**
* Get an array of all package instance objects that match given parameters.
*
* @param mixed $param
* If $param is an integer it will be matched against an instance iid. If
* $param is an array then the key/value pairs will be used as a WHERE clause
* in the form "WHERE key0 = value0 AND ... AND keyN = valueN". Both the keys
* and values of the $param array must be strings.
*
* @return mixed
* Returns an array of instance objects keyed by the instance iid. If there
* are no matches an empty array will be returned. If there was an error FALSE
* will be returned.
*/
function hosting_package_instances_load($param) {
return _hosting_package_instances_load($param, TRUE);
}
/**
* Internal function for hosting_package_instance(s)_load.
*/
function _hosting_package_instances_load($param, $multiple = FALSE) {
$arguments = array();
if (is_numeric($param)) {
......
......@@ -138,7 +138,7 @@ function hosting_get_profiles($platform = NULL, $field = 'title') {
}
function hosting_get_profile_platforms($profile, $check_old_short_name = FALSE) {
$defaults = array('default', 'standard', 'minimal');
$defaults = array('default', 'standard', 'minimal', 'testing');
$platforms = array();
$instances = hosting_package_instances_load(array(
......@@ -325,9 +325,66 @@ function hosting_package_view($node, $teaser = FALSE, $page = FALSE) {
'#weight' => 10
);
}
else { // For modules & themes
$node->content['hosting-package-usage'] = array(
'#prefix' => '<div id="hosting-package-usage">',
'#suffix' => '</div>',
'#value' => _hosting_package_list_package_usage($node),
'#weight' => 99,
);
}
return $node;
}
/**
* Return a themed table showing where a package is used.
*/
function _hosting_package_list_package_usage($node) {
$header = array(
array('data' => t('Package version'), 'field' => 'package_version', 'sort' => 'DESC'),
array('data' => t('Platform'), 'field' => 'platform_name'),
array('data' => t('Site'), 'field' => 'site_name'),
);
$sql = "SELECT s.client AS client_nid,
n2.title AS platform_name,
s.platform AS platform_nid,
n.title AS site_name,
n.nid AS site_nid,
pi.version AS package_version
FROM {node} AS n
LEFT JOIN {hosting_package_instance} AS pi ON (pi.rid = n.nid)
LEFT JOIN {hosting_package} AS p ON (p.nid = pi.package_id)
LEFT JOIN {hosting_site} AS s ON (s.nid = n.nid)
LEFT JOIN {node} AS n2 ON (n2.nid = s.platform)
WHERE pi.status=1 AND s.status >= " . HOSTING_SITE_DISABLED . " AND pi.package_id=%d";
$sql .= tablesort_sql($header);
$result = pager_query(db_rewrite_sql($sql, 'n'), 100, 2, null, array($node->nid));
if (!$result) {
return t('No packages are associated with @reference', array('@reference' => $node->title));
}
$rows = array();
while ($package = db_fetch_object($result)) {
$rows[] = array('data' => array(
$package->package_version,
l(filter_xss($package->platform_name), 'node/' . $package->platform_nid),
l(filter_xss($package->site_name), 'node/' . $package->site_nid),
));
}
return theme('table', $header, $rows) . theme('pager', null, 100, 2);
}
/**
* Implements hook_hosting_site_site_list_filters().
*/
function hosting_package_hosting_site_site_list_filters() {
return array('profile');
}
/**
* Return names of the languages available
*/
......
......@@ -197,7 +197,13 @@ function hosting_platform_form(&$node) {
'#default_value' => $node->title,
'#maxlength' => 255,
);
if (!$node->nid) {
// allow edition if the node is in creation, or if wasn't verified correctly
// *and* we're not using a makefile. The reason while we don't allow editing
// the path if the makefile was specified is that there's the possibility
// that the platform path was actually created when the node was saved the
// first time and we have cruft lying around to cleanup.
if (!$node->nid || (!$node->verified && !$node->makefile)) {
$form['publish_path'] = array(
'#type' => 'textfield',
'#title' => t('Publish path'),
......@@ -371,6 +377,9 @@ function hosting_platform_validate($node, &$form) {
if ($node->op != t('Delete') && $result = db_fetch_object(db_query("SELECT n.title AS name FROM {hosting_platform} AS h INNER JOIN {node} AS n ON n.nid = h.nid WHERE publish_path = '%s' AND n.nid <> %d AND h.status >= %d", hosting_path_normalize($node->publish_path), $node->nid, HOSTING_PLATFORM_QUEUED))) {
form_set_error('publish_path', t('Path is already in use by platform %name. Platform paths must be unique across all servers.', array('%name' => $result->name)));
}
if (is_null($node->web_server)) {
form_set_error('web_server', t('Platform needs to be associated with a webserver. Make sure you have a verified webserver on this Aegir install!'));
}
}
/**
......@@ -490,6 +499,13 @@ function hosting_platform_view($node, $teaser = FALSE, $page = FALSE) {
return $node;
}
/**
* Implements hook_hosting_site_site_list_filters().
*/
function hosting_platform_hosting_site_site_list_filters() {
return array('platform');
}
function _hosting_platform_status($node) {
static $labels = array(
HOSTING_PLATFORM_QUEUED => "Queued",
......
......@@ -26,6 +26,7 @@ function hosting_queued_drush_command() {
// We need this get around a drush bug, see: http://drupal.org/node/704848
// But we remove it below for Drush 4.5 and above.
'callback' => 'drush_hosting_queued',
'options' => array('onetime' => array('description' => dt('exit if there are no more tasks queued after the 1 second poll timeout.'))),
);
// We don't need the callback defined for Drush > 4.4
......@@ -72,9 +73,6 @@ function drush_hosting_queued() {
watchdog('hosting_queued', 'Started Hosting queue daemon, waiting for new tasks');
while (TRUE) {
// Sleep for a second before we look for new tasks.
sleep(1);
// Should we terminate.
if (time() > $end_time) {
// Restart the daemon to recycle leaked memory
......@@ -112,6 +110,15 @@ function drush_hosting_queued() {
hosting_queued_restart();
}
}
// wait here only if we didn't process tasks
// this is to avoid an infinite loop if there are no tasks in the queue
if (!$tasks) {
sleep(1);
}
if (drush_get_option('onetime')) {
drush_log(dt("exiting after processing all tasks, as requested by --onetime"));
break;
}
unset($tasks);
}
}
......
......@@ -6,6 +6,10 @@
function hosting_queued_enable() {
// Disable Aegir's dispatch of the tasks queue.
variable_set('hosting_queue_tasks_enabled', FALSE);
// Disable the predecessor of this module from the Aegir 1.x world
module_disable(array('hosting_queue_runner'));
drupal_uninstall_module('hosting_queue_runner');
}
/**
......@@ -23,4 +27,14 @@ function hosting_queued_update_6200() {
$ret = array();
$ret[] = update_sql("UPDATE {variable} SET name = REPLACE(name, 'hosting_queue_runner', 'hosting_queued') WHERE name LIKE 'hosting_queue_runner%'");
return $ret;
}
\ No newline at end of file
}
/**
* Properly remove/uninstall the queue runner.
*/
function hosting_queued_update_6201() {
// Disable the predecessor of this module from the Aegir 1.x world
module_disable(array('hosting_queue_runner'));
drupal_uninstall_module('hosting_queue_runner');
return array();
}
......@@ -5,7 +5,7 @@
*/
function hosting_queued_menu() {
$items['admin/hosting/queued'] = array(
'title' => 'Queue runner settings',
'title' => 'Queue daemon',
'description' => 'Configure the daemonized tasks queue daemon.',
'page callback' => 'drupal_get_form',
'page arguments' => array('hosting_queued_settings_form'),
......
<?php
/**
* @file
* Expose the quota feature to hostmaster.
*/
/**
* Implementation of hook_hosting_feature().
*/
function hosting_quota_hosting_feature() {
$features['quota'] = array(
'title' => t('Quotas'),
'description' => t('Provides the ability to define and allocate quotas for various resources to clients.'),
'status' => HOSTING_FEATURE_DISABLED,
'module' => 'hosting_quota',
'group' => 'experimental',
);
return $features;
}
......@@ -43,11 +43,11 @@ function hosting_ip_save($node, $update = FALSE) {
$ip_list = _hosting_ip_list($node->ip_addresses);
if ($update) {
hosting_ip_delete_revision($node);
hosting_ip_delete($node);
}
foreach ($ip_list as $ip) {
db_query("INSERT INTO {hosting_ip_addresses} (vid, nid, ip_address) VALUES (%d, %d, '%s')", $node->vid, $node->nid, $ip);
db_query("INSERT INTO {hosting_ip_addresses} (nid, ip_address) VALUES (%d, '%s')", $node->nid, $ip);
}
}
......@@ -69,7 +69,7 @@ function hosting_ip_validate($node) {
*/
function hosting_ip_load($node) {
$ip_list = array();
$result = db_query("SELECT ip_address FROM {hosting_ip_addresses} WHERE vid=%d", $node->vid);
$result = db_query("SELECT ip_address FROM {hosting_ip_addresses} WHERE nid=%d", $node->nid);
while ($obj = db_fetch_object($result)) {
$ip_list[] = $obj->ip_address;
}
......@@ -86,7 +86,29 @@ function hosting_ip_delete($node) {
/**
* IP Utility function for hook_delete_revision.
*
* @deprecated
* @see hosting_ip_delete()
*/
function hosting_ip_delete_revision($node) {
db_query("DELETE FROM {hosting_ip_addresses} WHERE vid=%d", $node->vid);
return hosting_ip_delete($node);
}
/**
* Allocate an IP for a given site on a given server.
*/
function hosting_ip_allocate($cert, $site) {
// make sure the IP is not allocated while we pick ours
db_query("LOCK TABLES {hosting_ssl_cert_ips} WRITE, {hosting_ip_addresses} WRITE");
$platform = node_load($site->platform);
$server = node_load($platform->web_server);
// guess the next available IP
$ip = db_result(db_query("SELECT hosting_ip_addresses.id FROM {hosting_ip_addresses}
LEFT JOIN {hosting_ssl_cert_ips} ON hosting_ip_addresses.id = hosting_ssl_cert_ips.ip_address
WHERE hosting_ssl_cert_ips.ip_address IS NULL AND nid = %d LIMIT 1;", $server->nid));
if ($ip) {
db_query("INSERT INTO {hosting_ssl_cert_ips} (cid, ip_address) VALUES (%d, %d)", $cert->cid, $ip);
}
db_query("UNLOCK TABLES");
return $ip;
}
......@@ -28,12 +28,6 @@ function hosting_server_schema() {
$schema['hosting_ip_addresses'] = array(
'fields' => array(
'vid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
......@@ -45,9 +39,16 @@ function hosting_server_schema() {
'size' => 'small',
'not null' => TRUE,
),
'id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array('id'),
'indexes' => array(
'vid' => array('vid'),
'nid' => array('nid'),
),
);
......@@ -215,10 +216,100 @@ function hosting_server_update_6005() {
return $ret;
}
/*
* Add primary key for IPs, drop versionning
*/
function hosting_server_update_6200() {
$ret = array();
db_add_field($ret, "hosting_ip_addresses", "id", array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0));
db_drop_field($ret, "hosting_ip_addresses", "vid");
$r = db_query("SELECT nid, ip_address FROM {hosting_ip_addresses}");
for ($i = 0; $row = db_fetch_object($r); $i++) {
$ret[] = update_sql("UPDATE {hosting_ip_addresses} SET id=$i WHERE nid={$row->nid} AND ip_address='{$row->ip_address}'");
}
db_add_primary_key($ret, 'hosting_ip_addresses', array('id'));
db_add_index($ret, 'hosting_ip_addresses', 'nid', array('nid'));
return $ret;
}
/**
* Create SSL cert to IP mapping table.
*
* We create the SSL cert to IP mapping table here instead of in the ssl
* module as we need to cleanup the ip_address table after and we can't sync
* across modules. Since this module is a dependency of hosting_site_ssl, this
* is not a problem.
*
* If SSL is not installed, this is a noop.
*/
function hosting_server_update_6201() {
if (!db_table_exists('hosting_ssl_site')) {
return array(array('success' => TRUE));
}
$ret = array();
$schema = array(
'fields' => array(
// cert id
'cid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
// reference to the hosting_ip_addresses table
'ip_address' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,