WordPress.org

Ready to get started?Download WordPress

Forums

HyperDB
dbDelta issues w/ HyperDB (2 posts)

  1. Chris M.
    Member
    Posted 2 years ago #

    I've run into an issue where in certain situations, plugin database tables are not getting upgraded via the dbDelta function. The issue is that dbDelta runs SHOW TABLES and then loops through those tables. HyperDB sees SHOW TABLES and doesn't know how to extract the database from that query, so it uses the global database. That means dbDelta mistakenly thinks that the table does not exist, so it tries to create it instead of altering an existing table.

    I have managed to get around the problem by hacking wp-admin/includes/upgrade.php, but it's not ideal. Basically, I've set it up to call SHOW TABLE STATUS LIKE '$table' on each table in the $cqueries array (rather than just one SHOW TABLES query), which means it's slower. But I can't really see another way around that. One implication of HyperDB is that any table could be on any server, so I think each table needs to be checked individually.

    I'm thinking about creating a ticket and a patch for WordPress, but before I go there I was hoping someone else might have run across this problem and have a better solution.

    http://wordpress.org/extend/plugins/hyperdb/

  2. Boone Gorges
    Moderator
    Posted 2 years ago #

    I don't have anything smart to add, other than that I'm facing the same problem with SharDB (which is a fork of HyperDB, I think). I'll post back if I can find a decent solution.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags