MyBB Central

Full Version: Recount Problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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_queryMYSQL_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);
                
            }
         } 
everything works fine.

So I reckon the problem is the first if statement...though I can't think why.
Hmm..yeah I thought that if statement would be enough but I also had a slow recount here. Oddly on 1.09 it counted quickly. Sad

I have to look at that again.

btw...there is no need for recount if you use the suggested MYPS BACKUP by Lex. Smile
Cool, I'll use the backup in future.
Reference URL's