diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-08-21 07:50:08 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-08-21 07:50:08 +0000 |
commit | 716293e0fbf1155b8e78c4bd2762c98275b8e6cb (patch) | |
tree | a8dd7691cd035f407268e41969ffbb033871bc36 /profiles/default | |
parent | d151ea91004abd0c771dfeea380ff4fef0fbf248 (diff) | |
download | brdo-716293e0fbf1155b8e78c4bd2762c98275b8e6cb.tar.gz brdo-716293e0fbf1155b8e78c4bd2762c98275b8e6cb.tar.bz2 |
#509398 by adrian: Turned install profiles into modules with full access to the Drupal API. Almost all WTFs/minute now removed from install profiles. Woohoo! :D
Diffstat (limited to 'profiles/default')
-rw-r--r-- | profiles/default/default.info | 1 | ||||
-rw-r--r-- | profiles/default/default.install | 216 | ||||
-rw-r--r-- | profiles/default/default.profile | 228 |
3 files changed, 217 insertions, 228 deletions
diff --git a/profiles/default/default.info b/profiles/default/default.info index 583829d88..c143de092 100644 --- a/profiles/default/default.info +++ b/profiles/default/default.info @@ -15,3 +15,4 @@ dependencies[] = dblog dependencies[] = search dependencies[] = toolbar dependencies[] = field_ui +files[] = default.profile diff --git a/profiles/default/default.install b/profiles/default/default.install new file mode 100644 index 000000000..7a81aecd5 --- /dev/null +++ b/profiles/default/default.install @@ -0,0 +1,216 @@ +<?php +// $Id$ + +/** + * Implement hook_install(). + * + * Perform actions to set up the site for this profile. + */ +function default_install() { + + // Enable some standard blocks. + $values = array( + array( + 'module' => 'system', + 'delta' => 'main', + 'theme' => 'garland', + 'status' => 1, + 'weight' => 0, + 'region' => 'content', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'user', + 'delta' => 'login', + 'theme' => 'garland', + 'status' => 1, + 'weight' => 0, + 'region' => 'sidebar_first', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'system', + 'delta' => 'navigation', + 'theme' => 'garland', + 'status' => 1, + 'weight' => 0, + 'region' => 'sidebar_first', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'system', + 'delta' => 'management', + 'theme' => 'garland', + 'status' => 1, + 'weight' => 1, + 'region' => 'sidebar_first', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'system', + 'delta' => 'powered-by', + 'theme' => 'garland', + 'status' => 1, + 'weight' => 10, + 'region' => 'footer', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'system', + 'delta' => 'help', + 'theme' => 'garland', + 'status' => 1, + 'weight' => 0, + 'region' => 'help', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'system', + 'delta' => 'main', + 'theme' => 'seven', + 'status' => 1, + 'weight' => 0, + 'region' => 'content', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'system', + 'delta' => 'help', + 'theme' => 'seven', + 'status' => 1, + 'weight' => 0, + 'region' => 'help', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'user', + 'delta' => 'login', + 'theme' => 'seven', + '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(); + + // Insert default user-defined node types into the database. For a complete + // list of available node type attributes, refer to the node type API + // documentation at: http://api.drupal.org/api/HEAD/function/hook_node_info. + $types = array( + array( + 'type' => 'page', + 'name' => st('Page'), + 'base' => 'node_content', + 'description' => st("Use <em>pages</em> for your static content, such as an 'About us' page."), + 'custom' => 1, + 'modified' => 1, + 'locked' => 0, + ), + array( + 'type' => 'article', + 'name' => st('Article'), + 'base' => 'node_content', + 'description' => st('Use <em>articles</em> for time-specific content like news, press releases or blog posts.'), + 'custom' => 1, + 'modified' => 1, + 'locked' => 0, + ), + ); + + foreach ($types as $type) { + $type = node_type_set_defaults($type); + node_type_save($type); + } + + // Default page to not be promoted and have comments disabled. + variable_set('node_options_page', array('status')); + variable_set('comment_page', COMMENT_NODE_HIDDEN); + + // Don't display date and author information for page nodes by default. + variable_set('node_submitted_page', FALSE); + + // Create an image style. + $style = array('name' => 'thumbnail'); + $style = image_style_save($style); + $effect = array( + 'isid' => $style['isid'], + 'name' => 'image_scale_and_crop', + 'data' => array('width' => '85', 'height' => '85'), + ); + image_effect_save($effect); + + // Enable user picture support and set the default to a square thumbnail option. + variable_set('user_pictures', '1'); + variable_set('user_picture_dimensions', '1024x1024'); + variable_set('user_picture_file_size', '800'); + variable_set('user_picture_style', 'thumbnail'); + + $theme_settings = theme_get_settings(); + $theme_settings['toggle_node_user_picture'] = '1'; + $theme_settings['toggle_comment_user_picture'] = '1'; + variable_set('theme_settings', $theme_settings); + + // Create a default vocabulary named "Tags", enabled for the 'article' content type. + $description = st('Use tags to group articles on similar topics into categories.'); + $help = st('Enter a comma-separated list of words to describe your content.'); + + $vid = db_insert('taxonomy_vocabulary')->fields(array( + 'name' => 'Tags', + 'description' => $description, + 'machine_name' => 'tags', + 'help' => $help, + 'relations' => 0, + 'hierarchy' => 0, + 'multiple' => 0, + 'required' => 0, + 'tags' => 1, + 'module' => 'taxonomy', + 'weight' => 0, + ))->execute(); + db_insert('taxonomy_vocabulary_node_type')->fields(array('vid' => $vid, 'type' => 'article'))->execute(); + + // Create a default role for site administrators. + $rid = db_insert('role')->fields(array('name' => 'administrator'))->execute(); + + // Set this as the administrator role. + variable_set('user_admin_role', $rid); + + // Assign all available permissions to this role. + foreach (module_invoke_all('permission') as $key => $value) { + db_insert('role_permission') + ->fields(array( + 'rid' => $rid, + 'permission' => $key, + ))->execute(); + } + + // Update the menu router information. + menu_rebuild(); + + // Save some default links. + $link = array('link_path' => 'admin/structure/menu-customize/main-menu/add', 'link_title' => 'Add a main menu link', 'menu_name' => 'main-menu'); + menu_link_save($link); + + // Enable the admin theme. + db_update('system') + ->fields(array('status' => 1)) + ->condition('type', 'theme') + ->condition('name', 'seven') + ->execute(); + variable_set('admin_theme', 'seven'); + variable_set('node_admin_theme', '1'); +} diff --git a/profiles/default/default.profile b/profiles/default/default.profile index 15a640749..4724aea39 100644 --- a/profiles/default/default.profile +++ b/profiles/default/default.profile @@ -2,234 +2,6 @@ // $Id$ /** - * Implement hook_profile_tasks(). - */ -function default_profile_tasks() { - $tasks = array( - 'default_profile_site_setup' => array(), - ); - return $tasks; -} - -/** - * Installation task; perform actions to set up the site for this profile. - * - * This task does not return any output, meaning that control will be passed - * along to the next task without ending the page request. - * - * @param $install_state - * An array of information about the current installation state. - */ -function default_profile_site_setup(&$install_state) { - - // Enable some standard blocks. - $values = array( - array( - 'module' => 'system', - 'delta' => 'main', - 'theme' => 'garland', - 'status' => 1, - 'weight' => 0, - 'region' => 'content', - 'pages' => '', - 'cache' => -1, - ), - array( - 'module' => 'user', - 'delta' => 'login', - 'theme' => 'garland', - 'status' => 1, - 'weight' => 0, - 'region' => 'sidebar_first', - 'pages' => '', - 'cache' => -1, - ), - array( - 'module' => 'system', - 'delta' => 'navigation', - 'theme' => 'garland', - 'status' => 1, - 'weight' => 0, - 'region' => 'sidebar_first', - 'pages' => '', - 'cache' => -1, - ), - array( - 'module' => 'system', - 'delta' => 'management', - 'theme' => 'garland', - 'status' => 1, - 'weight' => 1, - 'region' => 'sidebar_first', - 'pages' => '', - 'cache' => -1, - ), - array( - 'module' => 'system', - 'delta' => 'powered-by', - 'theme' => 'garland', - 'status' => 1, - 'weight' => 10, - 'region' => 'footer', - 'pages' => '', - 'cache' => -1, - ), - array( - 'module' => 'system', - 'delta' => 'help', - 'theme' => 'garland', - 'status' => 1, - 'weight' => 0, - 'region' => 'help', - 'pages' => '', - 'cache' => -1, - ), - array( - 'module' => 'system', - 'delta' => 'main', - 'theme' => 'seven', - 'status' => 1, - 'weight' => 0, - 'region' => 'content', - 'pages' => '', - 'cache' => -1, - ), - array( - 'module' => 'system', - 'delta' => 'help', - 'theme' => 'seven', - 'status' => 1, - 'weight' => 0, - 'region' => 'help', - 'pages' => '', - 'cache' => -1, - ), - array( - 'module' => 'user', - 'delta' => 'login', - 'theme' => 'seven', - '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(); - - // Insert default user-defined node types into the database. For a complete - // list of available node type attributes, refer to the node type API - // documentation at: http://api.drupal.org/api/HEAD/function/hook_node_info. - $types = array( - array( - 'type' => 'page', - 'name' => st('Page'), - 'base' => 'node_content', - 'description' => st("Use <em>pages</em> for your static content, such as an 'About us' page."), - 'custom' => 1, - 'modified' => 1, - 'locked' => 0, - ), - array( - 'type' => 'article', - 'name' => st('Article'), - 'base' => 'node_content', - 'description' => st('Use <em>articles</em> for time-specific content like news, press releases or blog posts.'), - 'custom' => 1, - 'modified' => 1, - 'locked' => 0, - ), - ); - - foreach ($types as $type) { - $type = node_type_set_defaults($type); - node_type_save($type); - } - - // Default page to not be promoted and have comments disabled. - variable_set('node_options_page', array('status')); - variable_set('comment_page', COMMENT_NODE_HIDDEN); - - // Don't display date and author information for page nodes by default. - variable_set('node_submitted_page', FALSE); - - // Create an image style. - $style = array('name' => 'thumbnail'); - $style = image_style_save($style); - $effect = array( - 'isid' => $style['isid'], - 'name' => 'image_scale_and_crop', - 'data' => array('width' => '85', 'height' => '85'), - ); - image_effect_save($effect); - - // Enable user picture support and set the default to a square thumbnail option. - variable_set('user_pictures', '1'); - variable_set('user_picture_dimensions', '1024x1024'); - variable_set('user_picture_file_size', '800'); - variable_set('user_picture_style', 'thumbnail'); - - $theme_settings = theme_get_settings(); - $theme_settings['toggle_node_user_picture'] = '1'; - $theme_settings['toggle_comment_user_picture'] = '1'; - variable_set('theme_settings', $theme_settings); - - // Create a default vocabulary named "Tags", enabled for the 'article' content type. - $description = st('Use tags to group articles on similar topics into categories.'); - $help = st('Enter a comma-separated list of words to describe your content.'); - - $vid = db_insert('taxonomy_vocabulary')->fields(array( - 'name' => 'Tags', - 'description' => $description, - 'machine_name' => 'tags', - 'help' => $help, - 'relations' => 0, - 'hierarchy' => 0, - 'multiple' => 0, - 'required' => 0, - 'tags' => 1, - 'module' => 'taxonomy', - 'weight' => 0, - ))->execute(); - db_insert('taxonomy_vocabulary_node_type')->fields(array('vid' => $vid, 'type' => 'article'))->execute(); - - // Create a default role for site administrators. - $rid = db_insert('role')->fields(array('name' => 'administrator'))->execute(); - - // Set this as the administrator role. - variable_set('user_admin_role', $rid); - - // Assign all available permissions to this role. - foreach (module_invoke_all('permission') as $key => $value) { - db_insert('role_permission') - ->fields(array( - 'rid' => $rid, - 'permission' => $key, - ))->execute(); - } - - // Update the menu router information. - menu_rebuild(); - - // Save some default links. - $link = array('link_path' => 'admin/structure/menu-customize/main-menu/add', 'link_title' => 'Add a main menu link', 'menu_name' => 'main-menu'); - menu_link_save($link); - - // Enable the admin theme. - db_update('system') - ->fields(array('status' => 1)) - ->condition('type', 'theme') - ->condition('name', 'seven') - ->execute(); - variable_set('admin_theme', 'seven'); - variable_set('node_admin_theme', '1'); -} - -/** * Implement hook_form_alter(). * * Allows the profile to alter the site-configuration form. This is |