Support » Plugin: Events Manager » Install script should fail if database tables are not created

  • I had trouble getting Events Manager to work.

    I kept getting the error:

    Your event details are incorrect and cannot be published, please correct these errors first:
    
    Something went wrong saving your event to the index table. Please inform a site administrator about this

    I completely removed EM, deleted all database rows containing “dbem_%”, and reinstalled. Still no joy.

    Troubleshooting another issue, I happened to read the database error_log, which said that MySQL could not find the correct tables.

    Some time ago, I had hardened the site using the instructions here. However, the install script for the plugin requires the database user to have “Create” privileges, so it was never creating the required tables.

    I recommend that the install script for this and all other plugins fail with appropriate message if either: (1) the database user has insufficient privileges, or (2) the required tables are not created. It should only take two or three lines of code (perhaps in a couple of places) to check for required privileges or tables and exit if not found. (If you really wanted to get super security cool, you could even prompt to add the privileges before install and then remove them after.)

    That is all.

    Happy Trails.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support caimin_nwl

    (@caimin_nwl)

    Thanks for your feedback; I’ve passed this on to the Dev team.

    Thank you for this posting this loyeyoung. It appears I am hitting a similar issue. Have you found a solution to this problem?

    Thanks

    @clorange
    The only workaround of which I’m aware is to change the database user’s privileges and add the CREATE right. In my particular case, I used my hosting company’s cPanel interface, but the same result can be had via the command line or phpMyAdmin.

    The Right Thing(tm) would be to fix every plugin’s install script to check for the appropriate privileges before, verify the table’s creation after, and prompt the site administrator what to do if the plugin cannot be installed.

    Plugin Author Marcus

    (@netweblogic)

    hi @loyeyoung,

    You’re right that this is an issue that could be avoided. Ideally, there’d be a “WP way” for us to check privelages before installing, but it’s not that easy, and it doesn’t mean that other issues can arise during the creation of DB tables (dbdelta isn’t helpful with providing error info).

    What I will take note of for the interim (which would be something we’d do down the line, not just yet) is we’ll look into adding a ‘reset tables’ or similar, just so tables get rebuilt if missing, no deletions or anything like that.

    Currently, the ‘reset’ button in Events > Settings > Admin Tools will do just that, but it also deletes settings data and recreates them.

    >check privelages before installing
    >it’s not that easy

    “SHOW GRANTS FOR CURRENT_USER();”

    >other issues can arise during the creation of DB tables

    Print MySQL’s error message that table could not be created.

    Error: 1006 SQLSTATE: HY000 (ER_CANT_CREATE_DB)
    Message: Can't create database '%s' (errno: %d)

    “The Right Thing(tm) would be to fix every plugin’s install script to check for the appropriate privileges before, verify the table’s creation after, and prompt the site administrator what to do if the plugin cannot be installed.”

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Install script should fail if database tables are not created’ is closed to new replies.