Podpress: Getting rid of the duplicate error in logs
I finally decided to take a look at the follow error which is displayed in the web error logs:
WordPress database error Duplicate entry ‘filename.mp3-111’ for key 1 for query INSERT INTO wp_podpress_statcounts (postID, media, play) VALUES (111, ‘filename.mp3’, 1) made by require_once, require_once, include_once, podPress_statsDownloadRedirect, podPress_processDownloadRedirect, podPress_StatCounter, referer: /wp-content/plugins/podpress/players/1pixelout_player.swf
The function podPress_StatCounter can be found in the podpress_functions.php file which does something a little odd when trying to do a basic add one to the stats table.
It does both and insert value 1 (initial count) – which it always performs. Then the 2,3,4.. time it does the insert (which fails) and then the update statement. Obviously the insert failing is generating the error log entry.
Now another way to go about this might be to (depending on the abilities of everyone’s Database (mine mySQL 5.0)) The SQL command could be changed to something like:
$sqlIoU = “INSERT INTO “.$wpdb->prefix.”podpress_statcounts (postID, media, $method) VALUES ($postID, ‘$media’, 1) ON DUPLICATE KEY UPDATE $method = $method+1, total = total+1;
Anybody see any problem with this?
- The topic ‘Podpress: Getting rid of the duplicate error in logs’ is closed to new replies.