Index: modules/system/system.install =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.install,v retrieving revision 1.312 diff -u -9 -p -r1.312 system.install --- modules/system/system.install 17 Mar 2009 15:26:29 -0000 1.312 +++ modules/system/system.install 31 Mar 2009 21:37:45 -0000 @@ -3231,12 +3238,42 @@ function system_update_7019() { function system_update_7020() { $ret = array(); $module_list = array('field_sql_storage', 'field'); drupal_install_modules($module_list); module_enable($module_list); return $ret; } /** + * Upgrade standard blocks and menus. + */ +function system_update_7021() { + $ret = array(); + // Navigation block is now defined in system module. + $ret[] = update_sql("UPDATE {block} SET module = 'system' WHERE module = 'user' AND delta = 'navigation'"); + + // Add management block to all themes with initialized blocks. + $result = db_query('SELECT theme FROM {block} GROUP BY theme'); + while ($block = db_fetch_object($result)) { + $region = 'left'; + $regions = system_region_list($block->theme); + // If the left region isn't supported by the theme, assign the block to the theme's default region. + if (!array_key_exists($region, $regions)) { + $region = system_default_region($block->theme); + } + $insert_result = db_query("INSERT INTO {block} (module, delta, theme, status, weight, region, pages, cache) VALUES ('system', 'management', '%s', 1, 1, '%s', '', -1)", $block->theme, $region); + $ret[] = array('success' => $insert_result !== FALSE, 'query' => check_plain('Added management block for ' . $block->theme . ' theme to ' . $region . ' region')); + } + + $insert_result = db_query("INSERT INTO {menu_custom} (menu_name, title, description) VALUES ('%s', '%s', '%s')", 'management', t('Management'), t('The Management menu contains links for content creation, site building, user management, and similar site activities.')); + $ret[] = array('success' => $insert_result !== FALSE, 'query' => 'Created management menu'); + + $insert_result = db_query("INSERT INTO {menu_custom} (menu_name, title, description) VALUES ('%s', '%s', '%s')", 'user-menu', t('User menu'), t('The User menu contains links related to the user\'s account, as well as the "Log out" link.')); + $ret[] = array('success' => $insert_result !== FALSE, 'query' => 'Created user menu'); + + return $ret; +} + +/** * @} End of "defgroup updates-6.x-to-7.x" * The next series of updates should start at 8000. */