WordPress.org

Ready to get started?Download WordPress

Forums

WP-Polls
Bug in upgrade (4 posts)

  1. Killing
    Member
    Posted 1 year ago #

    Looks like there's a bug in your upgrade script for v2.61
    $wpdb->query("ALTER TABLE $wpdb->pollsip ADD INDEX pollip_ip (pollip_id);");

    As pollip_id is the Primary key for the table I can only assume this is a typo and you mean't pollip_ip not pollip_id e.g.
    $wpdb->query("ALTER TABLE $wpdb->pollsip ADD INDEX pollip_ip (pollip_ip);");

    In addition these two ALTER TABLE statements cause php errors when the plugin is re-enabled after already being upgraded.

    http://wordpress.org/extend/plugins/wp-polls/

  2. Lester Chan
    Member
    Plugin Author

    Posted 1 year ago #

    Do you have the php error on hand? I can't remember why I did that but you are right, id is already the PRIMARY KEY and therefore the index is not required.

  3. Killing
    Member
    Posted 1 year ago #

    Here's the errors from the log for you

    [31-Mar-2013 08:37:48 UTC] WordPress database error Duplicate key name 'pollip_ip' for query ALTER TABLE wp_pollsip ADD INDEX pollip_ip (pollip_ip); made by activate_plugins, activate_plugin, do_action('activate_wp-polls/wp-polls.php'), call_user_func_array, create_poll_table
    [31-Mar-2013 08:37:48 UTC] WordPress database error Duplicate key name 'pollip_qid' for query ALTER TABLE wp_pollsip ADD INDEX pollip_qid (pollip_qid); made by activate_plugins, activate_plugin, do_action('activate_wp-polls/wp-polls.php'), call_user_func_array, create_poll_table

    They are expected as there's no validation as to which version is already installed, so its trying to add the index each time the plugin is enabled, instead of only when its moving from an old version to the new one.

  4. Lester Chan
    Member
    Plugin Author

    Posted 1 year ago #

    Yea, because of previous mistakes of not having versioning within the plugin. I will just remove the line alotgether

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags