--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cms/drupal/profiles/drustack/drustack.install Fri Sep 08 12:04:06 2017 +0200
@@ -0,0 +1,193 @@
+<?php
+
+/**
+ * @file
+ * Install, update and uninstall functions for the drustack installation profile.
+ */
+
+/**
+ * Implements hook_install().
+ *
+ * Perform actions to set up the site for this profile.
+ */
+function drustack_install() {
+ // We only execute once for initial installation.
+ if (!defined('MAINTENANCE_MODE') || MAINTENANCE_MODE !== 'install') {
+ return;
+ }
+
+ // Enable the default theme.
+ theme_enable(array('responsive_bartik', 'seven'));
+ variable_set('theme_default', 'responsive_bartik');
+ variable_set('admin_theme', 'seven');
+
+ // Additional setting about themes.
+ theme_disable(array('bartik', 'seven'));
+ variable_set('node_admin_theme', '1');
+
+ // Enable some standard blocks.
+ $default_theme = variable_get('theme_default', 'bartik');
+ $admin_theme = variable_get('admin_theme', 0);
+ $blocks = array(
+ array(
+ 'module' => 'system',
+ 'delta' => 'main',
+ 'theme' => $default_theme,
+ 'status' => 1,
+ 'weight' => 0,
+ 'region' => 'content',
+ 'pages' => '',
+ 'cache' => -1,
+ ),
+ array(
+ 'module' => 'search',
+ 'delta' => 'form',
+ 'theme' => $default_theme,
+ 'status' => 1,
+ 'weight' => -1,
+ 'region' => 'sidebar_first',
+ 'pages' => '',
+ 'cache' => -1,
+ ),
+ array(
+ 'module' => 'user',
+ 'delta' => 'login',
+ 'theme' => $default_theme,
+ 'status' => 1,
+ 'weight' => 0,
+ 'region' => 'sidebar_first',
+ 'pages' => '',
+ 'cache' => -1,
+ ),
+ array(
+ 'module' => 'system',
+ 'delta' => 'navigation',
+ 'theme' => $default_theme,
+ 'status' => 1,
+ 'weight' => 0,
+ 'region' => 'sidebar_first',
+ 'pages' => '',
+ 'cache' => -1,
+ ),
+ array(
+ 'module' => 'system',
+ 'delta' => 'powered-by',
+ 'theme' => $default_theme,
+ 'status' => 1,
+ 'weight' => 10,
+ 'region' => 'footer',
+ '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,
+ ),
+ );
+
+ db_update('block')
+ ->fields(array(
+ 'status' => 0,
+ ))
+ ->condition('theme', $admin_theme)
+ ->execute();
+ foreach ($blocks as $block) {
+ db_merge('block')
+ ->key(array(
+ 'module' => $block['module'],
+ 'delta' => $block['delta'],
+ 'theme' => $block['theme'],
+ ))
+ ->fields(array(
+ 'status' => $block['status'],
+ 'weight' => $block['weight'],
+ 'region' => $block['region'],
+ 'pages' => $block['pages'],
+ 'cache' => $block['cache'],
+ ))
+ ->execute();
+ }
+
+ // Allow visitor account creation, but with administrative approval.
+ variable_set('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL);
+
+ // Enable default permissions for system roles.
+ user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access content'));
+ user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access content'));
+
+ // 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();
+}
+
+/**
+ * Update with new drustack core structure + mobile ready admin.
+ */
+function drustack_update_7000() {
+ // Enable the admin theme and responsive Bartik theme.
+ theme_enable(array('responsive_bartik', 'ember'));
+ variable_set('admin_theme', 'seven');
+ variable_set('node_admin_theme', '1');
+
+ // Enable/disable with some new modules.
+ module_disable(array(
+ 'toolbar',
+ 'overlay',
+ ));
+ module_enable(array(
+ 'drustack_core',
+ 'navbar',
+ ));
+
+ // Rebuild node access database.
+ node_access_rebuild();
+
+ // Rebuild node types.
+ node_types_rebuild();
+
+ // Rebuild the menu.
+ menu_rebuild();
+
+ // Clear drupal message queue for non-warning/errors.
+ drupal_get_messages('status', TRUE);
+
+ // Clear out caches.
+ drupal_flush_all_caches();
+
+ // Clear out JS and CSS caches.
+ drupal_clear_css_cache();
+ drupal_clear_js_cache();
+}