Index: multisite_manager.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/multisite_manager/multisite_manager.module,v
retrieving revision 1.6
diff -u -r1.6 multisite_manager.module
--- multisite_manager.module 4 Sep 2007 20:24:16 -0000 1.6
+++ multisite_manager.module 30 Nov 2007 13:55:14 -0000
@@ -94,21 +94,28 @@
function multisite_manager_view($node, $teaser = FALSE, $page = FALSE) {
global $base_url;
$node = node_prepare($node, $teaser);
- if ($node->link) {
- $node = _multisite_manager_node_url($node);
-
- //header('Location: '. $url);
+ if ($node->installed) {
+ if ($node->link) {
+ $node = _multisite_manager_node_url($node);
+
+ //header('Location: '. $url);
+ $node->content['link'] = array(
+ '#value' => "url\">$node->title Site",
+ '#weight' => 1,
+ );
+ }
+ /*
$node->content['link'] = array(
- '#value' => "url\">$node->title Site",
- '#weight' => 1,
- );
+ '#value' => theme('node_example_order_info', $node),
+ '#weight' => 1,
+ );
+ */
+ } else {
+ $node->content['installed'] = array(
+ '#value' => t("This Drupal site will be created on the next batch creation."),
+ '#weight' => 1,
+ );
}
- /*
- $node->content['link'] = array(
- '#value' => theme('node_example_order_info', $node),
- '#weight' => 1,
- );
- */
return $node;
}
@@ -174,6 +181,7 @@
'db_pass' => '',
'db_path' => variable_get('multisite_manager_dbpath_default', ''),
'link' => variable_get('multisite_manager_link_default', ''),
+ 'installed' => variable_get('multisite_manager_installed', TRUE),
'run_cron' => variable_get('multisite_manager_run_cron', 0),
);
}
@@ -224,14 +232,14 @@
'#description' => t('This short name will be used in the database as a unique identifier and also possibly the default site location. This must only be numbers and letters'),
'#weight' => -4
);
-
+
$form['profile'] = array(
'#type' => 'radios',
'#title' => t('Profile'),
'#required' => TRUE,
'#options' => _multisite_manager_profile_options(),//array_combine($profiles,$profiles),
'#default_value' => $defaults['profile'],
- '#weight' => -3
+ '#weight' => -2
);
$form['advanced'] = array(
@@ -347,7 +355,7 @@
function install_no_profile_error() {
//this function is required by drupal_verify_profile()
//It should probably do something smarter here.
- echo "error installing profile!!!!!!";
+ echo t("Error installing profile!!!!!!");
}
function _multisite_manager_unparse_dburl($db) {
@@ -563,6 +571,19 @@
* Implementation of hook_insert().
*/
function multisite_manager_insert($node) {
+
+ $installed = variable_get('multisite_manager_installed', TRUE);
+ //Store some info about the new site in the main site.
+ //Note that we DO NOT store the password
+ db_query("INSERT INTO {drupal_site} (vid, nid, shortname, profile, link, installed, run_cron, db_prefix, db_user, db_path) VALUES (%d, %d, '%s', '%s', '%s', %d, %d, '%s', '%s', '%s')", $node->vid, $node->nid, $node->shortname, $node->profile, $node->link, $installed, $node->run_cron, $node->db_prefix, $node->db_user, $node->db_path);
+
+ if ($installed) {
+ multisite_manager_install_site($node);
+ }
+
+}
+
+function multisite_manager_install_site($node) {
/**
* 1. If it's a different database and/or user from the current
* then creates them (assumes db access to do so)
@@ -572,10 +593,6 @@
*/
global $multisite_manager_installmodules, $db_prefix, $conf;
- //Store some info about the new site in the main site.
- //Note that we DO NOT store the password
- db_query("INSERT INTO {drupal_site} (vid, nid, shortname, profile, link, run_cron, db_prefix, db_user, db_path) VALUES (%d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s')", $node->vid, $node->nid, $node->shortname, $node->profile, $node->link, $node->run_cron, $node->db_prefix, $node->db_user, $node->db_path);
-
include_once './includes/install.inc';
/**
@@ -670,7 +687,7 @@
function multisite_manager_update($node) {
if (user_access('advanced database setup')) {
db_query("UPDATE {drupal_site} SET
- link = '%s', shortname = '%s', run_cron = '%s', db_prefix = '%s', db_user = '%s', db_path = '%s'
+ link = '%s', shortname = '%s', run_cron = '%d', db_prefix = '%s', db_user = '%s', db_path = '%s'
WHERE vid = %d",
$node->link,
$node->shortname,
@@ -755,7 +772,7 @@
* Implementation of hook_load().
*/
function multisite_manager_load($node) {
- $additions = db_fetch_object(db_query('SELECT shortname, profile, link, run_cron, db_prefix, db_user, db_path FROM {drupal_site} WHERE vid = %d', $node->vid));
+ $additions = db_fetch_object(db_query('SELECT shortname, profile, link, installed, run_cron, db_prefix, db_user, db_path FROM {drupal_site} WHERE vid = %d', $node->vid));
return $additions;
}
@@ -781,6 +798,13 @@
'#default_value' => variable_get('multisite_manager_run_cron', $defaults['run_cron']),
'#description' => t('This sets whether each drupal site\'s cron jobs will be run when this master site\'s cron is run. If this is unset no drupal site will have their cron jobs executed regardless of each individual sites\' settings for running cron jobs.')
);
+ $form['multisite_manager_installed'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Install site upon node creation'),
+ '#required' => FALSE,
+ '#default_value' => variable_get('multisite_manager_installed', $defaults['installed']),
+ '#description' => t('This sets whether Drupal site\'s creation is done upon node creation or wether it is delayed until the batch create script is ran.')
+ );
$form['multisite_manager_dbprefix_default'] = array(
'#type' => 'textfield',
'#title' => t('Table prefix default'),