summaryrefslogtreecommitdiff
path: root/update.php
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2007-06-08 05:50:58 +0000
committerDries Buytaert <dries@buytaert.net>2007-06-08 05:50:58 +0000
commit29eb5a62847349897716c316c8e409e5209f8535 (patch)
tree0c779c444cab8703885cb8ea41b6cae19123f577 /update.php
parent546719769bcd61d7df7cb640effda3fcbf1131d7 (diff)
downloadbrdo-29eb5a62847349897716c316c8e409e5209f8535.tar.gz
brdo-29eb5a62847349897716c316c8e409e5209f8535.tar.bz2
- Patch #146910 by dww: only allow enabling modules with the same Drupal core compatibility version.
Diffstat (limited to 'update.php')
-rw-r--r--update.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/update.php b/update.php
index 2dcda2914..21c33ff82 100644
--- a/update.php
+++ b/update.php
@@ -702,6 +702,37 @@ function update_create_batch_table() {
}
/**
+ * 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.
*/
function update_task_list($active = NULL) {
@@ -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) {