Index: modules/block/block.install =================================================================== RCS file: /cvs/drupal/drupal/modules/block/block.install,v retrieving revision 1.39 diff -u -p -r1.39 block.install --- modules/block/block.install 4 Mar 2010 21:42:00 -0000 1.39 +++ modules/block/block.install 9 Mar 2010 15:12:37 -0000 @@ -217,6 +217,32 @@ function block_install() { } /** + * @defgroup updates-6.x-extra Extra block updates for 6.x + * @{ + */ + +/** + * Cleanup orphan block's data. + */ +function block_update_6000() { + // Cleanup for deleted custom blocks. + db_query("DELETE FROM {blocks_roles} WHERE module = 'block' AND delta NOT IN (SELECT b.bid FROM {boxes} b)")->execute(); + // Cleanup for uninstalled modules' blocks. + db_query("DELETE FROM {blocks} WHERE module IN (SELECT s.name FROM {system} s WHERE s.type = 'module' AND s.status = 0 AND s.schema_version = -1)")->execute(); + db_query("DELETE FROM {blocks_roles} WHERE module IN (SELECT s.name FROM {system} s WHERE s.type = 'module' AND s.status = 0 AND s.schema_version = -1)")->execute(); +} + +/** + * @} End of "defgroup updates-6.x-extra" + * The next series of updates should start at 7000. + */ + +/** + * @defgroup updates-6.x-to-7.x System updates from 6.x to 7.x + * @{ + */ + +/** * Set system.weight to a low value for block module. * * Block should go first so that other modules can alter its output @@ -451,3 +477,8 @@ function block_update_7004() { // Rebuild theme data, so the new 'help' region is identified. system_rebuild_theme_data(); } + +/** + * @} End of "defgroup updates-6.x-to-7.x" + * The next series of updates should start at 8000. + */