1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed Strange Problem: phrase map rebuild timeout

Discussion in 'Resolved Bug Reports' started by LokizeGames, Jun 5, 2011.

  1. LokizeGames

    LokizeGames New Member

    Hi guys I'm having some strange problems among them below, to access the language the phrases do not appear, and sometimes mysteriously appear, do not know how to solve this problem!?

    [​IMG]

    Below I'll post another unsolved problem also when trying to install the forum several times getting this error, and every time I try to install any application error occurs again, I'm going crazy!

    [​IMG]
     
  2. LokizeGames

    LokizeGames New Member

  3. This error is driving me crazy :(
     
  4. User

    User Well-Known Member

  5. Mike

    Mike XenForo Developer Staff Member

    Can I just say that LMGTFY links really aren't appreciated? Yes I understand the point, but they're not helpful. Ideally, this should help: http://forums.iis.net/t/1076662.aspx

    Though that said, this seems to be a common problem and I can all but guarantee that it's the phrase map rebuild part of the process, so I guess I need to put together the fix for 1.0.3 and post it here. Will do that shortly.
     
  6. Mike

    Mike XenForo Developer Staff Member

    In library/XenForo/Model/Phrase.php, replace the whole insertPhraseMapForLanguages function:
    Code:
        public function insertPhraseMapForLanguages(array $languageMapList, $truncate = false)
        {
            $db = $this->_getDb();
    
            XenForo_Db::beginTransaction($db);
    
            if ($truncate)
            {
                $db->query('TRUNCATE TABLE xf_phrase_map');
            }
    
            foreach ($languageMapList AS $builtLanguageId => $map)
            {
                if (!$truncate)
                {
                    $db->delete('xf_phrase_map', 'language_id = ' . $db->quote($builtLanguageId));
                }
    
                foreach ($map AS $title => $phraseId)
                {
                    $db->insert('xf_phrase_map', array(
                        'language_id' => $builtLanguageId,
                        'title' => $title,
                        'phrase_id' => $phraseId
                    ));
                }
            }
    
            XenForo_Db::commit($db);
        }
    with this version:
    Code:
        public function insertPhraseMapForLanguages(array $languageMapList, $truncate = false)
        {
            $db = $this->_getDb();
    
            XenForo_Db::beginTransaction($db);
    
            if ($truncate)
            {
                $db->query('TRUNCATE TABLE xf_phrase_map');
            }
    
            $rows = array();
            $rowLength = 0;
    
            foreach ($languageMapList AS $builtLanguageId => $map)
            {
                if (!$truncate)
                {
                    $db->delete('xf_phrase_map', 'language_id = ' . $db->quote($builtLanguageId));
                }
    
                $builtLanguageIdQuoted = $db->quote($builtLanguageId);
    
                foreach ($map AS $title => $phraseId)
                {
                    $row = '(' . $builtLanguageIdQuoted . ', ' . $db->quote($title) . ',' . $db->quote($phraseId) . ')';
    
                    $rows[] = $row;
                    $rowLength += strlen($row);
    
                    if ($rowLength > 500000)
                    {
                        $db->query('
                            INSERT INTO xf_phrase_map
                                (language_id, title, phrase_id)
                            VALUES
                                ' . implode(',', $rows)
                        );
    
                        $rows = array();
                        $rowLength = 0;
                    }
                }
            }
    
            if ($rows)
            {
                $db->query('
                    INSERT INTO xf_phrase_map
                        (language_id, title, phrase_id)
                    VALUES
                        ' . implode(', ', $rows)
                );
            }
    
            XenForo_Db::commit($db);
        }
     
    sifuhall and Marcos Previato like this.
  7. Vincent

    Vincent Well-Known Member

    $
    You forget to mark this thread as Fixed ;)
     
  8. Thanks, but this problem continues
     
  9. Mike

    Mike XenForo Developer Staff Member

    Then it's unlikely that your problem is the same as the one posted in this thread (unless I'm wrong about this thread, but everything fits).
     
  10. Although I still do not see my phrases!
     
  11. Look I'm sorry to say this, but the second problem, never happened to me using the platform vbulletin or IPB, I think it's a problem xenforo, because it takes longer than 60 seconds to install the forum, and of course the addons, and the fact that it takes more than 60 seconds is generating this problem!

    And, sorry but the error not [Fixed]...(n)
     
  12. sifuhall

    sifuhall Active Member

    Thanks, Mike.

    Worked for me.
     

Share This Page