| 1 |
<?php
|
| 2 |
// $Id$
|
| 3 |
/**
|
| 4 |
* @file
|
| 5 |
* Install profile for a developer setup
|
| 6 |
*/
|
| 7 |
|
| 8 |
function drupal_developer_profile_modules() {
|
| 9 |
return array(
|
| 10 |
// enable core modules
|
| 11 |
'user', 'filter', 'block', 'node', 'taxonomy', 'comment', 'profile', 'menu',
|
| 12 |
// enable devel modules
|
| 13 |
'devel', 'devel_generate',
|
| 14 |
// enable admin menu
|
| 15 |
'admin_menu',
|
| 16 |
// enable coder
|
| 17 |
'coder',
|
| 18 |
// enable simpletest
|
| 19 |
'simpletest'
|
| 20 |
);
|
| 21 |
}
|
| 22 |
|
| 23 |
function drupal_developer_profile_details() {
|
| 24 |
return array(
|
| 25 |
'name' => 'Drupal developer profile',
|
| 26 |
'description' => 'Profile containing and installing development modules. WARNING! It contains dangerous user permissions, for development purposes only.',
|
| 27 |
);
|
| 28 |
}
|
| 29 |
|
| 30 |
function drupal_developer_profile_tasks(&$task, $url) {
|
| 31 |
// copied from default.profile
|
| 32 |
$types = array(
|
| 33 |
array(
|
| 34 |
'type' => 'page',
|
| 35 |
'name' => st('Page'),
|
| 36 |
'module' => 'node',
|
| 37 |
'description' => st("A <em>page</em>, similar in form to a <em>story</em>, is a simple method for creating and displaying information that rarely changes, such as an \"About us\" section of a website. By default, a <em>page</em> entry does not allow visitor comments and is not featured on the site's initial home page."),
|
| 38 |
'custom' => TRUE,
|
| 39 |
'modified' => TRUE,
|
| 40 |
'locked' => FALSE,
|
| 41 |
'help' => '',
|
| 42 |
'min_word_count' => '',
|
| 43 |
),
|
| 44 |
array(
|
| 45 |
'type' => 'story',
|
| 46 |
'name' => st('Story'),
|
| 47 |
'module' => 'node',
|
| 48 |
'description' => st("A <em>story</em>, similar in form to a <em>page</em>, is ideal for creating and displaying content that informs or engages website visitors. Press releases, site announcements, and informal blog-like entries may all be created with a <em>story</em> entry. By default, a <em>story</em> entry is automatically featured on the site's initial home page, and provides the ability to post comments."),
|
| 49 |
'custom' => TRUE,
|
| 50 |
'modified' => TRUE,
|
| 51 |
'locked' => FALSE,
|
| 52 |
'help' => '',
|
| 53 |
'min_word_count' => '',
|
| 54 |
),
|
| 55 |
);
|
| 56 |
|
| 57 |
foreach ($types as $type) {
|
| 58 |
$type = (object) _node_type_set_defaults($type);
|
| 59 |
node_type_save($type);
|
| 60 |
}
|
| 61 |
|
| 62 |
// Default page to not be promoted and have comments disabled.
|
| 63 |
variable_set('node_options_page', array('status'));
|
| 64 |
variable_set('comment_page', COMMENT_NODE_DISABLED);
|
| 65 |
|
| 66 |
// Don't display date and author information for page nodes by default.
|
| 67 |
$theme_settings = variable_get('theme_settings', array());
|
| 68 |
$theme_settings['toggle_node_info_page'] = FALSE;
|
| 69 |
variable_set('theme_settings', $theme_settings);
|
| 70 |
|
| 71 |
// Update the menu router information.
|
| 72 |
menu_rebuild();
|
| 73 |
}
|
| 74 |
|
| 75 |
/*
|
| 76 |
* Implementation of hook_form_alter().
|
| 77 |
*/
|
| 78 |
function drupal_developer_form_alter(&$form, $form_state, $form_id) {
|
| 79 |
if ($form_id == 'install_configure') {
|
| 80 |
// Set default for site name field.
|
| 81 |
$form['site_information']['site_name']['#default_value'] = t('Drupal Devel');
|
| 82 |
$form['site_information']['site_mail']['#default_value'] = 'drupal@localhost';
|
| 83 |
$form['admin_account']['account']['name']['#default_value'] = 'drupal';
|
| 84 |
$form['admin_account']['account']['mail']['#default_value'] = 'drupal@localhost';
|
| 85 |
$form['admin_account']['account']['pass']['#type'] = 'textfield';
|
| 86 |
$form['admin_account']['account']['pass']['#default_value'] = 'drupal';
|
| 87 |
}
|
| 88 |
}
|
| 89 |
|
| 90 |
|
| 91 |
function drupal_developer_profile_final() {
|
| 92 |
// adding default content types, otherwise they are not created
|
| 93 |
$types = array(
|
| 94 |
array(
|
| 95 |
'type' => 'page',
|
| 96 |
'name' => t('Page'),
|
| 97 |
'module' => 'node',
|
| 98 |
'description' => t('If you want to add a static page, like a contact page or an about page, use a page.'),
|
| 99 |
'custom' => TRUE,
|
| 100 |
'modified' => TRUE,
|
| 101 |
'locked' => FALSE,
|
| 102 |
),
|
| 103 |
array(
|
| 104 |
'type' => 'story',
|
| 105 |
'name' => t('Story'),
|
| 106 |
'module' => 'node',
|
| 107 |
'description' => t('Stories are articles in their simplest form: they have a title, a teaser and a body, but can be extended by other modules. The teaser is part of the body too. Stories may be used as a personal blog or for news articles.'),
|
| 108 |
'custom' => TRUE,
|
| 109 |
'modified' => TRUE,
|
| 110 |
'locked' => FALSE,
|
| 111 |
),
|
| 112 |
);
|
| 113 |
|
| 114 |
foreach ($types as $type) {
|
| 115 |
$type = (object) _node_type_set_defaults($type);
|
| 116 |
node_type_save($type);
|
| 117 |
}
|
| 118 |
|
| 119 |
// Default page to not be promoted and have comments disabled.
|
| 120 |
variable_set('node_options_page', array('status'));
|
| 121 |
variable_set('comment_page', COMMENT_NODE_DISABLED);
|
| 122 |
|
| 123 |
// adding devel blocks
|
| 124 |
|
| 125 |
db_query("INSERT INTO {blocks} VALUES ('devel','2','garland',1,0,'right',0,0,0,'','')");
|
| 126 |
db_query("INSERT INTO {blocks} VALUES ('devel','1','garland',1,0,'right',0,0,0,'','')");
|
| 127 |
db_query("INSERT INTO {blocks} VALUES ('devel','0','garland',1,0,'right',0,0,0,'','')");
|
| 128 |
// adding permissions for anonym to access content, to auth to post comments, and switch users
|
| 129 |
// WARNING unsafe settings for live site ------------------------------------------'''''''''
|
| 130 |
db_query("UPDATE {permission} SET perm = 'access comments, access content' WHERE rid = 1");
|
| 131 |
db_query("UPDATE {permission} SET perm = 'access comments, post comments, post comments without approval, switch users, access content' WHERE rid = 2");
|
| 132 |
// Add admin user: drupal:drupal
|
| 133 |
$uid = db_next_id('{users}_uid');
|
| 134 |
db_query("INSERT INTO {users} VALUES( %d,'drupal','08d15a4aef553492d8971cdd5198f314','drupal@localhost',0,0,0,'','','120 7223939',1207223949,0,1,'0','','','drupal@localhost','a:0:{}')", $uid);
|
| 135 |
|
| 136 |
return t('Welcome to <a href="@url>your new development install</a>. Username:password is drupal:drupal. Happy coding.', array('@url' => url('')));
|
| 137 |
|
| 138 |
}
|