From adcbc9b957e2d8c49b236e4ca1c890ca312a3836 Mon Sep 17 00:00:00 2001 From: Dries Buytaert <dries@buytaert.net> Date: Fri, 9 Dec 2005 15:40:15 +0000 Subject: [PATCH] - Patch #40524 by drumm: made sure that visiting the admin/modules page does not break your setup if you haven't run udpate.php yet. --- modules/system.module | 9 +++++++-- modules/system/system.module | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/modules/system.module b/modules/system.module index 94cd94035869..e8e5444874b0 100644 --- a/modules/system.module +++ b/modules/system.module @@ -891,8 +891,13 @@ function system_modules() { } // Update the contents of the system table: - db_query("DELETE FROM {system} WHERE name = '%s' AND type = '%s'", $file->name, 'module'); - db_query("INSERT INTO {system} (name, description, type, filename, status, throttle, bootstrap, schema_version) VALUES ('%s', '%s', '%s', '%s', %d, %d, %d, %d)", $file->name, $file->description, 'module', $file->filename, $file->status, $file->throttle, $bootstrap, $file->schema_version); + if (isset($file->status)) { + db_query("UPDATE {system} SET description = '%s', filename = '%s', bootstrap = %d WHERE name = '%s'", $file->description, $file->filename, $bootstrap, $file->name); + } + else { + // This is a new module. + db_query("INSERT INTO {system} (name, description, type, filename, status, throttle, bootstrap) VALUES ('%s', '%s', '%s', '%s', %d, %d, %d)", $file->name, $file->description, 'module', $file->filename, $file->status, $file->throttle, $bootstrap); + } } diff --git a/modules/system/system.module b/modules/system/system.module index 94cd94035869..e8e5444874b0 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -891,8 +891,13 @@ function system_modules() { } // Update the contents of the system table: - db_query("DELETE FROM {system} WHERE name = '%s' AND type = '%s'", $file->name, 'module'); - db_query("INSERT INTO {system} (name, description, type, filename, status, throttle, bootstrap, schema_version) VALUES ('%s', '%s', '%s', '%s', %d, %d, %d, %d)", $file->name, $file->description, 'module', $file->filename, $file->status, $file->throttle, $bootstrap, $file->schema_version); + if (isset($file->status)) { + db_query("UPDATE {system} SET description = '%s', filename = '%s', bootstrap = %d WHERE name = '%s'", $file->description, $file->filename, $bootstrap, $file->name); + } + else { + // This is a new module. + db_query("INSERT INTO {system} (name, description, type, filename, status, throttle, bootstrap) VALUES ('%s', '%s', '%s', '%s', %d, %d, %d)", $file->name, $file->description, 'module', $file->filename, $file->status, $file->throttle, $bootstrap); + } } -- GitLab