Commit 29170c88 authored by Gerhard Killesreiter's avatar Gerhard Killesreiter

#48025, System table not updated when moving modules, patch by grugnog,...

#48025, System table not updated when moving modules, patch by grugnog, changed variable name to match conventions.
parent 1091a2f0
...@@ -510,9 +510,10 @@ function system_cron_settings() { ...@@ -510,9 +510,10 @@ function system_cron_settings() {
*/ */
function system_get_files_database(&$files, $type) { function system_get_files_database(&$files, $type) {
// Extract current files from database. // Extract current files from database.
$result = db_query("SELECT name, type, status, throttle, schema_version FROM {system} WHERE type = '%s'", $type); $result = db_query("SELECT filename, name, type, status, throttle, schema_version FROM {system} WHERE type = '%s'", $type);
while ($file = db_fetch_object($result)) { while ($file = db_fetch_object($result)) {
if (isset($files[$file->name]) && is_object($files[$file->name])) { if (isset($files[$file->name]) && is_object($files[$file->name])) {
$file->old_filename = $file->filename;
foreach ($file as $key => $value) { foreach ($file as $key => $value) {
if (!isset($files[$file->name]) || !isset($files[$file->name]->$key)) { if (!isset($files[$file->name]) || !isset($files[$file->name]->$key)) {
$files[$file->name]->$key = $value; $files[$file->name]->$key = $value;
...@@ -919,8 +920,8 @@ function system_modules() { ...@@ -919,8 +920,8 @@ function system_modules() {
} }
// Update the contents of the system table: // Update the contents of the system table:
if (isset($file->status)) { if (isset($file->status) || $file->old_filename != $file->filename) {
db_query("UPDATE {system} SET description = '%s', name = '%s', bootstrap = %d WHERE filename = '%s'", $file->description, $file->name, $bootstrap, $file->filename); db_query("UPDATE {system} SET description = '%s', name = '%s', bootstrap = %d, filename = '%s' WHERE filename = '%s'", $file->description, $file->name, $bootstrap, $file->filename, $file->old_filename);
} }
else { else {
// This is a new module. // This is a new module.
......
...@@ -510,9 +510,10 @@ function system_cron_settings() { ...@@ -510,9 +510,10 @@ function system_cron_settings() {
*/ */
function system_get_files_database(&$files, $type) { function system_get_files_database(&$files, $type) {
// Extract current files from database. // Extract current files from database.
$result = db_query("SELECT name, type, status, throttle, schema_version FROM {system} WHERE type = '%s'", $type); $result = db_query("SELECT filename, name, type, status, throttle, schema_version FROM {system} WHERE type = '%s'", $type);
while ($file = db_fetch_object($result)) { while ($file = db_fetch_object($result)) {
if (isset($files[$file->name]) && is_object($files[$file->name])) { if (isset($files[$file->name]) && is_object($files[$file->name])) {
$file->old_filename = $file->filename;
foreach ($file as $key => $value) { foreach ($file as $key => $value) {
if (!isset($files[$file->name]) || !isset($files[$file->name]->$key)) { if (!isset($files[$file->name]) || !isset($files[$file->name]->$key)) {
$files[$file->name]->$key = $value; $files[$file->name]->$key = $value;
...@@ -919,8 +920,8 @@ function system_modules() { ...@@ -919,8 +920,8 @@ function system_modules() {
} }
// Update the contents of the system table: // Update the contents of the system table:
if (isset($file->status)) { if (isset($file->status) || $file->old_filename != $file->filename) {
db_query("UPDATE {system} SET description = '%s', name = '%s', bootstrap = %d WHERE filename = '%s'", $file->description, $file->name, $bootstrap, $file->filename); db_query("UPDATE {system} SET description = '%s', name = '%s', bootstrap = %d, filename = '%s' WHERE filename = '%s'", $file->description, $file->name, $bootstrap, $file->filename, $file->old_filename);
} }
else { else {
// This is a new module. // This is a new module.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment