• 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

#1
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!?



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!

 

Mike

XenForo developer
Staff member
#5
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.
 

Mike

XenForo developer
Staff member
#6
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);
    }
 
#8
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);
    }
Thanks, but this problem continues
 
#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)