Topic: deactivate_extension not dropping tables
Even if $check_only = false;, the $ok fails the test in function update_databases() in includes/hooks.inc as the function check_table() called in it and defined in admin/db/maintenance_db.inc as:
function check_table($pref, $table, $field=null, $properties=null)
{
$tables = @db_query("SHOW TABLES LIKE '".$pref.$table."'");
if (!db_num_rows($tables))
return 1; // no such table or error
$fields = @db_query("SHOW COLUMNS FROM ".$pref.$table);
if (!isset($field))
return 0; // table exists
while( $row = db_fetch_assoc($fields))
{
if ($row['Field'] == $field)
{
if (!isset($properties))
return 0;
foreach($properties as $property => $value)
{
if ($row[$property] != $value)
return 3; // failed type/length check
}
return 0; // property check ok.
}
}
return 2; // field not found
}
attempts to evaluate $fields = SHOW COLUMNS FROM... even when there is no $field argument available when dropping tables during deactivate_extensions! Hence the said function should be corrected to be:
function check_table($pref, $table, $field=null, $properties=null)
{
$tables = @db_query("SHOW TABLES LIKE '".$pref.$table."'");
if (!db_num_rows($tables))
return 1; // no such table or error
if (!isset($field))
return 0; // table exists
$fields = @db_query("SHOW COLUMNS FROM ".$pref.$table);
while( $row = db_fetch_assoc($fields))
{
if ($row['Field'] == $field)
{
if (!isset($properties))
return 0;
foreach($properties as $property => $value)
{
if ($row[$property] != $value)
return 3; // failed type/length check
}
return 0; // property check ok.
}
}
return 2; // field not found
}
Please confirm it being a fix.