Jun 11, 2007, 05:27 AM
We've had this problem before. I have a large board and so I set the MYPS per char to 0. The recount times out trying to count the characters in every post.
I know that the fix for it was put in (if ($mybb->settings['myps_perchar'] > "0"){...) but this doesn't work.
It still times out, even when I set the number of users to recount per step to 1.
I believe there is some bug in the code, because when I comment out the recount chars part
everything works fine.
So I reckon the problem is the first if statement...though I can't think why.
I know that the fix for it was put in (if ($mybb->settings['myps_perchar'] > "0"){...) but this doesn't work.
It still times out, even when I set the number of users to recount per step to 1.
I believe there is some bug in the code, because when I comment out the recount chars part
PHP Code:
if ($mybb->settings['myps_perchar'] > "0"){
$char_query = $db->query("SELECT message FROM ".TABLE_PREFIX."posts WHERE uid='".$row['uid']."'");
$meslength ="0";
while($chars = $db->fetch_array($char_query, MYSQL_ASSOC))
{
$message = $chars['message'];
$message = str_replace(" ", "", $message);
$message = str_replace("\n", "", $message);
$message = str_replace("\r", "", $message);
$message = preg_replace('#\[quote\].+\[/quote\]#isU', '', $message);
$message = preg_replace('#\[code\].+\[/code\]#isU', '', $message);
//Remove standard BBCode tags
$pattern = array("#\[b\](.*?)\[/b\]#si",
"#\[i\](.*?)\[/i\]#si",
"#\[u\](.*?)\[/u\]#si",
"#\[s\](.*?)\[/s\]#si",
"#\(c\)#i",
"#\(tm\)#i",
"#\(r\)#i",
"#\[url\]([a-z]+?://)([^\r\n\"\[<]+?)\[/url\]#si",
"#\[url\]([^\r\n\"\[<]+?)\[/url\]#i",
"#\[url=([a-z]+?://)([^\r\n\"\[<]+?)\](.+?)\[/url\]#si",
"#\[url=([^\r\n\"\[<]+?)\](.+?)\[/url\]#si",
"#\[email\](.*?)\[/email\]#i",
"#\[email=(.*?)\](.*?)\[/email\]#i",
"#\[color=([a-zA-Z]*|\#?[0-9a-fA-F]{6})](.*?)\[/color\]#si",
"#\[size=(small|medium|large|x-large|xx-large)\](.*?)\[/size\]#si",
"#\[size=([0-9\+\-]+?)\](.*?)\[/size\]#si",
"#\[font=([a-z ]+?)\](.+?)\[/font\]#si",
"#\[align=(left|center|right|justify)\](.*?)\[/align\]#si");
$replace = array("$1", "$1", "$1", "$1", "", "", "", "$1$2", "$1", "$3", "$2", "$1", "$2", "$2", "$2", "$2", "$2", "$2");
$message = preg_replace($pattern, $replace, $message);
$meslength += strlen($message);
}
}
So I reckon the problem is the first if statement...though I can't think why.

