From 29eb5a62847349897716c316c8e409e5209f8535 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Fri, 8 Jun 2007 05:50:58 +0000 Subject: [PATCH] - Patch #146910 by dww: only allow enabling modules with the same Drupal core compatibility version. --- CHANGELOG.txt | 3 ++- modules/aggregator/aggregator.info | 1 + modules/block/block.info | 1 + modules/blog/blog.info | 1 + modules/blogapi/blogapi.info | 1 + modules/book/book.info | 1 + modules/color/color.info | 1 + modules/comment/comment.info | 1 + modules/contact/contact.info | 1 + modules/dblog/dblog.info | 1 + modules/drupal/drupal.info | 1 + modules/filter/filter.info | 1 + modules/forum/forum.info | 1 + modules/help/help.info | 1 + modules/locale/locale.info | 1 + modules/menu/menu.info | 1 + modules/node/node.info | 1 + modules/path/path.info | 1 + modules/php/php.info | 1 + modules/ping/ping.info | 1 + modules/poll/poll.info | 1 + modules/profile/profile.info | 1 + modules/search/search.info | 1 + modules/statistics/statistics.info | 1 + modules/syslog/syslog.info | 1 + modules/system/system.css | 7 ++++++ modules/system/system.info | 1 + modules/system/system.module | 24 +++++++++++++++++--- modules/taxonomy/taxonomy.info | 1 + modules/throttle/throttle.info | 1 + modules/tracker/tracker.info | 1 + modules/upload/upload.info | 1 + modules/user/user.info | 1 + themes/bluemarine/bluemarine.info | 1 + themes/chameleon/chameleon.info | 1 + themes/chameleon/marvin/marvin.info | 1 + themes/garland/garland.info | 1 + themes/garland/minnelli/minnelli.info | 1 + themes/pushbutton/pushbutton.info | 1 + update.php | 32 +++++++++++++++++++++++++++ 40 files changed, 98 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 708bbf28ea..565ad9e155 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -8,7 +8,7 @@ Drupal 6.0, xxxx-xx-xx (development version) * The watchdog module is now called dblog, and is optional, but enabled by default in the default install profile. * Extended the database log module so log messages can be filtered. * Added syslog module: useful for monitoring large Drupal installations. -- Added optional e-mail notifications when user are approved, blocked, or deleted. +- Added optional e-mail notifications when users are approved, blocked, or deleted. - Added versioning support to node terms. - Made it easier to theme the forum overview page. - Made Drupal work correctly when running behind a reverse proxy like Squid or Pound. @@ -32,6 +32,7 @@ Drupal 6.0, xxxx-xx-xx (development version) * Removed default/settings.php. Instead the installer will create it from default.settings.php. * Made it possible to configure your own date formats. * Remember anonymous comment posters. + * Only allow modules and themes to be enabled that have explicitly been ported to the right core API version. - Theme system: * Added .info files to themes and made it easier to specify regions and features. * Added theme registry: modules can directly provide .tpl.php files for their themes without having to create theme_ functions. diff --git a/modules/aggregator/aggregator.info b/modules/aggregator/aggregator.info index 84c7c0afde..5697ae3131 100644 --- a/modules/aggregator/aggregator.info +++ b/modules/aggregator/aggregator.info @@ -3,3 +3,4 @@ name = Aggregator description = "Aggregates syndicated content (RSS, RDF, and Atom feeds)." package = Core - optional version = VERSION +core = 6.x diff --git a/modules/block/block.info b/modules/block/block.info index 8c12ddec73..858e44f625 100644 --- a/modules/block/block.info +++ b/modules/block/block.info @@ -3,3 +3,4 @@ name = Block description = Controls the boxes that are displayed around the main content. package = Core - required version = VERSION +core = 6.x diff --git a/modules/blog/blog.info b/modules/blog/blog.info index 898386dd9c..3dc887322b 100644 --- a/modules/blog/blog.info +++ b/modules/blog/blog.info @@ -3,3 +3,4 @@ name = Blog description = Enables keeping easily and regularly updated user web pages or blogs. package = Core - optional version = VERSION +core = 6.x diff --git a/modules/blogapi/blogapi.info b/modules/blogapi/blogapi.info index ceab75326b..d1781117e3 100644 --- a/modules/blogapi/blogapi.info +++ b/modules/blogapi/blogapi.info @@ -3,3 +3,4 @@ name = Blog API description = Allows users to post content using applications that support XML-RPC blog APIs. package = Core - optional version = VERSION +core = 6.x diff --git a/modules/book/book.info b/modules/book/book.info index e9f69bdfbe..7dfa8ab4bf 100644 --- a/modules/book/book.info +++ b/modules/book/book.info @@ -3,3 +3,4 @@ name = Book description = Allows users to collaboratively author a book. package = Core - optional version = VERSION +core = 6.x diff --git a/modules/color/color.info b/modules/color/color.info index 9c66ccdc3e..82d04b2b4c 100644 --- a/modules/color/color.info +++ b/modules/color/color.info @@ -3,3 +3,4 @@ name = Color description = Allows the user to change the color scheme of certain themes. package = Core - optional version = VERSION +core = 6.x diff --git a/modules/comment/comment.info b/modules/comment/comment.info index 0fe9f1dd58..5d13a6f571 100644 --- a/modules/comment/comment.info +++ b/modules/comment/comment.info @@ -3,3 +3,4 @@ name = Comment description = Allows users to comment on and discuss published content. package = Core - optional version = VERSION +core = 6.x diff --git a/modules/contact/contact.info b/modules/contact/contact.info index 238275eafe..2a2e742c1f 100644 --- a/modules/contact/contact.info +++ b/modules/contact/contact.info @@ -3,3 +3,4 @@ name = Contact description = Enables the use of both personal and site-wide contact forms. package = Core - optional version = VERSION +core = 6.x diff --git a/modules/dblog/dblog.info b/modules/dblog/dblog.info index 124280577d..4072ad4f5d 100644 --- a/modules/dblog/dblog.info +++ b/modules/dblog/dblog.info @@ -3,3 +3,4 @@ name = Database logging description = Logs and records system events to the database. package = Core - optional version = VERSION +core = 6.x diff --git a/modules/drupal/drupal.info b/modules/drupal/drupal.info index ce23d5c275..61a8afad76 100644 --- a/modules/drupal/drupal.info +++ b/modules/drupal/drupal.info @@ -3,3 +3,4 @@ name = Drupal description = Lets you register your site with a central server and improve ranking of Drupal projects by posting information on your installed modules and themes; also enables users to log in using a Drupal ID. package = Core - optional version = VERSION +core = 6.x diff --git a/modules/filter/filter.info b/modules/filter/filter.info index 058a40b9ab..1f19f7616e 100644 --- a/modules/filter/filter.info +++ b/modules/filter/filter.info @@ -3,3 +3,4 @@ name = Filter description = Handles the filtering of content in preparation for display. package = Core - required version = VERSION +core = 6.x diff --git a/modules/forum/forum.info b/modules/forum/forum.info index eab2e580c4..00828a407d 100644 --- a/modules/forum/forum.info +++ b/modules/forum/forum.info @@ -5,3 +5,4 @@ dependencies[] = taxonomy dependencies[] = comment package = Core - optional version = VERSION +core = 6.x diff --git a/modules/help/help.info b/modules/help/help.info index da857ef968..ea6dc55071 100644 --- a/modules/help/help.info +++ b/modules/help/help.info @@ -3,3 +3,4 @@ name = Help description = Manages the display of online help. package = Core - optional version = VERSION +core = 6.x diff --git a/modules/locale/locale.info b/modules/locale/locale.info index 88d6ee7bc6..24478931d7 100644 --- a/modules/locale/locale.info +++ b/modules/locale/locale.info @@ -3,3 +3,4 @@ name = Locale description = Add language handling functionality and enables the translation of the user interface to languages other than English. package = Core - optional version = VERSION +core = 6.x diff --git a/modules/menu/menu.info b/modules/menu/menu.info index 724b484457..56f8d140a1 100644 --- a/modules/menu/menu.info +++ b/modules/menu/menu.info @@ -3,3 +3,4 @@ name = Menu description = Allows administrators to customize the site navigation menu. package = Core - optional version = VERSION +core = 6.x diff --git a/modules/node/node.info b/modules/node/node.info index 7bbc00b32b..95ddbe39b1 100644 --- a/modules/node/node.info +++ b/modules/node/node.info @@ -3,3 +3,4 @@ name = Node description = Allows content to be submitted to the site and displayed on pages. package = Core - required version = VERSION +core = 6.x diff --git a/modules/path/path.info b/modules/path/path.info index 71501d850d..8ba436f60a 100644 --- a/modules/path/path.info +++ b/modules/path/path.info @@ -3,3 +3,4 @@ name = Path description = Allows users to rename URLs. package = Core - optional version = VERSION +core = 6.x diff --git a/modules/php/php.info b/modules/php/php.info index 712f540a18..2327acc73c 100644 --- a/modules/php/php.info +++ b/modules/php/php.info @@ -3,3 +3,4 @@ name = PHP filter description = Allows embedded PHP code/snippets to be evaluated. package = Core - optional version = VERSION +core = 6.x diff --git a/modules/ping/ping.info b/modules/ping/ping.info index cf72abb0a9..c89de3baa3 100644 --- a/modules/ping/ping.info +++ b/modules/ping/ping.info @@ -3,3 +3,4 @@ name = Ping description = Alerts other sites when your site has been updated. package = Core - optional version = VERSION +core = 6.x diff --git a/modules/poll/poll.info b/modules/poll/poll.info index 45d9c16f00..1622d36e68 100644 --- a/modules/poll/poll.info +++ b/modules/poll/poll.info @@ -3,3 +3,4 @@ name = Poll description = Allows your site to capture votes on different topics in the form of multiple choice questions. package = Core - optional version = VERSION +core = 6.x diff --git a/modules/profile/profile.info b/modules/profile/profile.info index 042adc47b0..139670c637 100644 --- a/modules/profile/profile.info +++ b/modules/profile/profile.info @@ -3,3 +3,4 @@ name = Profile description = Supports configurable user profiles. package = Core - optional version = VERSION +core = 6.x diff --git a/modules/search/search.info b/modules/search/search.info index 4ebabd18df..1ea0f110d9 100644 --- a/modules/search/search.info +++ b/modules/search/search.info @@ -3,3 +3,4 @@ name = Search description = Enables site-wide keyword searching. package = Core - optional version = VERSION +core = 6.x diff --git a/modules/statistics/statistics.info b/modules/statistics/statistics.info index 43ca8f7104..8934614ba7 100644 --- a/modules/statistics/statistics.info +++ b/modules/statistics/statistics.info @@ -3,3 +3,4 @@ name = Statistics description = Logs access statistics for your site. package = Core - optional version = VERSION +core = 6.x diff --git a/modules/syslog/syslog.info b/modules/syslog/syslog.info index fc76cc8738..e08efb52a3 100644 --- a/modules/syslog/syslog.info +++ b/modules/syslog/syslog.info @@ -3,3 +3,4 @@ name = Syslog description = Logs and records system events to syslog. package = Core - optional version = VERSION +core = 6.x diff --git a/modules/system/system.css b/modules/system/system.css index ef20fb1fe0..67f92d89d9 100644 --- a/modules/system/system.css +++ b/modules/system/system.css @@ -445,3 +445,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; +} diff --git a/modules/system/system.info b/modules/system/system.info index a894f9bc3d..28c8a686b7 100644 --- a/modules/system/system.info +++ b/modules/system/system.info @@ -3,3 +3,4 @@ name = System description = Handles general site configuration for administrators. package = Core - required version = VERSION +core = 6.x diff --git a/modules/system/system.module b/modules/system/system.module index d2ad760187..bf1e7b93b7 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -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 @@ -1471,12 +1472,20 @@ function system_modules($form_state = array()) { // 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. + if (!isset($file->info['core']) || $file->info['core'] != 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; } @@ -1554,6 +1563,7 @@ function system_modules($form_state = array()) { 'system_modules_disable', ), '#disabled_modules' => $disabled, + '#incompatible_modules' => drupal_map_assoc($incompatible), ); // Handle throttle checkboxes, including overriding the @@ -1797,14 +1807,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 .= '
'. t('This version is incompatible with the !core_version version of Drupal core.', array('!core_version' => VERSION)) .'
'; + } + else { + $status = drupal_render($form['status'][$key]); + } + $row[] = array('data' => $status, 'align' => 'center'); if (module_exists('throttle')) { $row[] = array('data' => drupal_render($form['throttle'][$key]), 'align' => 'center'); } $row[] = ''. drupal_render($form['name'][$key]) .''; $row[] = drupal_render($form['version'][$key]); - $row[] = array('data' => drupal_render($form['description'][$key]), 'class' => 'description'); + $row[] = array('data' => $description, 'class' => 'description'); $rows[] = $row; } $fieldset = array( diff --git a/modules/taxonomy/taxonomy.info b/modules/taxonomy/taxonomy.info index aa9e52ea17..b1a2195484 100644 --- a/modules/taxonomy/taxonomy.info +++ b/modules/taxonomy/taxonomy.info @@ -3,3 +3,4 @@ name = Taxonomy description = Enables the categorization of content. package = Core - optional version = VERSION +core = 6.x diff --git a/modules/throttle/throttle.info b/modules/throttle/throttle.info index 6b65ce5770..7bdc100f0c 100644 --- a/modules/throttle/throttle.info +++ b/modules/throttle/throttle.info @@ -3,3 +3,4 @@ name = Throttle description = Handles the auto-throttling mechanism, to control site congestion. package = Core - optional version = VERSION +core = 6.x diff --git a/modules/tracker/tracker.info b/modules/tracker/tracker.info index 0dceed5b98..2375bc01a2 100644 --- a/modules/tracker/tracker.info +++ b/modules/tracker/tracker.info @@ -3,3 +3,4 @@ name = Tracker description = Enables tracking of recent posts for users. package = Core - optional version = VERSION +core = 6.x diff --git a/modules/upload/upload.info b/modules/upload/upload.info index a0d2c40684..dfb83d2242 100644 --- a/modules/upload/upload.info +++ b/modules/upload/upload.info @@ -3,3 +3,4 @@ name = Upload description = Allows users to upload and attach files to content. package = Core - optional version = VERSION +core = 6.x diff --git a/modules/user/user.info b/modules/user/user.info index be836c41ee..6059609ab3 100644 --- a/modules/user/user.info +++ b/modules/user/user.info @@ -3,3 +3,4 @@ name = User description = Manages the user registration and login system. package = Core - required version = VERSION +core = 6.x diff --git a/themes/bluemarine/bluemarine.info b/themes/bluemarine/bluemarine.info index 15646d9dfe..38c3385372 100644 --- a/themes/bluemarine/bluemarine.info +++ b/themes/bluemarine/bluemarine.info @@ -2,4 +2,5 @@ name = Bluemarine description = Table-based multi-column theme with a marine and ash color scheme. version = VERSION +core = 6.x engine = phptemplate diff --git a/themes/chameleon/chameleon.info b/themes/chameleon/chameleon.info index 59f4927339..2103648ddb 100644 --- a/themes/chameleon/chameleon.info +++ b/themes/chameleon/chameleon.info @@ -8,3 +8,4 @@ features[] = favicon features[] = name features[] = slogan version = VERSION +core = 6.x diff --git a/themes/chameleon/marvin/marvin.info b/themes/chameleon/marvin/marvin.info index c77d66055b..ac46c4e023 100644 --- a/themes/chameleon/marvin/marvin.info +++ b/themes/chameleon/marvin/marvin.info @@ -4,4 +4,5 @@ description = Boxy tabled theme in all grays. regions[left] = Left sidebar regions[right] = Right sidebar version = VERSION +core = 6.x base theme = chameleon diff --git a/themes/garland/garland.info b/themes/garland/garland.info index 740e034257..32c000d928 100644 --- a/themes/garland/garland.info +++ b/themes/garland/garland.info @@ -2,4 +2,5 @@ name = Garland description = Tableless, recolorable, multi-column, fluid width theme (default). version = VERSION +core = 6.x engine = phptemplate diff --git a/themes/garland/minnelli/minnelli.info b/themes/garland/minnelli/minnelli.info index 3fb7d16a60..1ee55c8464 100644 --- a/themes/garland/minnelli/minnelli.info +++ b/themes/garland/minnelli/minnelli.info @@ -2,4 +2,5 @@ name = Minnelli description = Tableless, recolorable, multi-column, fixed width theme. version = VERSION +core = 6.x base theme = garland diff --git a/themes/pushbutton/pushbutton.info b/themes/pushbutton/pushbutton.info index cbe4aca152..2f78fa4f13 100644 --- a/themes/pushbutton/pushbutton.info +++ b/themes/pushbutton/pushbutton.info @@ -2,4 +2,5 @@ name = Pushbutton description = Tabled, multi-column theme in blue and orange tones. version = VERSION +core = 6.x engine = phptemplate diff --git a/update.php b/update.php index 2dcda29145..21c33ff82b 100644 --- a/update.php +++ b/update.php @@ -701,6 +701,37 @@ function update_create_batch_table() { return $ret; } +/** + * Disable anything in the {system} table that is not compatible with the + * current version of Drupal core. + */ +function update_fix_compatibility() { + $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]; + } + if (!isset($file) + || !isset($file->info['core']) + || $file->info['core'] != DRUPAL_CORE_COMPATIBILITY) { + $incompatible[] = $name; + } + } + if (!empty($incompatible)) { + $ret[] = update_sql("UPDATE {system} SET status = 0 WHERE name IN ('". implode("','", $incompatible) ."')"); + } + return $ret; +} + /** * Add the update task list to the current page. */ @@ -747,6 +778,7 @@ function update_task_list($active = NULL) { update_fix_watchdog_115(); update_fix_watchdog(); update_fix_sessions(); + update_fix_compatibility(); $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : ''; switch ($op) { -- GitLab