summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-07-14 20:30:09 +0000
committerDries Buytaert <dries@buytaert.net>2010-07-14 20:30:09 +0000
commite65cb2df472fdce61724f621e4efc8b70ce23eac (patch)
tree1ad352af1db8c2e7d24d0b24bbd12e02dc9abf80 /includes
parent0bbdf9579dd17501fadb1a43df5432228999fb8a (diff)
downloadbrdo-e65cb2df472fdce61724f621e4efc8b70ce23eac.tar.gz
brdo-e65cb2df472fdce61724f621e4efc8b70ce23eac.tar.bz2
- Patch #410636 by Stevel, randallknutson, c960657, Berdir: upgrade does not create required menus.
Diffstat (limited to 'includes')
-rw-r--r--includes/update.inc52
1 files changed, 47 insertions, 5 deletions
diff --git a/includes/update.inc b/includes/update.inc
index 92844b21e..81e07ff8a 100644
--- a/includes/update.inc
+++ b/includes/update.inc
@@ -220,6 +220,7 @@ function update_prepare_d7_bootstrap() {
* An associative array. Keys are module names, values an associative array
* mapping the old block deltas to the new block deltas for the module.
* Example:
+ * @code
* $renamed_deltas = array(
* 'mymodule' =>
* array(
@@ -227,8 +228,21 @@ function update_prepare_d7_bootstrap() {
* 1 => 'mymodule-block-2',
* ),
* );
+ * @endcode
+ * @param $moved_deltas
+ * An associative array. Keys are source module names, values an associative
+ * array mapping the (possibly renamed) block name to the new module name.
+ * Example:
+ * @code
+ * $moved_deltas = array(
+ * 'user' =>
+ * array(
+ * 'navigation' => 'system',
+ * ),
+ * );
+ * @endcode
*/
-function update_fix_d7_block_deltas(&$sandbox, $renamed_deltas) {
+function update_fix_d7_block_deltas(&$sandbox, $renamed_deltas, $moved_deltas) {
// Loop through each block and make changes to the block tables.
// Only run this the first time through the batch update.
if (!isset($sandbox['progress'])) {
@@ -239,10 +253,10 @@ function update_fix_d7_block_deltas(&$sandbox, $renamed_deltas) {
foreach ($deltas as $old_delta => $new_delta) {
// Only do the update if the old block actually exists.
$block_exists = db_query("SELECT COUNT(*) FROM {" . $table . "} WHERE module = :module AND delta = :delta", array(
- ':module' => $module,
- ':delta' => $old_delta,
- ))
- ->fetchField();
+ ':module' => $module,
+ ':delta' => $old_delta,
+ ))
+ ->fetchField();
if ($block_exists) {
db_update($table)
->fields(array('delta' => $new_delta))
@@ -252,6 +266,23 @@ function update_fix_d7_block_deltas(&$sandbox, $renamed_deltas) {
}
}
}
+ foreach ($moved_deltas as $old_module => $deltas) {
+ foreach ($deltas as $delta => $new_module) {
+ // Only do the update if the old block actually exists.
+ $block_exists = db_query("SELECT COUNT(*) FROM {" . $table . "} WHERE module = :module AND delta = :delta", array(
+ ':module' => $old_module,
+ ':delta' => $delta,
+ ))
+ ->fetchField();
+ if ($block_exists) {
+ db_update($table)
+ ->fields(array('module' => $new_module))
+ ->condition('module', $old_module)
+ ->condition('delta', $delta)
+ ->execute();
+ }
+ }
+ }
}
// Initialize batch update information.
@@ -281,6 +312,17 @@ function update_fix_d7_block_deltas(&$sandbox, $renamed_deltas) {
}
}
}
+ foreach ($moved_deltas as $old_module => $deltas) {
+ foreach ($deltas as $delta => $new_module) {
+ if (isset($data['block'][$old_module][$delta])) {
+ // Transfer the old block visibility settings to the moved
+ // block, and mark this user for a database update.
+ $data['block'][$new_module][$delta] = $data['block'][$old_module][$delta];
+ unset($data['block'][$old_module][$delta]);
+ $user_needs_update = TRUE;
+ }
+ }
+ }
// Update the current user.
if ($user_needs_update) {
db_update('users')