From 1374de60479467f88d711ff45b19e2ffe2d9aeef Mon Sep 17 00:00:00 2001 From: Dries <dries@buytaert.net> Date: Mon, 12 Dec 2011 22:29:45 -0500 Subject: [PATCH] - Patch #1181776 by sun, Psikik, mallezie, scor: change theme_default() variable to Stark. --- core/includes/ajax.inc | 2 +- core/includes/theme.inc | 4 ++-- core/includes/theme.maintenance.inc | 6 ++++++ core/modules/block/block.admin.inc | 2 +- core/modules/block/block.module | 8 ++++---- core/modules/block/block.test | 2 +- core/modules/dashboard/dashboard.module | 2 +- core/modules/node/node.test | 2 +- core/modules/statistics/statistics.test | 2 +- core/modules/system/system.admin.inc | 4 ++-- core/modules/system/system.install | 23 +++++++++++++++++++++-- profiles/minimal/minimal.install | 8 +++++++- profiles/standard/standard.install | 8 +++++++- 13 files changed, 55 insertions(+), 18 deletions(-) diff --git a/core/includes/ajax.inc b/core/includes/ajax.inc index 693fe3a2a0af..0f056dcf176f 100644 --- a/core/includes/ajax.inc +++ b/core/includes/ajax.inc @@ -420,7 +420,7 @@ function ajax_base_page_theme() { // to see the default theme, token validation isn't required for that, and // bypassing it allows most use-cases to work even when accessed from the // page cache. - if ($theme === variable_get('theme_default', 'bartik') || drupal_valid_token($token, $theme)) { + if ($theme === variable_get('theme_default', 'stark') || drupal_valid_token($token, $theme)) { return $theme; } } diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 902907ade248..e6c07254844a 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -80,7 +80,7 @@ function drupal_theme_initialize() { // Only select the user selected theme if it is available in the // list of themes that can be accessed. - $theme = !empty($user->theme) && drupal_theme_access($user->theme) ? $user->theme : variable_get('theme_default', 'bartik'); + $theme = !empty($user->theme) && drupal_theme_access($user->theme) ? $user->theme : variable_get('theme_default', 'stark'); // Allow modules to override the theme. Validation has already been performed // inside menu_get_custom_theme(), so we do not need to check it again here. @@ -1432,7 +1432,7 @@ function theme_enable($theme_list) { */ function theme_disable($theme_list) { // Don't disable the default theme. - if ($pos = array_search(variable_get('theme_default', 'bartik'), $theme_list) !== FALSE) { + if ($pos = array_search(variable_get('theme_default', 'stark'), $theme_list) !== FALSE) { unset($theme_list[$pos]); if (empty($theme_list)) { return; diff --git a/core/includes/theme.maintenance.inc b/core/includes/theme.maintenance.inc index d663d144b183..dce880194e18 100644 --- a/core/includes/theme.maintenance.inc +++ b/core/includes/theme.maintenance.inc @@ -44,6 +44,12 @@ function _drupal_maintenance_theme() { // We use the default theme as the maintenance theme. If a default theme // isn't specified in the database or in settings.php, we use Bartik. + // @todo Should use the actual default theme configured, but that depends on + // configuration being available while possibly not having a working + // database connection (yet). And only if that fails, should fall back to + // Stark otherwise. Since there is no low-level access to configuration + // currently, we only consult settings.php and fall back to Bartik + // otherwise, as it looks generic enough and way more user-friendly. $custom_theme = variable_get('maintenance_theme', variable_get('theme_default', 'bartik')); } diff --git a/core/modules/block/block.admin.inc b/core/modules/block/block.admin.inc index 0e543435b123..2b3c2dd3cc50 100644 --- a/core/modules/block/block.admin.inc +++ b/core/modules/block/block.admin.inc @@ -305,7 +305,7 @@ function block_admin_configure($form, &$form_state, $module, $delta) { '#tree' => TRUE, ); - $theme_default = variable_get('theme_default', 'bartik'); + $theme_default = variable_get('theme_default', 'stark'); $admin_theme = variable_get('admin_theme'); foreach (list_themes() as $key => $theme) { // Only display enabled themes diff --git a/core/modules/block/block.module b/core/modules/block/block.module index 55b0b40ab933..4d942edc616e 100644 --- a/core/modules/block/block.module +++ b/core/modules/block/block.module @@ -63,7 +63,7 @@ function block_help($path, $arg) { return '<p>' . t('Use this page to create a new custom block.') . '</p>'; } if ($arg[0] == 'admin' && $arg[1] == 'structure' && $arg['2'] == 'block' && (empty($arg[3]) || $arg[3] == 'list')) { - $demo_theme = !empty($arg[4]) ? $arg[4] : variable_get('theme_default', 'bartik'); + $demo_theme = !empty($arg[4]) ? $arg[4] : variable_get('theme_default', 'stark'); $themes = list_themes(); $output = '<p>' . t('This page provides a drag-and-drop interface for assigning a block to a region, and for controlling the order of blocks within regions. Since not all themes implement the same regions, or display regions in the same way, blocks are positioned on a per-theme basis. Remember that your changes will not be saved until you click the <em>Save blocks</em> button at the bottom of the page. Click the <em>configure</em> link next to each block to configure its specific title and visibility settings.') . '</p>'; $output .= '<p>' . l(t('Demonstrate block regions (@theme)', array('@theme' => $themes[$demo_theme]->info['name'])), 'admin/structure/block/demo/' . $demo_theme) . '</p>'; @@ -103,7 +103,7 @@ function block_permission() { * Implements hook_menu(). */ function block_menu() { - $default_theme = variable_get('theme_default', 'bartik'); + $default_theme = variable_get('theme_default', 'stark'); $items['admin/structure/block'] = array( 'title' => 'Blocks', 'description' => 'Configure what block content appears in your site\'s sidebars and other regions.', @@ -308,7 +308,7 @@ function block_page_build(&$page) { $page['page_top']['backlink'] = array( '#type' => 'link', '#title' => t('Exit block region demonstration'), - '#href' => 'admin/structure/block' . (variable_get('theme_default', 'bartik') == $theme ? '' : '/list/' . $theme), + '#href' => 'admin/structure/block' . (variable_get('theme_default', 'stark') == $theme ? '' : '/list/' . $theme), // Add the "overlay-restore" class to indicate this link should restore // the context in which the region demonstration page was opened. '#options' => array('attributes' => array('class' => array('block-demo-backlink', 'overlay-restore'))), @@ -664,7 +664,7 @@ function block_theme_initialize($theme) { // Initialize theme's blocks if none already registered. $has_blocks = (bool) db_query_range('SELECT 1 FROM {block} WHERE theme = :theme', 0, 1, array(':theme' => $theme))->fetchField(); if (!$has_blocks) { - $default_theme = variable_get('theme_default', 'bartik'); + $default_theme = variable_get('theme_default', 'stark'); // Apply only to new theme's visible regions. $regions = system_region_list($theme, REGIONS_VISIBLE); $result = db_query("SELECT * FROM {block} WHERE theme = :theme", array(':theme' => $default_theme), array('fetch' => PDO::FETCH_ASSOC)); diff --git a/core/modules/block/block.test b/core/modules/block/block.test index 6e30dd0efb89..dbd7dc489e84 100644 --- a/core/modules/block/block.test +++ b/core/modules/block/block.test @@ -425,7 +425,7 @@ class NewDefaultThemeBlocks extends DrupalWebTestCase { // Ensure no other theme's blocks are in the block table yet. $themes = array(); - $themes['default'] = variable_get('theme_default', 'bartik'); + $themes['default'] = variable_get('theme_default', 'stark'); if ($admin_theme = variable_get('admin_theme')) { $themes['admin'] = $admin_theme; } diff --git a/core/modules/dashboard/dashboard.module b/core/modules/dashboard/dashboard.module index 1216cc00c117..115bc8fafa6f 100644 --- a/core/modules/dashboard/dashboard.module +++ b/core/modules/dashboard/dashboard.module @@ -96,7 +96,7 @@ function dashboard_permission() { */ function dashboard_block_info_alter(&$blocks, $theme, $code_blocks) { $admin_theme = variable_get('admin_theme'); - if (($admin_theme && $theme == $admin_theme) || (!$admin_theme && $theme == variable_get('theme_default', 'bartik'))) { + if (($admin_theme && $theme == $admin_theme) || (!$admin_theme && $theme == variable_get('theme_default', 'stark'))) { foreach ($blocks as $module => &$module_blocks) { foreach ($module_blocks as $delta => &$block) { // Make administrative blocks that are not already in use elsewhere diff --git a/core/modules/node/node.test b/core/modules/node/node.test index 0d13c4e86362..a04b0e663002 100644 --- a/core/modules/node/node.test +++ b/core/modules/node/node.test @@ -1881,7 +1881,7 @@ class NodeBlockFunctionalTest extends DrupalWebTestCase { $custom_block['title'] = $this->randomName(); $custom_block['types[article]'] = TRUE; $custom_block['body[value]'] = $this->randomName(32); - $custom_block['regions[' . variable_get('theme_default', 'bartik') . ']'] = 'content'; + $custom_block['regions[' . variable_get('theme_default', 'stark') . ']'] = 'content'; if ($admin_theme = variable_get('admin_theme')) { $custom_block['regions[' . $admin_theme . ']'] = 'content'; } diff --git a/core/modules/statistics/statistics.test b/core/modules/statistics/statistics.test index f12490acf91d..592f1653c945 100644 --- a/core/modules/statistics/statistics.test +++ b/core/modules/statistics/statistics.test @@ -210,7 +210,7 @@ class StatisticsReportsTestCase extends StatisticsTestCase { // Configure and save the block. $block = block_load('statistics', 'popular'); - $block->theme = variable_get('theme_default', 'bartik'); + $block->theme = variable_get('theme_default', 'stark'); $block->status = 1; $block->pages = ''; $block->region = 'sidebar_first'; diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index 97a4673dd69e..6dca80b88b72 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -130,7 +130,7 @@ function system_themes_page() { $themes = system_rebuild_theme_data(); uasort($themes, 'system_sort_modules_by_info_name'); - $theme_default = variable_get('theme_default', 'bartik'); + $theme_default = variable_get('theme_default', 'stark'); $theme_groups = array(); foreach ($themes as &$theme) { @@ -315,7 +315,7 @@ function system_theme_disable() { // Check if the specified theme is one recognized by the system. if (!empty($themes[$theme])) { - if ($theme == variable_get('theme_default', 'bartik')) { + if ($theme == variable_get('theme_default', 'stark')) { // Don't disable the default theme. drupal_set_message(t('%theme is the default theme and cannot be disabled.', array('%theme' => $themes[$theme]->info['name'])), 'error'); } diff --git a/core/modules/system/system.install b/core/modules/system/system.install index 671147195ccb..f33d0eaff9a4 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -499,11 +499,11 @@ function system_install() { system_rebuild_theme_data(); // Enable the default theme. - variable_set('theme_default', 'bartik'); + variable_set('theme_default', 'stark'); db_update('system') ->fields(array('status' => 1)) ->condition('type', 'theme') - ->condition('name', 'bartik') + ->condition('name', 'stark') ->execute(); // Populate the cron key variable. @@ -1641,6 +1641,25 @@ function system_update_8001() { } } +/** + * Set Bartik as default theme if it implicitly was the default before. + * + * The default theme for Drupal core was changed from Bartik to Stark. + * Installation profiles (including Standard and Minimal) were changed to + * explicitly configure Bartik as default theme. Since Bartik was the default + * theme by default and may not have been explicitly configured as such + * previously, this update ensures that the implicit Bartik default is still the + * default. + * + * @see http://drupal.org/node/1181776 + */ +function system_update_8002() { + $theme = variable_get('theme_default'); + if (!isset($theme)) { + variable_set('theme_default', 'bartik'); + } +} + /** * @} End of "defgroup updates-7.x-to-8.x" * The next series of updates should start at 9000. diff --git a/profiles/minimal/minimal.install b/profiles/minimal/minimal.install index 059f038c2e7a..6c56aecd2e85 100644 --- a/profiles/minimal/minimal.install +++ b/profiles/minimal/minimal.install @@ -6,8 +6,14 @@ * Perform actions to set up the site for this profile. */ function minimal_install() { + // Enable Bartik theme and set it as default theme instead of Stark. + // @see system_install() + $default_theme = 'bartik'; + variable_set('theme_default', $default_theme); + theme_enable(array($default_theme)); + theme_disable(array('stark')); + // Enable some standard blocks. - $default_theme = variable_get('theme_default', 'bartik'); $values = array( array( 'module' => 'system', diff --git a/profiles/standard/standard.install b/profiles/standard/standard.install index 5d447177fb26..9195ad949e1d 100644 --- a/profiles/standard/standard.install +++ b/profiles/standard/standard.install @@ -62,8 +62,14 @@ function standard_install() { $full_html_format = (object) $full_html_format; filter_format_save($full_html_format); + // Enable Bartik theme and set it as default theme instead of Stark. + // @see system_install() + $default_theme = 'bartik'; + variable_set('theme_default', $default_theme); + theme_enable(array($default_theme)); + theme_disable(array('stark')); + // Enable some standard blocks. - $default_theme = variable_get('theme_default', 'bartik'); $admin_theme = 'seven'; $values = array( array( -- GitLab