Posted by jerome72 on November 17, 2008 at 12:06pm
Jump to:
| Project: | DB Maintenance |
| Version: | 6.x-1.1 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | cYu |
| Status: | closed (fixed) |
Issue Summary
I can't use this module because for each table I selected, when I execute /admin/settings/db_maintenance, Drupal says "Database tables optimized", but When I check table watchdog in phpmyadmin, I can see it has not been optimized at all.
If I check DB_maintenance log, for each table I selected it says :
Of course, theses tables exist, as DB maintenance retrieves them from my database.
Thanks for support
Comments
#1
#2
I think I know what the issue is, are you using table prefixes?
#3
Hi jgraham,
Thanks for the reply, sorry to be so late!
Yes I do use table prefixes, is it a problem ?
#4
Hi,
I seem to be having the same problem. Have selected the tables to run daily, and even if I do it manually, it has not optimized in phpmyadmin .. (:
Yes, also use table prefixes : drupal_
Is that perhaps what is causing this please?
Look forward to any reply.
Lilian
#5
Hi,
I updated to latest version, but still receive error logs:
eg. drupal_views_object_cache table in Drupal database was configured to be optimized but does not exist
I do use a table prefix : drupal_
Is there a way to fix this please?
Look forward to any reply and thank you for your great module.
Lilian
#6
When I use database tables without prefix, All tables Optimized OK, but with using any tables prefix for not !!!
After manually or by cron optimized Dupal says Database tables optimized, but look in Phpadmin optimized no tables.
#7
Any news please? as this is a much needed module ..
drupal_views_object_cache table in Drupal database was configured to be optimized but does not exist
Thanks so much!
#8
Yep, having the same issue, example -
drupal_wlw_blogapi_files table in Drupal database was configured to be optimized but does not exist.,drupal_wlw_blogapi_files table in Drupal database was configured to be optimized but does not exist.
#9
I've figured out the issue. If I can figure out how to post a .patch file I will. Here is the offending code section:
in db_mainenance.module line 155-165
$config_tables = variable_get('db_maintenance_table_list_'. $db, NULL);// Only proceed if tables are selected for this database.
if (is_array($config_tables) && count($config_tables) > 0) {
$db_name = $db == 'default' ? 'Drupal' : $db;
while (list(, $table_name) = each($config_tables)) {
// Set the database to query.
$previous = db_set_active($db);
if (db_table_exists($table_name)) {
if (_db_maintenance_determine_software() == 'mysql') {
$result = db_query('OPTIMIZE TABLE %s', $table_name);
$status = db_fetch_array($result);
When you are using a drupal database prefix, the code calls 'db_table_exists' with the prefix included (i.e db_table_exists("myprefix_node" ). The correct syntax for this call is to use the raw drupal database name (i.e. db_table_exists("node") )
The code below needs to be added directly before the _db_maintenance_determine_software call:
// Setup for database exists check...have to strip out $db_prefix due to db_table_exists expecting non prefixed tablenames.global $db_prefix;
if (strlen($db_prefix)>0) {
//database has a prefix
$table_check_name = str_replace($db_prefix,'',$table_name);
}
if (db_table_exists($table_check_name)) {
So the final code should look like the following:
$config_tables = variable_get('db_maintenance_table_list_'. $db, NULL);// Only proceed if tables are selected for this database.
if (is_array($config_tables) && count($config_tables) > 0) {
$db_name = $db == 'default' ? 'Drupal' : $db;
while (list(, $table_name) = each($config_tables)) {
// Set the database to query.
$previous = db_set_active($db);
// Setup for database exists check...have to strip out $db_prefix due to db_table_exists expecting non prefixed tablenames.
global $db_prefix;
if (strlen($db_prefix)>0) {
//database has a prefix
$table_check_name = str_replace($db_prefix,'',$table_name);
}
if (db_table_exists($table_check_name)) {
if (_db_maintenance_determine_software() == 'mysql') {
$result = db_query('OPTIMIZE TABLE %s', $table_name);
$status = db_fetch_array($result);
#10
I am experiencing the same issue, using db prefixes. I was hoping that spamsammy's patch would work but I'm still getting the same "does not exist" error message (btw, the table name referenced in the "does not exist" is the correct table name.)
#11
Deekayen has given me cvs access, so I'll take a look at this and commit the fix to the 6.1 branch.
#12
http://drupal.org/cvs?commit=305876 should take care of this. It is based on spamsammy's code, but I believe his original code would break the module for a site with non-prefixed tables. I'll make tag a 6.x-1.2 release with this.
#13
Automatically closed -- issue fixed for 2 weeks with no activity.