Multi-DB and WP plugins that can’t find/make their tables

I’m setting up a site with Multi-DB. Most of it has gone smoothly, but there are some (WordPress, not WordPress MU) plugins that can’t seem to find/make the tables they require.

The plugins are NextGEN Gallery and Event Calendar.

For NextGEN, a look at the database shows that the tables have been created. However, it keeps saying that the tables could not be created. The code that outputs the error is in the function nggallery_install() in ngginstall.php:

if($wpdb->get_var("show tables like '$nggpictures'")!= $nggpictures) {

update_option( "ngg_init_check", __('NextGEN Gallery : Tables could not created, please check your database settings',"nggallery") );

return;

}

For Event Calendar, it says there was an error creating the tables. The tables don’t appear in the database. The code that produces the error is in function upgrade_database() in file admin.php:

$tables=$wpdb->get_results('SHOW TABLES',ARRAY_N);

if(!$tables)

{

die(sprintf(__('Error upgrading database for %s plugin.','ec3'),

'Event-Calendar'

));

}

  • Andrew
    • Champion of Loops

    Hiya,

    I’m afraid we can’t offer compatibility with every plugin. However, I thought NextGEN gallery works with Multi-DB.

    We’re also working on a brand new version of Multi-DB that’s basically built from the ground up (no config file changes for existing users).

    Thanks,

    Andrew

  • vsulmgc
    • New Recruit

    Oh man my head is spinning with PHP/MySQL interface stuff. And regexps.

    I found something that is maybe a bug, but changing it didn’t fix my problem:

    In db.php, in analyze_query() around line 835 where there’s the big set of regular expressions to determine the table name… (I had to remove the backticks from the regexp cause it messes up how it displays here)

    } else if ( preg_match('/^SHOW TABLE STATUS (LIKE|FROM) '?(w+)'?s*/is', $query, $maybe) ) {
    $table_name = $maybe[1];

    I think that should be $maybe[2], since $maybe[1] = LIKE or FROM, whichever was present.

    Also, there’s no branch for SHOW TABLES. I tried to add one by copying the SHOW TABLE STATUS branch. It works when I specify the database e.g. SHOW TABLES FROM multidbprefix_global – I get an array of all the tables in multidbprefix_global. It doesn’t work if I specify LIKE, e.g. SHOW TABLES LIKE wp_sitemeta.

    When do you think the new Multi-DB plugin will be ready?