summaryrefslogtreecommitdiff
path: root/modules/menu
diff options
context:
space:
mode:
authorwebchick <webchick@24967.no-reply.drupal.org>2011-07-04 22:01:00 -0700
committerwebchick <webchick@24967.no-reply.drupal.org>2011-07-04 22:01:00 -0700
commit09c56b4bfc713aa48eced396982cd5a5058c6c13 (patch)
treec250961138ee5e86d2efc1de33885f42f7f139af /modules/menu
parentd48016fcde435ad17699499e280597f43c912194 (diff)
downloadbrdo-09c56b4bfc713aa48eced396982cd5a5058c6c13.tar.gz
brdo-09c56b4bfc713aa48eced396982cd5a5058c6c13.tar.bz2
Issue #1007910 by lyricnz, idflood: Fixed D6->D7 update doesn't convert 'primary-links' menu to 'main-menu'.
Diffstat (limited to 'modules/menu')
-rw-r--r--modules/menu/menu.install52
1 files changed, 52 insertions, 0 deletions
diff --git a/modules/menu/menu.install b/modules/menu/menu.install
index 717c5e712..13cb3cb50 100644
--- a/modules/menu/menu.install
+++ b/modules/menu/menu.install
@@ -109,6 +109,58 @@ function menu_update_7000() {
}
/**
+ * Rename "Primary Links" and "Secondary Links" to their Drupal 7 equivalents.
+ */
+function menu_update_7001() {
+ // Migrate D6 menu_primary_links_source to D7 menu_main_links_source (without
+ // renaming).
+ if (variable_get('menu_primary_links_source') !== NULL) {
+ variable_set('menu_main_links_source', variable_get('menu_primary_links_source'));
+ variable_del('menu_primary_links_source');
+ }
+
+ // Rename each menu, and any settings that refer to the old menu name.
+ $rename = array(
+ 'primary-links' => array('main-menu', 'Main menu'),
+ 'secondary-links' => array('secondary-menu', 'Secondary menu'),
+ );
+ foreach ($rename as $from_menu => $to) {
+ list($to_menu, $to_title) = $to;
+ // Rename the menu, and links in the menu.
+ db_update('menu_custom')
+ ->fields(array('menu_name' => $to_menu, 'title' => $to_title))
+ ->condition('menu_name', $from_menu)
+ ->execute();
+ db_update('menu_links')
+ ->fields(array('menu_name' => $to_menu))
+ ->condition('menu_name', $from_menu)
+ ->execute();
+
+ // Update any content type that used this menu as a default menu.
+ // Note: these variables may be unset/default, in which case we leave them
+ // alone. See menu_update_7000()
+ foreach (_update_7000_node_get_types() as $type => $type_object) {
+ $menu_options = variable_get('menu_options_' . $type);
+ if ($menu_options !== NULL) {
+ variable_set('menu_options_' . $type, str_replace($from_menu, $to_menu, $menu_options));
+ if (variable_get('menu_parent_' . $type) == $from_menu . ':0') {
+ variable_set('menu_parent_' . $type, $to_menu . ':0');
+ }
+ }
+ }
+
+ // Update the "source for primary links" and "source for secondary links" to
+ // follow.
+ if (variable_get('menu_main_links_source') == $from_menu) {
+ variable_set('menu_main_links_source', $to_menu);
+ }
+ if (variable_get('menu_secondary_links_source') == $from_menu) {
+ variable_set('menu_secondary_links_source', $to_menu);
+ }
+ }
+}
+
+/**
* @} End of "defgroup updates-7.x-extra"
* The next series of updates should start at 8000.
*/