summaryrefslogtreecommitdiff
path: root/modules/menu
diff options
context:
space:
mode:
authorwebchick <webchick@24967.no-reply.drupal.org>2011-06-01 01:07:12 -0700
committerwebchick <webchick@24967.no-reply.drupal.org>2011-06-01 01:07:12 -0700
commit96c1e28fdc50baf2dbd922d081938154e37fd5c6 (patch)
tree77c4d6c2a4ae4c92a5e201f93db1db3772ed3ab4 /modules/menu
parenta8dc7a1d5014aa4ec048bce3b2f53f56439007d5 (diff)
downloadbrdo-96c1e28fdc50baf2dbd922d081938154e37fd5c6.tar.gz
brdo-96c1e28fdc50baf2dbd922d081938154e37fd5c6.tar.bz2
Issue #761648 follow-up by lyricnz: Fixed Menu D6->D7 upgrade doesn't maintain node-menu configuration.
Diffstat (limited to 'modules/menu')
-rw-r--r--modules/menu/menu.install43
1 files changed, 43 insertions, 0 deletions
diff --git a/modules/menu/menu.install b/modules/menu/menu.install
index 05aed283f..717c5e712 100644
--- a/modules/menu/menu.install
+++ b/modules/menu/menu.install
@@ -69,3 +69,46 @@ function menu_uninstall() {
menu_rebuild();
}
+/**
+ * @defgroup updates-7.x-extra Extra updates for 7.x
+ * @{
+ */
+
+/**
+ * Migrate the "Default menu for content" setting to individual node types.
+ */
+function menu_update_7000() {
+ // Act only on sites originally on Drupal 6 that have a custom "Default menu
+ // for content" setting.
+ $default_node_menu = variable_get('menu_default_node_menu');
+ if (isset($default_node_menu)) {
+ // Remove variable no longer used in Drupal 7.
+ variable_del('menu_default_node_menu');
+
+ // Make sure the menu chosen as the default still exists.
+ $defined_menus = db_query('SELECT * FROM {menu_custom}')->fetchAllAssoc('menu_name', PDO::FETCH_ASSOC);
+ // If the menu does not exist, do nothing; nodes will use the default D7
+ // node menu settings.
+ if (!isset($defined_menus[$default_node_menu])) {
+ return;
+ }
+
+ // Update the menu settings for each node type.
+ foreach (_update_7000_node_get_types() as $type => $type_object) {
+ $type_menus = variable_get('menu_options_' . $type);
+ // If the site already has a custom menu setting for this node type (set
+ // on the initial upgrade to Drupal 7.0), don't override it.
+ if (!isset($type_menus)) {
+ // Set up this node type so that the Drupal 6 "Default menu for content"
+ // is still available in the "Menu settings" section.
+ variable_set('menu_options_' . $type, array($default_node_menu));
+ variable_set('menu_parent_' . $type, $default_node_menu . ':0');
+ }
+ }
+ }
+}
+
+/**
+ * @} End of "defgroup updates-7.x-extra"
+ * The next series of updates should start at 8000.
+ */