diff --git a/modules/simpletest/tests/upgrade/upgrade.test b/modules/simpletest/tests/upgrade/upgrade.test index 3d463c95f71f9c63d6e875f27057f0f3e4658564..4220faebbf75651a9711e0fd3b391c9f09609dd0 100644 --- a/modules/simpletest/tests/upgrade/upgrade.test +++ b/modules/simpletest/tests/upgrade/upgrade.test @@ -381,5 +381,9 @@ class BasicUpgradePath extends UpgradePathTestCase { $this->assertText(t('Reports')); $this->assertText(t('Structure')); $this->assertText(t('Modules')); + + // Confirm that no {menu_links} entry exists for user/autocomplete. + $result = db_query('SELECT COUNT(*) FROM {menu_links} WHERE link_path = :user_autocomplete', array(':user_autocomplete' => 'user/autocomplete'))->fetchField(); + $this->assertFalse($result, t('No {menu_links} entry exists for user/autocomplete')); } } diff --git a/modules/system/system.install b/modules/system/system.install index eae01725fe35782cdf8d9989ef69afc2acf74030..9c9bc2d8c2063c2b0b4d0d5efd9d63c44e2a5fd6 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -2862,6 +2862,19 @@ function system_update_7062() { db_add_index('system', 'system_list', array('status', 'bootstrap', 'type', 'weight', 'name')); } +/** + * Delete {menu_links} records for 'type' => MENU_CALLBACK which would not appear in a fresh install. + */ +function system_update_7063() { + // For router items where 'type' => MENU_CALLBACK, {menu_router}.type is + // stored as 4 in Drupal 6, and 0 in Drupal 7. Fortunately Drupal 7 doesn't + // store any types as 4, so delete both. + $result = db_query('SELECT ml.mlid FROM {menu_links} ml INNER JOIN {menu_router} mr ON ml.router_path = mr.path WHERE ml.module = :system AND ml.customized = 0 AND mr.type IN(:callbacks)', array(':callbacks' => array(0, 4), ':system' => 'system')); + foreach ($result as $record) { + db_delete('menu_links')->condition('mlid', $record->mlid)->execute(); + } +} + /** * @} End of "defgroup updates-6.x-to-7.x" * The next series of updates should start at 8000.