Support » Plugins » 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?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thanks for the report!
    My error logs contain comparable messages. But the query string you have proposed seems to work very good. I have tried it with a new podcast post and it counts correctly – without error log entries.

    The ON DUPLICATE KEY UPDATE seems to work with older MySQL version, too. You can find an explanation for this command in the reference manual of MySQL 4.1 Further the WP requirements lists MySQL 4.1.2 as required. So the MySQL version should be no problem.
    I see no problem. This fix should be in 8.8.5.

    BTW: If you have the possibility to test a beta version in a test blog then you could try the Development Version of podPress

    I have created a Trac Ticket and a patch.

    Funny the Development Version I downloaded (just now) didn’t have those modifications (but the patch file looks correct to me.)

    Yes, that’ right the current development version does not contain this patch yet. But I’m working today on some other changes for the feeds generating functions and then I will ask Andrew Ozz to add the Ticket #1068 and these further changes to the development version. I’m confident that the next development version will be ready until the end of next week.

    But if you discover any other problem with the current development version then it would be very helpfully if you could describe the problem(s) in the other thread.
    On the other hand if you can report that there are no further problems it would be nice, too. 🙂

    v8.8.5 beta 3 is still not ready. I will post another message when it will be ready for testing.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Podpress: Getting rid of the duplicate error in logs’ is closed to new replies.