Deleting duplicate mdir emails using php
March 19th, 2008
In an attempt to speed up my imap access I moved old emails in to folders based on year. This speed up process majorly backfired when imap/mdir decided to make 7 copies of each email in the same folder. I ended up with 27,000 emails in my 2006 folder!
With my mailbox quota full I needed a quick solution… and couldn’t find one! Thunderbird has a plugin that will search for and delete duplicate messages but it runs over imap which crippled the server trying to handle all the requests.
Using Google I stumbled across this solution for finding and deleting duplicate messages using reformail but after getting reformail installed I found it to be very slow and the number of messages to delete didn’t add up so I had to abandon this approach.
In the end I decided to write my own PHP script that would cycle through the specific mail directory, search for duplicate messages based on the Message-Id (or a checksum of the email if not available) and then delete the unnecessary, duplicate emails. It worked a treat, and went through the 27,000 emails in less than 5 minutes! If anybody wants the code, its below!
Back with wordpress 2.5 (RC1)
March 18th, 2008
It has been a while since a post, I was hoping I wouldn’t slip in to a bad routine. Thanks for the comments so far, especially for the rb-internal-links plugin, can’t believe so many people are using it! Need to find a way to push it out there to more people if I can.
Back on topic, I’ve just installed release candidate 1 of the new version of wordpress. Matt mentioned on his blog that it would be a big one and it certainly is! From what I can tell the admin panel has been majorly revamped, both design wise and code wise. Logging in after the upgrade I had a few doubts but the new administration panel is impressively better (I liked the old one anyway). So far no major issues in upgrading from 2.4.x but I can see that I need to fix up the internal links plugin as the button has disappeared from the wysiwyg editor.