diff options
Diffstat (limited to 'modules/system/system.install')
-rw-r--r-- | modules/system/system.install | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/modules/system/system.install b/modules/system/system.install index ff05becf9..67b4d2391 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -3330,31 +3330,46 @@ function system_update_7021() { $ret[] = update_sql("INSERT INTO {block} (module, delta, theme, status, weight, region, pages, cache) VALUES ('system', 'help', '" . $theme->name . "', 1, 0, 'help', '', 1)"); } - // Migrate contact form information and user register help to blocks. - $bid_max = db_query("SELECT MAX(bid) FROM {box}")->fetchField(); + // Migrate contact form information. if ($contact_help = variable_get('contact_form_information', '')) { - db_insert('box')->fields(array('body' => $contact_help, 'info' => 'Contact page help', 'format' => FILTER_FORMAT_DEFAULT))->execute(); + $bid = db_insert('box')->fields(array('body' => $contact_help, 'info' => 'Contact page help', 'format' => FILTER_FORMAT_DEFAULT))->execute(); foreach ($themes_with_blocks as $theme) { // Add contact help block for themes, which had blocks. - $ret[] = update_sql("INSERT INTO {block} (module, delta, theme, status, weight, region, visibility, pages, cache) VALUES ('block', '" . ($bid_max + 1) . "', '" . $theme . "', 1, 5, 'help', 1, 'contact', -1)"); + $ret[] = update_sql("INSERT INTO {block} (module, delta, theme, status, weight, region, visibility, pages, cache) VALUES ('block', '" . $bid . "', '" . $theme . "', 1, 5, 'help', 1, 'contact', -1)"); } - drupal_set_message('The contact form information setting was migrated to <a href="' . url('admin/build/block/configure/block/' . ($bid_max + 1)) . '">a custom block</a> and set up to only show on the site-wide contact page. The block was set to use the default text format, which might differ from the HTML based format used before. Please check the block and ensure that the output is right.'); + drupal_set_message('The contact form information setting was migrated to <a href="' . url('admin/build/block/configure/block/' . $bid) . '">a custom block</a> and set up to only show on the site-wide contact page. The block was set to use the default text format, which might differ from the HTML based format used before. Please check the block and ensure that the output is right.'); } + + // Migrate user help setting. if ($user_help = variable_get('user_registration_help', '')) { - db_insert('box')->fields(array('body' => $user_help, 'info' => 'User registration guidelines', 'format' => FILTER_FORMAT_DEFAULT))->execute(); + $bid = db_insert('box')->fields(array('body' => $user_help, 'info' => 'User registration guidelines', 'format' => FILTER_FORMAT_DEFAULT))->execute(); foreach ($themes_with_blocks as $theme) { // Add user registration help block for themes, which had blocks. - $ret[] = update_sql("INSERT INTO {block} (module, delta, theme, status, weight, region, visibility, pages, cache) VALUES ('block', '" . ($bid_max + 2) . "', '" . $theme . "', 1, 5, 'help', 1, 'user/register', -1)"); + $ret[] = update_sql("INSERT INTO {block} (module, delta, theme, status, weight, region, visibility, pages, cache) VALUES ('block', '" . $bid . "', '" . $theme . "', 1, 5, 'help', 1, 'user/register', -1)"); } - drupal_set_message('The user registration guidelines were migrated to <a href="' . url('admin/build/block/configure/block/' . ($bid_max + 2)) . '">a custom block</a> and set up to only show on the user registration page. The block was set to use the default text format, which might differ from the HTML based format used before. Please check the block and ensure that the output is right.'); + drupal_set_message('The user registration guidelines were migrated to <a href="' . url('admin/build/block/configure/block/' . $bid) . '">a custom block</a> and set up to only show on the user registration page. The block was set to use the default text format, which might differ from the HTML based format used before. Please check the block and ensure that the output is right.'); } - // Remove the two variables (even if they were saved empty on the admin interface), + + // Migrate site mission setting. + if ($mission = variable_get('site_mission')) { + $bid = db_insert('box')->fields(array('body' => $mission, 'info' => 'Site mission', 'format' => FILTER_FORMAT_DEFAULT))->execute(); + foreach ($themes_with_blocks as $theme) { + // Add mission block for themes, which had blocks. + $ret[] = update_sql("INSERT INTO {block} (module, delta, theme, status, weight, region, visibility, pages, cache) VALUES ('block', '" . $bid . "', '" . $theme . "', 1, 0, 'highlight', 1, '<front>', -1)"); + } + drupal_set_message('The site mission was migrated to <a href="' . url('admin/build/block/configure/block/' . $bid) . '">a custom block</a> and set up to only show on the front page in the highlighted content region. The block was set to use the default text format, which might differ from the HTML based format used before. Please check the block and ensure that the output is right. If your theme does not have a highlighted content region, you might need to <a href="' . url('admin/build/block') . '">relocate the block</a>.'); + // Migrate mission to RSS site description. + variable_set('feed_description', $mission); + } + + // Remove the variables (even if they were saved empty on the admin interface), // to avoid keeping clutter in the variables table. variable_del('contact_form_information'); variable_del('user_registration_help'); + variable_del('site_mission'); // Rebuild theme data, so the new 'help' region is identified. - _system_theme_data(); + system_theme_data(); return $ret; } |