summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/update.inc12
-rw-r--r--modules/menu/menu.install19
-rw-r--r--modules/simpletest/tests/upgrade/drupal-6.menu.database.php46
-rw-r--r--modules/simpletest/tests/upgrade/upgrade.menu.test5
4 files changed, 82 insertions, 0 deletions
diff --git a/includes/update.inc b/includes/update.inc
index 1eb7a1d9c..1fbd8074a 100644
--- a/includes/update.inc
+++ b/includes/update.inc
@@ -355,6 +355,12 @@ function update_fix_d7_block_deltas(&$sandbox, $renamed_deltas, $moved_deltas) {
))
->fetchField();
if ($block_exists) {
+ // Delete any existing blocks with the new module+delta.
+ db_delete($table)
+ ->condition('module', $module)
+ ->condition('delta', $new_delta)
+ ->execute();
+ // Rename the old block to the new module+delta.
db_update($table)
->fields(array('delta' => $new_delta))
->condition('module', $module)
@@ -372,6 +378,12 @@ function update_fix_d7_block_deltas(&$sandbox, $renamed_deltas, $moved_deltas) {
))
->fetchField();
if ($block_exists) {
+ // Delete any existing blocks with the new module+delta.
+ db_delete($table)
+ ->condition('module', $new_module)
+ ->condition('delta', $delta)
+ ->execute();
+ // Rename the old block to the new module+delta.
db_update($table)
->fields(array('module' => $new_module))
->condition('module', $old_module)
diff --git a/modules/menu/menu.install b/modules/menu/menu.install
index 13cb3cb50..3b75ad436 100644
--- a/modules/menu/menu.install
+++ b/modules/menu/menu.install
@@ -120,6 +120,8 @@ function menu_update_7001() {
}
// Rename each menu, and any settings that refer to the old menu name.
+ // - "Primary Links" has become system menu "Main menu".
+ // - "Secondary Links" has become a new custom menu "Secondary menu".
$rename = array(
'primary-links' => array('main-menu', 'Main menu'),
'secondary-links' => array('secondary-menu', 'Secondary menu'),
@@ -161,6 +163,23 @@ function menu_update_7001() {
}
/**
+ * Rename the primary/secondary menu blocks to match previously renamed menus.
+ */
+function menu_update_7002(&$sandbox) {
+ $renamed_deltas = array(
+ 'menu' => array(
+ 'primary-links' => 'main-menu',
+ 'secondary-links' => 'secondary-menu',
+ ),
+ );
+
+ $moved_deltas = array(
+ 'menu' => array('main-menu' => 'system'),
+ );
+
+ update_fix_d7_block_deltas($sandbox, $renamed_deltas, $moved_deltas);
+}
+/**
* @} End of "defgroup updates-7.x-extra"
* The next series of updates should start at 8000.
*/
diff --git a/modules/simpletest/tests/upgrade/drupal-6.menu.database.php b/modules/simpletest/tests/upgrade/drupal-6.menu.database.php
index f5c588af7..8962615fb 100644
--- a/modules/simpletest/tests/upgrade/drupal-6.menu.database.php
+++ b/modules/simpletest/tests/upgrade/drupal-6.menu.database.php
@@ -127,3 +127,49 @@ db_insert('menu_links')->fields(array(
'updated' => '0',
))
->execute();
+db_insert('blocks')->fields(array(
+ 'bid',
+ 'module',
+ 'delta',
+ 'theme',
+ 'status',
+ 'weight',
+ 'region',
+ 'custom',
+ 'throttle',
+ 'visibility',
+ 'pages',
+ 'title',
+ 'cache',
+))
+->values(array(
+ 'bid' => '4',
+ 'module' => 'menu',
+ 'delta' => 'primary-links',
+ 'theme' => 'garland',
+ 'status' => '1',
+ 'weight' => '0',
+ 'region' => 'left',
+ 'custom' => '0',
+ 'throttle' => '0',
+ 'visibility' => '0',
+ 'pages' => '',
+ 'title' => 'My Primary Links',
+ 'cache' => '-1',
+))
+->values(array(
+ 'bid' => '5',
+ 'module' => 'menu',
+ 'delta' => 'secondary-links',
+ 'theme' => 'garland',
+ 'status' => '1',
+ 'weight' => '0',
+ 'region' => 'left',
+ 'custom' => '0',
+ 'throttle' => '0',
+ 'visibility' => '0',
+ 'pages' => '',
+ 'title' => 'My Secondary Links',
+ 'cache' => '-1',
+))
+->execute();
diff --git a/modules/simpletest/tests/upgrade/upgrade.menu.test b/modules/simpletest/tests/upgrade/upgrade.menu.test
index 5a17a1947..bf28a5ffb 100644
--- a/modules/simpletest/tests/upgrade/upgrade.menu.test
+++ b/modules/simpletest/tests/upgrade/upgrade.menu.test
@@ -74,5 +74,10 @@ class MenuUpgradePathTestCase extends UpgradePathTestCase {
$this->drupalGet('admin/structure/menu/settings');
$this->assertOptionSelected('edit-menu-main-links-source', 'secondary-menu');
$this->assertOptionSelected('edit-menu-secondary-links-source', 'main-menu');
+
+ // Check that both primary/secondary links blocks are visible.
+ $this->drupalGet('node');
+ $this->assertText('My Primary Links', '(Formerly) Primary Links block is still visible');
+ $this->assertText('My Secondary Links', '(Formerly) Secondary Links block is still visible');
}
}