Commit 63e16036 authored by Adrian Rossouw's avatar Adrian Rossouw Committed by adrian

latest work tonight. more work on porting from cck to plain old nodes

parent 83f57f6e
......@@ -190,52 +190,25 @@ function provision_help_requirements() {
function provision_configure() {
foreach (module_implements('provision_configure') as $module) {
$form[$module] = array(
$data = module_invoke($module, 'provision_service');
list($service, $title) = $data;
$form[$name] = array(
'#type' => 'fieldset',
'#title' => module_invoke($module, 'provision_service'),
'#title' => $title,
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#access' => user_access('administer provisioning'),
'#access' => user_access('administer $service provisioning'),
'#tree' => true
);
$form[$module] = array_merge($form[$module], module_invoke($module, "provision_configure"));
$form[$service] = array_merge($form[$module], module_invoke($module, "provision_configure"));
}
return system_settings_form($form);
}
/**
* Implementation of provision_configure
*/
function provision_provision_configure() {
$form['provision_user'] = array(
'#type' => 'textfield',
'#title' => t('Provision user'),
'#description' => t('The owner of the files. must not be the web server user.'),
'#default_value' => provision_get_script_owner(),
'#size' => 40,
'#maxlength' => 255,
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save settings'),
);
$form['provision_group'] = array(
'#type' => 'textfield',
'#title' => t('Provision group'),
'#description' => t('The group owner of the files. should be the group the web server is running as.'),
'#default_value' => provision_get_group_name(),
'#size' => 40,
'#maxlength' => 255,
);
$form['provision_backup_path'] = array(
'#type' => 'textfield',
'#required' => TRUE,
'#title' => t('Path to backup directory'),
'#description' => t('The file system location where backups will be stored.'),
'#default_value' => _provision_backup_path(),
'#size' => 40,
'#maxlength' => 255,
);
return $form;
}
}
/**
* @} End of "defgroup provisionui"
......
......@@ -11,7 +11,7 @@
*/
function provision_apache_provision_service() {
return t("Apache webserver");
return array( "web_server" => t("Web Server"));
}
/**
......@@ -81,38 +81,74 @@ EOF;
/**
* Hook into central configuration form for provisioning framework.
*/
function provision_apache_provision_configure() {
$form['provision_apache_vhost_template'] = array(
'#type' => 'textarea',
'#title' => t('Virtual Host configuration template'),
'#description' => t('The text to use when generating a virtual host configuration file for apache'),
'#default_value' => variable_get('provision_apache_vhost_template', _provision_apache_default_template()),
'#cols' => 60,
'#rows' => 5,
function provision_apache_provision_configure($node = null) {
$form['ip_address'] = array(
'#type' => 'textfield',
'#title' => t('IP address'),
'#default_value' => $node->ip_address,
'#description' => t("The IP address the server can be accessed by. If this is empty, the hostname field will be used instead.")
);
$default_path = variable_get('provision_config_path', ereg_replace("/webroot$", "", $_SERVER['DOCUMENT_ROOT'])) . '/config';
$form['provision_apache_config_path'] = array(
$form['script_user'] = array(
'#type' => 'textfield',
'#title' => t('Path to the directory to store configuration files for hosted sites.'),
'#title' => t('System account'),
'#required' => TRUE,
'#description' => t('The system account that the hosted files will belong to, for security reasons, this should be a different to the account the web server is running as.'),
'#default_value' => ($node->script_user) ? $node->script_user : provision_get_script_owner(),
'#size' => 40,
'#default_value' => variable_get('provision_config_path', $default_path),
'#maxlength' => 255,
);
$form['provision_apache_restart_cmd'] = array(
$form['web_group'] = array(
'#type' => 'textfield',
'#title' => t('Apache restart command'),
'#description' => t('The command to run to restart apache for new changes to take effect. This is required for the new site to become live'),
'#title' => t('Web server group'),
'#required' => TRUE,
'#description' => t('The group that the hosted files will belong to. Should be the group the web server is running as.'),
'#default_value' => ($node->web_group) ? $node->web_group : provision_get_group_name(),
'#size' => 40,
'#maxlength' => 255,
'#default_value' => variable_get('provision_apache_restart_cmd', 'sudo apachectl graceful')
);
$form['config_path'] = array(
'#type' => 'textfield',
'#title' => t('Configuration path'),
'#required' => TRUE,
'#size' => 40,
'#default_value' => ($node->config_path) ? $node->config_path : _provision_config_path(),
'#description' => t("The path on the server where configuration files will be stored.
It is essential that this directory should not be accessible via a web browser."),
'#maxlength' => 255,
);
$form['backup_path'] = array(
'#type' => 'textfield',
'#title' => t('Backup path'),
'#required' => TRUE,
'#size' => 40,
'#default_value' => ($node->backup_path) ? $node->backup_path : _provision_backup_path(),
'#description' => t("The path on the server where backups will be stored.
It is essential that this directory should not be accessible via a web browser."),
'#maxlength' => 255,
);
return $form;
}
/**
* Implementation of hook_provision_templates
*/
provision_apache_provision_templates() {
$form['vhost_template'] = array(
'#type' => 'textarea',
'#title' => t('Virtual Host configuration template'),
'#description' => t('The text to use when generating a virtual host configuration file for apache'),
'#default_value' => variable_get('provision_apache_vhost_template', _provision_apache_default_template()),
'#cols' => 60,
'#rows' => 5,
);
return $form;
}
/**
* The default template provided for the virtual host configuration
*/
......
......@@ -21,14 +21,15 @@ function provision_drupal_provision_service() {
/**
* Implentation of hook_provision_configure()
*/
* @TODO: PROPER profile support
function provision_drupal_provision_configure() {
$template = _provision_drupal_default_template();
$profiles = file_scan_directory('./profiles', '\.profile$', array('.', '..', 'CVS'), 0, TRUE, 'name', 0);
// Don't need to choose profile if only one available.
if (sizeof($profiles) == 1) {
$profile = array_pop($profiles);
$form['provision_default_profile'] = array('#type' => 'value', '#value' => $profile->name);
$form['default_profile'] = array('#type' => 'value', '#value' => $profile->name);
}
elseif (sizeof($profiles) > 1) {
foreach ($profiles as $profile) {
......@@ -46,17 +47,17 @@ function provision_drupal_provision_configure() {
}
$form['provision_settings_template'] = array(
'#type' => 'textarea',
'#title' => t('Drupal settings template'),
'#description' => t('The template for the generated settings.php file.'),
'#default_value' => variable_get('provision_settings_template', $template),
'#cols' => 60,
'#rows' => 5,
);
return $form;
}
//*/
/**
* Implementation of hook_provision_templates
*/
function provision_drupal_provision_templates() {
// settings template
}
/**
* @} End "ingroup provisionui"
......
......@@ -52,7 +52,16 @@ function provision_mysql_provision_service() {
* Implementation of provision_configure
*/
function provision_mysql_provision_configure() {
$form['provision_db_user'] = array(
$form['db_host'] = array(
'#type' => 'textfield',
'#title' => t('Mysql server hostname'),
'#description' => t('The mysql server to connect to.'),
'#size' => 30,
'#default_value' => variable_get('provision_db_host', 'localhost'),
'#maxlength' => 64,
);
$form['db_user'] = array(
'#type' => 'textfield',
'#required' => TRUE,
'#title' => t('Mysql user account'),
......@@ -61,7 +70,7 @@ function provision_mysql_provision_configure() {
'#default_value' => variable_get('provision_db_user', 'root'),
'#maxlength' => 255,
);
$form['provision_db_password'] = array(
$form['db_passwd'] = array(
'#type' => 'password_confirm',
'#required' => (variable_get("provision_db_password", TRUE)) ? FALSE : TRUE,
'#title' => t('Mysql user password'),
......@@ -70,14 +79,6 @@ function provision_mysql_provision_configure() {
'#maxlength' => 64,
);
$form['provision_db_host'] = array(
'#type' => 'textfield',
'#title' => t('Mysql server hostname'),
'#description' => t('The mysql server to connect to.'),
'#size' => 30,
'#default_value' => variable_get('provision_db_host', 'localhost'),
'#maxlength' => 64,
);
return $form;
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment