NNTP and search for uuencoded attachments [message #14222] |
Mon, 10 November 2003 02:54 |
|
I was running into a problem where if a nntp post had the word "begin" starting a line the nntp.php import script would hang if there was no uuencoded attachment to be decoded. Here is the "fix" which uses preg_match("/begin\s[0-7]{3}/", $this->body).
Also, because of this bug cropping up, I encountered a situation that caused messages to be imported multiple times. In function parse_msgs the message "counter" is not written to until all messages are parsed. If one should cause a problem and the script to break, such as the problem above, then the message "counter" file is not written to. Therefore on the next run of nntp.php it tries to import the same messages again (and again hits the one it hangs on. So I added one line that will write the current message id to the message control file. This way if it breaks you don't get tons of duplicates before it is noticed and you can quickly identify the message causing the problem. Yes it's a ton of disk writes if you are importing a lot of messages, but that is nothing compared to cleaning up that many duplicates or dumping everything and reimporting IMO.
Patch is based on v2.6.0RC2
|
|
|
|
|