From 29eb5a62847349897716c316c8e409e5209f8535 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Fri, 8 Jun 2007 05:50:58 +0000 Subject: - Patch #146910 by dww: only allow enabling modules with the same Drupal core compatibility version. --- update.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'update.php') diff --git a/update.php b/update.php index 2dcda2914..21c33ff82 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 @@ if (($access_check == FALSE) || ($user->uid == 1)) { update_fix_watchdog_115(); update_fix_watchdog(); update_fix_sessions(); + update_fix_compatibility(); $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : ''; switch ($op) { -- cgit v1.2.3