• Resolved songsofabba

    (@songsofabba)


    Hello and thanks for this great plugin! Since a couple of updates ago my error log was filled with the same error for the 3 sites where i’m using this plugin like this.

    [23-Apr-2022 09:01:47 UTC] WordPress database error for Table 'xxx_aiowps_debug_log' already exists f?rfr?gan CREATE TABLE xxx_aiowps_debug_log (
    			id bigint(20) NOT NULL AUTO_INCREMENT,
    			level varchar(25) NOT NULL DEFAULT '',
    			message text NOT NULL DEFAULT '',
    			type varchar(25) NOT NULL DEFAULT '',
    			created datetime NOT NULL DEFAULT '1000-10-10 10:00:00',
    			PRIMARY KEY  (id)
    			)DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;

    I have googled around to find a solution and it seems that i manage to get rid of this error by changing in the wp-securtity-debug-logger.php file from “CREATE TABLE” to “CREATE TABLE IF NOT EXISTS” in this section.

    //This exists as a constant, but multisite will need to refresh $wpdb->prefix
    		$debug_log_tbl_name = $wpdb->prefix.'aiowps_debug_log';
    
    		$debug_log_tbl_sql = "CREATE TABLE IF NOT EXISTS " . $debug_log_tbl_name . " (
    			id bigint(20) NOT NULL AUTO_INCREMENT,
    			level varchar(25) NOT NULL DEFAULT '',
    			message text NOT NULL DEFAULT '',
    			type varchar(25) NOT NULL DEFAULT '',
    			created datetime NOT NULL DEFAULT '1000-10-10 10:00:00',
    			PRIMARY KEY  (id)
    			)" . $charset_collate . ";";
    
    		maybe_create_table($debug_log_tbl_name, $debug_log_tbl_sql);
    
    	}

    Is this a correct solution? In that case do you consider change this in coming update?
    Thank you again for this great plugin!
    Best regards
    Lennart

Viewing 1 replies (of 1 total)
  • Plugin Support vupdraft

    (@vupdraft)

    I was unable to replicate this on my site and we have not had any other reports of this yet.

    I believe AIOWPS uses WordPress core dbDelta() function for creating/altering database tables. If a table already exists the create table_name SQL statement is normally ignored by dbDelta().

    Only when a Describe table_name; SQL statement returns nothing (MySQL errors are suppressed), dbDelta() will attempt to create the table.

    Thus, it is likely the you are running into a MySQL privilege issue.
    However, I don’t see any issues with the solution that you have implemented.

Viewing 1 replies (of 1 total)
  • The topic ‘Throwing error’ is closed to new replies.