? modules/system/system.install.core-compat cvs diff: Diffing modules/system Index: modules/system/system.css =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.css,v retrieving revision 1.27 diff -u -p -r1.27 system.css --- modules/system/system.css 20 May 2007 16:38:19 -0000 1.27 +++ modules/system/system.css 26 May 2007 08:19:15 -0000 @@ -446,3 +446,10 @@ thead div.sticky-header { html.js .js-hide { display: none; } + +/* +** Styles for the system modules page (admin/build/modules) +*/ +#system-modules div.incompatible { + font-weight: bold; +} Index: modules/system/system.install =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.install,v retrieving revision 1.117 diff -u -p -r1.117 system.install --- modules/system/system.install 25 May 2007 12:46:45 -0000 1.117 +++ modules/system/system.install 26 May 2007 08:19:17 -0000 @@ -3284,6 +3284,37 @@ function system_update_6019() { return $ret; } +/** + * Automatically disable all modules that aren't compatible with 6.x core. + */ +function system_update_6020() { + $ret = array(); + $incompatible = array(); + $themes = system_theme_data(); + $modules = module_rebuild_cache(); + $query = db_query("SELECT name, type, status FROM {system} WHERE status = 1 AND type IN ('module','theme')"); + while ($result = db_fetch_object($query)) { + $name = $result->name; + $file = array(); + if ($result->type == 'module' && isset($modules[$name])) { + $file = $modules[$name]; + } + else if ($result->type == 'theme' && isset($themes[$name])) { + $file = $themes[$name]; + } + $matches = array(); + if (!isset($file) || !isset($file->info['version']) + || ($file->info['version'] != VERSION + && (!preg_match('/(\d+\.x).*/', $file->info['version'], $matches) + || $matches[1] != DRUPAL_CORE_COMPATIBILITY))) { + $incompatible[] = $name; + } + } + if (!empty($incompatible)) { + $ret[] = update_sql("UPDATE {system} SET status = 0 WHERE name IN ('". implode("','", $incompatible) ."')"); + } + return $ret; +} /** * @} End of "defgroup updates-5.x-to-6.x" Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.482 diff -u -p -r1.482 system.module --- modules/system/system.module 25 May 2007 15:04:42 -0000 1.482 +++ modules/system/system.module 26 May 2007 08:19:19 -0000 @@ -7,6 +7,7 @@ */ define('VERSION', '6.0-dev'); +define('DRUPAL_CORE_COMPATIBILITY', '6.x'); define('DRUPAL_MINIMUM_PHP', '4.3.3'); define('DRUPAL_MINIMUM_MYSQL', '4.1.0'); // If using MySQL @@ -1447,12 +1448,23 @@ function system_modules($form_state = ar // Array for disabling checkboxes in callback system_module_disable. $disabled = array(); $throttle = array(); + $incompatible = array(); // Traverse the files retrieved and build the form. foreach ($files as $filename => $file) { $form['name'][$filename] = array('#value' => $file->info['name']); $form['version'][$filename] = array('#value' => $file->info['version']); $form['description'][$filename] = array('#value' => t($file->info['description'])); $options[$filename] = ''; + // Ensure this module is compatible with this version of core. + $matches = array(); + if ($file->info['version'] != VERSION + && (!preg_match('/(\d+\.x).*/', $file->info['version'], $matches) + || $matches[1] != DRUPAL_CORE_COMPATIBILITY)) { + $incompatible[] = $file->name; + $disabled[] = $file->name; + // Nothing else in this loop matters, so move to the next module. + continue; + } if ($file->status) { $status[] = $file->name; } @@ -1530,6 +1542,7 @@ function system_modules($form_state = ar 'system_modules_disable', ), '#disabled_modules' => $disabled, + '#incompatible_modules' => drupal_map_assoc($incompatible), ); // Handle throttle checkboxes, including overriding the @@ -1774,14 +1787,22 @@ function theme_system_modules($form) { $rows = array(); foreach ($modules as $key => $module) { $row = array(); - $row[] = array('data' => drupal_render($form['status'][$key]), 'align' => 'center'); - + $description = drupal_render($form['description'][$key]); + if (isset($form['status']['#incompatible_modules'][$key])) { + unset($form['status'][$key]); + $status = theme('image', 'misc/watchdog-error.png', t('incompatible'), t('incompatible with this version of Drupal core')); + $description .= '