RepairBoards.php causes mySQL db gone away Error

Started by Sven0, December 01, 2005, 05:49:13 PM

Previous topic - Next topic

Sven0

Hi,

i transfered a phpBB 2.0.17 to a SMF 1.1 RC1 and got this problem:
http://www.simplemachines.org/community/index.php?topic=38966.msg391995#msg391995

to avoid the problem i run this code:

ALTER TABLE smf_topics
DROP INDEX lastMessage,
DROP INDEX firstMessage,
DROP INDEX poll,
ADD INDEX lastMessage (ID_LAST_MSG, ID_BOARD),
ADD INDEX firstMessage (ID_FIRST_MSG, ID_BOARD),
ADD INDEX poll (ID_POLL, ID_TOPIC)


after i run the code the phpBB converter worked fine but under "Forum Maintenance" > "Find and repair any errors." i got this errors:

Listing of forum errors
The following errors are fouling up your forum:
The subject of topic #2 is currently not stored in the subject cache.
...long list...
The subject of topic #20758 is currently not stored in the subject cache.
Cached word 'bei' is linked to a non-existant topic.
Cached word 'smf' is linked to a non-existant topic.
Cached word 'willkommen' is linked to a non-existant topic.

If i try to fix them i receive this error after 10 seconds wait:

Database Error
MySQL server has gone away
File: /usr/local/vhostshttpd/htdocs/forum/Sources/RepairBoards.php
Line: 626

in RepairBoards.php i found this to the theme "The subject of topic #2 is currently not stored in the subject cache." in line 605:


if (empty($to_fix) || in_array('missing_cached_subject', $to_fix))
{
$request = db_query("
SELECT t.ID_TOPIC, m.subject
FROM {$db_prefix}topics AS t, {$db_prefix}messages AS m
LEFT JOIN {$db_prefix}log_search_subjects AS lss ON (lss.ID_TOPIC = t.ID_TOPIC)
WHERE m.ID_MSG = t.ID_FIRST_MSG
AND lss.ID_TOPIC IS NULL", __FILE__, __LINE__);
$insertRows = array();
while ($row = mysql_fetch_assoc($request))
{
foreach (text2words($row['subject']) as $word)
$insertRows[] = "'$word', $row[ID_TOPIC]";
}
mysql_free_result($request);

if (!empty($insertRows))
db_query("
INSERT INTO {$db_prefix}log_search_subjects
(word, ID_TOPIC)
VALUES (" . implode('),
(', array_unique($insertRows)) . ")", __FILE__, __LINE__);
}


this is the line 626 that causes the error:


db_query("
INSERT INTO {$db_prefix}log_search_subjects
(word, ID_TOPIC)
VALUES (" . implode('),
(', array_unique($insertRows)) . ")", __FILE__, __LINE__);



and in line 1383 is:

if ($_GET['step'] <= 21)
{
$request = db_query("
SELECT t.ID_TOPIC, fm.subject
FROM {$db_prefix}topics AS t, {$db_prefix}messages AS fm
LEFT JOIN {$db_prefix}log_search_subjects AS lss ON (lss.ID_TOPIC = t.ID_TOPIC)
WHERE fm.ID_MSG = t.ID_FIRST_MSG
AND lss.ID_TOPIC IS NULL", __FILE__, __LINE__);
$found_error = false;
while ($row = mysql_fetch_assoc($request))
if (count(text2words($row['subject'])) != 0)
{
$context['repair_errors'][] = sprintf($txt['repair_missing_cached_subject'], $row['ID_TOPIC']);
$found_error = true;
}
mysql_free_result($request);

if ($found_error)
$to_fix[] = 'missing_cached_subject';

$_GET['step'] = 22;
$_GET['substep'] = 0;
pauseRepairProcess($to_fix);
}


a member of the german help board gave me this code for step 21 but i still got the same error message:

if ($_GET['step'] <= 21)
{
$result = db_query("
SELECT MAX(ID_TOPIC)
FROM {$db_prefix}topics", __FILE__, __LINE__);
list ($topics) = mysql_fetch_row($result);
mysql_free_result($result);

for (; $_GET['substep'] < $topics; $_GET['substep'] += 500)
{
$request = db_query("
SELECT t.ID_TOPIC, fm.subject
FROM {$db_prefix}topics AS t, {$db_prefix}messages AS fm
LEFT JOIN {$db_prefix}log_search_subjects AS lss ON (lss.ID_TOPIC = t.ID_TOPIC)
WHERE fm.ID_MSG = t.ID_FIRST_MSG
AND lss.ID_TOPIC IS NULL
AND t.ID.TOPIC BETWEEN $_GET[substep] AND $_GET[substep] + 499", __FILE__, __LINE__);
$found_error = false;
while ($row = mysql_fetch_assoc($request))
if (count(text2words($row['subject'])) != 0)
{
$context['repair_errors'][] = sprintf($txt['repair_missing_cached_subject'], $row['ID_TOPIC']);
$found_error = true;
}
if ($found_error)
$to_fix[] = 'missing_cached_subject';

mysql_free_result($request);
pauseRepairProcess($to_fix, $topics);
}

$_GET['step'] = 22;
$_GET['substep'] = 0;
pauseRepairProcess($to_fix);
}


i search now for a solution for 48 hours but with no luck, CAN ANYONE HELP ME?

This is a managed server and i have root, ssh and php.ini access...

PHP Version 4.1.0
mySQl 3.23.48
Apache/1.3.23


Advertisement: