Commit 7973ef17 authored by kpaxman's avatar kpaxman
Browse files

Create 1.5.7-rc3

parents
This diff is collapsed.
Prerequisites
-------------
PHP is required, the install profile has been tested with version 5.3.3.
The install profile uses a lot of memory when installing, and the typical default PHP memory limit of 128MB is not enough. A 512MB limit is recommended to avoid installation issues.
The LDAP module for PHP5 is required for the Contact Feature to retrieve user information from LDAP (php5-ldap). This module may not be installed by default.
A copy of Drupal is also required; this version of the install profile has been tested on Drupal 7.10.
In order to retrieve all the files required for the install, the rebuild.sh script requires the installation of Drush (http://drupal.org/project/drush), Drush Make (http://drupal.org/project/drush_make) and Subversion (SVN).
Drush Make may work from several locations. One good place to save it is in a hidden .drush folder in your home folder. Ex. ~/.drush/drush_make/<files go here>
Finally, a database installation is also required. mySQL is recommended, and the install profile has been tested on 5.5.16.
Installation
------------
To get things started, the profile files should be copied to "drupal/profiles/uw_base_profile".
Following that, run "./rebuild.sh" from the "drupal/profiles/uw_base_profile" folder to pull down all the required themes, modules, features and libraries.
After that is complete, start a Drupal site installation process (http://<your Drupal site address>/install.php)
If the profile is sitting in the correct folder, you should see "uWaterloo Base Profile" in addition to the usual Standard and Minimal installation profiles. Select that and press the "Save and continue" button.
On the next page, "Choose language", select English and continue.
The "Verify requirements" page will only appear if you are not satisfying a requirement, for example by having incorrect folder permissions. You must satisfy all requirements to proceed.
The "Set up database" page appears if your database information was not previously configured. Enter your database information and press "Save and continue".
The "Install profile" page will appear as Drupal is installing.
Once that is complete, you will be at the "Configure site" page. This is the standard Drupal site configuration page; enter the information and continue. Please note that you are creating a admin local user for this point and not a CAS user. Press "Save and continue".
On the next page "Optionally enable a site controller", you will probably want to select the FDSU configuration (unless you want to turn on all the components individually).
Next is the "Enable features" page. Here you can enable the content types you want to use on your site. The web page content type is turned on by default. Additionally, you can enable modules that help with development here. Please do not enable these modules on a production site.
Finally, you can choose to have some basic pages created for you. The last stage can take several minutes to complete, regardless of whether or not you create pages.
#!/bin/sh
rm -rf libraries modules themes
drush make --working-copy --no-core -y --contrib-destination=. uw_base_profile.make
chmod -R g+w *
# this is getting installed by rules module, so we'll pull it out.
rm -rf modules/entity
name = uWaterloo Base Profile
description = uWaterloo base Installation Profile. Has options to install Main and FDSU sites.
version = 7.x-1.5.7-rc3
core = 7.x
dependencies[] = block
dependencies[] = color
dependencies[] = contextual
dependencies[] = dashboard
dependencies[] = help
dependencies[] = image
dependencies[] = list
dependencies[] = menu
dependencies[] = number
dependencies[] = options
dependencies[] = path
dependencies[] = taxonomy
dependencies[] = dblog
dependencies[] = search
dependencies[] = toolbar
dependencies[] = field_ui
dependencies[] = file
dependencies[] = rdf
dependencies[] = shortcut
files[] = uw_base_profile.profile
<?php
// $Id: uWaterloo Base
/**
* Implements hook_install().
*
* Perform actions to set up the site for this profile.
*/
function uw_base_profile_install() {
// Enable some standard blocks.
$default_theme = variable_get('theme_default', 'bartik');
$admin_theme = 'seven';
$values = array(
array(
'module' => 'system',
'delta' => 'main',
'theme' => $default_theme,
'status' => 1,
'weight' => 0,
'region' => 'content',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'system',
'delta' => 'help',
'theme' => $default_theme,
'status' => 1,
'weight' => 0,
'region' => 'help',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'system',
'delta' => 'main',
'theme' => $admin_theme,
'status' => 1,
'weight' => 0,
'region' => 'content',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'system',
'delta' => 'help',
'theme' => $admin_theme,
'status' => 1,
'weight' => 0,
'region' => 'help',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'user',
'delta' => 'login',
'theme' => $admin_theme,
'status' => 1,
'weight' => 10,
'region' => 'content',
'pages' => '',
'cache' => -1,
),
);
$query = db_insert('block')->fields(array('module', 'delta', 'theme', 'status', 'weight', 'region', 'pages', 'cache'));
foreach ($values as $record) {
$query->values($record);
}
$query->execute();
// Disable user picture support and set the default to a square thumbnail option in case it is enabled later.
variable_set('user_pictures', '0');
variable_set('user_picture_dimensions', '1024x1024');
variable_set('user_picture_file_size', '800');
variable_set('user_picture_style', 'thumbnail');
// Allow visitor account creation with administrative approval.
variable_set('user_register', USER_REGISTER_ADMINISTRATORS_ONLY);
// Create an image field named "Image", enabled for the 'article' content type.
// Many of the following values will be defaulted, they're included here as an illustrative examples.
// See http://api.drupal.org/api/function/field_create_field/7
$field = array(
'field_name' => 'field_image',
'type' => 'image',
'cardinality' => 1,
'translatable' => TRUE,
'locked' => FALSE,
'indexes' => array('fid' => array('fid')),
'settings' => array(
'uri_scheme' => 'public',
'default_image' => FALSE,
),
'storage' => array(
'type' => 'field_sql_storage',
'settings' => array(),
),
);
field_create_field($field);
// Get the admin role ID from the variable, if it doesn't exist yet we need to define it
$admin_role_id = variable_get('user_admin_role');
if (empty($admin_role_id)) {
// Create a default role for site administrators, with all available permissions assigned.
$admin_role = new stdClass();
$admin_role->name = 'administrator';
$admin_role->weight = 2;
user_role_save($admin_role);
user_role_grant_permissions($admin_role->rid, array_keys(module_invoke_all('permission')));
// Set this as the administrator role.
variable_set('user_admin_role', $admin_role->rid);
$admin_role_id = $admin_role->rid;
}
// Assign user 1 the "administrator" role.
db_insert('users_roles')
->fields(array('uid' => 1, 'rid' => $admin_role_id))
->execute();
// Create a Home link in the main menu.
$item = array(
'link_title' => st('Home'),
'link_path' => '<front>',
'menu_name' => 'main-menu',
);
menu_link_save($item);
// Update the menu router information.
menu_rebuild();
// Enable the admin theme.
db_update('system')
->fields(array('status' => 1))
->condition('type', 'theme')
->condition('name', 'seven')
->execute();
variable_set('node_admin_theme', '1');
// Set default theme to gateways
theme_enable(array('seven'));
variable_set('admin_theme', 'seven');
variable_set('node_admin_theme', '1');
// Set date-related variables.
variable_set('date_first_day', '1');
variable_set('date_api_use_iso8601', TRUE);
variable_set('date_format_long', 'l, F j, Y - H:i');
variable_set('date_format_medium', 'D, Y-m-d H:i');
variable_set('date_format_short', 'Y-m-d H:i');
}
This diff is collapsed.
<?php
/*
* This function is called by form submit handlers to increase script execution time limits.
*/
function _uw_base_profile_max_execution_time() {
// Increase execution time for installs.
if ((int)ini_get('max_execution_time') < 240) {
set_time_limit(240);
}
// Make sure the MySQL does not die while scripts are executed.
if (db_driver() === 'mysql') {
db_query('SET SESSION wait_timeout = 240');
}
}
/**
* Implements hook_form_FORM_ID_alter().
*
* Allows the profile to alter the site configuration form.
*/
function uw_base_profile_form_install_configure_form_alter(&$form, $form_state) {
// Pre-populate the site name with the server name.
$form['site_information']['site_name']['#default_value'] = $_SERVER['SERVER_NAME'];
// Pre-populate the country with "Canada".
$form['server_settings']['site_default_country']['#default_value'] = 'CA';
// Disable time zone autodetect and default to "America/Toronto".
$form['server_settings']['date_default_timezone']['#attributes']['class'][0] = '';
$form['server_settings']['date_default_timezone']['#default_value'] = 'America/Toronto';
// Disable email notifications by default.
$form['update_notifications']['update_status_module']['#default_value'][1] = 0;
}
/**
* Implements hook_install_tasks().
*/
function uw_base_profile_install_tasks() {
$tasks = array();
$tasks['uw_select_site_controller_form'] = array(
'display_name' => st('Site controller'),
'type' => 'form',
);
$tasks['uw_select_site_features_form'] = array(
'display_name' => st('Features'),
'type' => 'form',
);
$tasks['uw_create_default_content_form'] = array(
'display_name' => st('Create content'),
'type' => 'form',
);
return $tasks;
}
/**
* Task callback: returns the form allowing the user to select a site controller.
*/
function uw_select_site_controller_form() {
drupal_set_title(st('Optionally enable a site controller'));
$form['select_site_controller'] = array(
'#type' => 'radios',
'#title' => st('Please select a site configuration'),
'#options' => array('none' => st('None'), 'fdsu' => st('FDSU'), 'main' => st('Main')),
'#default_value' => 'none',
);
$form['actions'] = array('#type' => 'actions');
$form['submit'] = array('#type' => 'submit', '#value' => st('Enable and continue'));
return $form;
}
/**
* Submit callback: turns on a site controller
*/
function uw_select_site_controller_form_submit(&$form, &$form_state) {
_uw_base_profile_max_execution_time();
if ($form_state['values']['select_site_controller'] == 'fdsu') {
$success = module_enable(array('uw_site_fdsu'));
}
if ($form_state['values']['select_site_controller'] == 'main') {
$success = module_enable(array('uw_site_main'));
}
if (isset($success) && !$success) {
drupal_set_message('Could not enable site controller, a module dependency was missing -- the function module_enable() returned FALSE', 'error');
}
}
/**
* Task callback: returns the form allowing the user to turn on features at install time.
*/
function uw_select_site_features_form() {
drupal_set_title(st('Enable features'));
$form['enable_content_types'] = array(
'#type' => 'fieldset',
'#title' => st('Enable content types'),
'#collapsible' => FALSE,
'#tree' => TRUE,
);
// the array key is the name of the module
$form['enable_content_types']['uw_ct_contact'] = array(
'#type' => 'checkbox',
'#title' => st('Contacts'),
);
$form['enable_content_types']['uw_ct_custom_listing'] = array(
'#type' => 'checkbox',
'#title' => st('Custom listing page'),
);
$form['enable_content_types']['uw_ct_event'] = array(
'#type' => 'checkbox',
'#title' => st('Events'),
);
$form['enable_content_types']['uw_ct_home_page_banner'] = array(
'#type' => 'checkbox',
'#title' => st('Home page banners'),
);
$form['enable_content_types']['uw_ct_news_item'] = array(
'#type' => 'checkbox',
'#title' => st('News items'),
);
$form['enable_content_types']['uw_ct_person_profile'] = array(
'#type' => 'checkbox',
'#title' => st('People profiles'),
);
$form['enable_content_types']['uw_ct_image_gallery'] = array(
'#type' => 'checkbox',
'#title' => st('Image galleries'),
);
$form['enable_content_types']['uw_ct_promo_item'] = array(
'#type' => 'checkbox',
'#title' => st('Promotional items'),
);
$form['enable_content_types']['uw_ct_web_form'] = array(
'#type' => 'checkbox',
'#title' => st('Web Form'),
);
$form['enable_content_types']['uw_captcha'] = array(
'#type' => 'checkbox',
'#title' => st('CAPTCHA'),
);
/* DEVELOPMENT */
$form['enable_development'] = array(
'#type' => 'fieldset',
'#title' => st('Enable development modules'),
'#collapsible' => FALSE,
'#tree' => TRUE,
);
$form['enable_development']['uw_auth_wcms_admins'] = array(
'#type' => 'checkbox',
'#title' => st('Add WCMS administrators'),
);
$form['enable_development']['coder'] = array(
'#type' => 'checkbox',
'#title' => st('Coder'),
);
$form['enable_development']['coder_review'] = array(
'#type' => 'checkbox',
'#title' => st('Coder Review'),
'#states' => array(
'visible' => array( // action to take.
':input[name="enable_development[coder]"]' // element to evaluate condition on
=> array('checked' => TRUE), // condition
),
),
);
$form['enable_development']['context_ui'] = array(
'#type' => 'checkbox',
'#title' => st('Context UI'),
);
$form['enable_development']['devel'] = array(
'#type' => 'checkbox',
'#title' => st('Devel'),
);
$form['enable_development']['devel_generate'] = array(
'#type' => 'checkbox',
'#title' => st('Devel Generate'),
'#states' => array(
'visible' => array( // action to take.
':input[name="enable_development[devel]"]' // element to evaluate condition on
=> array('checked' => TRUE), // condition
),
),
);
$form['enable_development']['drupal_reset'] = array(
'#type' => 'checkbox',
'#title' => st('Drupal Reset'),
);
$form['enable_development']['module_filter'] = array(
'#type' => 'checkbox',
'#title' => st('Module filter'),
);
$form['enable_development']['views_ui'] = array(
'#type' => 'checkbox',
'#title' => st('Views UI'),
);
$form['actions'] = array('#type' => 'actions');
$form['submit'] = array('#type' => 'submit', '#value' => st('Enable and continue'));
return $form;
}
/**
* Submit callback: creates the requested default content.
*/
function uw_select_site_features_form_submit(&$form, &$form_state) {
_uw_base_profile_max_execution_time();
$modules = array();
if (!empty($form_state['values']['enable_content_types'])) {
$modules = $form_state['values']['enable_content_types'];
}
if (!empty($form_state['values']['enable_development'])) {
$modules = array_merge($modules, $form_state['values']['enable_development']);
}
if (!empty($modules)) {
_uw_base_profile_enable_modules($modules);
}
}
/**
* Task callback: returns the form allowing the user to create initial or default content on install.
*/
function uw_create_default_content_form() {
drupal_set_title(st('Create initial default content'));
/* Default Web Pages */
if (module_exists('uw_ct_web_page')) {
$form['add_default_pages'] = array(
'#type' => 'fieldset',
'#title' => st('Create default web pages'),
'#collapsible' => FALSE,
'#tree' => TRUE,
);
$form['add_default_pages']['home'] = array(
'#type' => 'checkbox',
'#title' => st('Home'),
'#default_value' => 1,
);
$form['add_default_pages']['about'] = array(
'#type' => 'checkbox',
'#title' => st('About'),
'#default_value' => 1,
);
}
/* Turn on term lock for profile and audience taxonomies */
if (module_exists('uw_vocab_audience') || ('uw_ct_person_profile')) {
$form['add_vocab_pages'] = array(
'#type' => 'fieldset',
'#title' => st('Add terms to vocabularies'),
'#collapsible' => FALSE,
'#tree' => TRUE,
);
/* Add Audience vocabulary terms */
if (module_exists('uw_vocab_audience')) {
$form['add_vocab_pages']['audience'] = array(
'#type' => 'checkbox',
'#title' => st('Audience Vocabulary Terms'),
'#default_value' => 1,
);
}
/* Add Profile vocabulary terms */
if (module_exists('uw_ct_person_profile')) {
$form['add_vocab_pages']['profile'] = array(
'#type' => 'checkbox',
'#title' => st('Profile Vocabulary Terms'),
'#default_value' => 1,
);
}
}
$form['actions'] = array('#type' => 'actions');
$form['submit'] = array('#type' => 'submit', '#value' => st('Continue'));
return $form;
}
/**
* Submit callback: creates the requested default content.
*/
function uw_create_default_content_form_submit(&$form, &$form_state) {
_uw_base_profile_max_execution_time();
// clear all caches to rebuild the registry and node types that were setup earlier
drupal_flush_all_caches();
$modules = array();
// add default pages
if (!empty($form_state['values']['add_default_pages'])) {
// put the default pages into a Drupal variable. When the module is enabled, it will use this variable
// to determine which pages to add
variable_set('uw_data_web_pages_setup', $form_state['values']['add_default_pages']);
$modules['uw_data_web_pages'] = 1;
}
if (!empty($form_state['values']['add_vocab_pages']['audience'])) {
$modules['uw_data_audience_categories'] =1;
}
if (!empty($form_state['values']['add_vocab_pages']['profile'])) {
$modules['uw_data_profile_categories'] = 1;
}
// add default location / writer tips
if (!empty($form_state['values']['add_default_content'])) {
$modules = array_merge($modules, $form_state['values']['add_default_content']);
}
if (!empty($modules)) {
_uw_base_profile_enable_modules($modules);
}
}
/**
* Given an array where key => module_name and value => TRUE/FALSE,
* enables those modules
*/
function _uw_base_profile_enable_modules($modules = array()) {
$module_list = array();
foreach ($modules as $key => $value) {
if ($value) {
$module_list[] = $key;
}
}
if (!empty($module_list)) {
module_enable($module_list);
}
}
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