[Bug] Unnecessary database update check
-
(Apologies if there’s a better place to report software bugs, I couldn’t find a public repo for this plugin)
On the “wp_loaded” hook, the plugin runs the
sbi_check_for_db_updates()
function, which compares the value of the “sbi_db_version” option against theSBI_DBVERSION
constant and, if they don’t match, will run through a series of SQL queries to update the table schema.However, the plugin doesn’t seem to ever set this value the first time, so the first page load will produce the following warnings:
WordPress database error: [Duplicate column name 'hashtag'] ALTER TABLE wp_sbi_instagram_feeds_posts ADD hashtag VARCHAR(1000) NOT NULL; WordPress database error: [Duplicate key name 'hashtag'] ALTER TABLE wp_sbi_instagram_feeds_posts ADD INDEX hashtag (hashtag(100))
Short term, this could be fixed by explicitly setting the “sbi_db_version” option at the end of
sbi_check_for_db_updates()
, e.g.:update_option( 'sbi_db_version', SBI_DBVERSION );
You may also benefit from WordPress’
dbDelta()
function for handling these updates, though that would be a larger refactoring.
- The topic ‘[Bug] Unnecessary database update check’ is closed to new replies.