WordPress.org

Ready to get started?Download WordPress

Forums

Podpress: Getting rid of the duplicate error in logs (6 posts)

  1. avatarworf
    Member
    Posted 4 years ago #

    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?

  2. ntm
    Member
    Posted 4 years ago #

    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 http://dev.mysql.com/doc/refman/4.1/en/insert-on-duplicate.html. 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 http://wordpress.org/extend/plugins/podpress/download/.

  3. ntm
    Member
    Posted 4 years ago #

    I have created a Trac Ticket and a patch.

  4. avatarworf
    Member
    Posted 4 years ago #

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

  5. ntm
    Member
    Posted 4 years ago #

    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. :)

  6. ntm
    Member
    Posted 4 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags