« 被封了 & kernel.panic 自动重起 | Main | msn 7 对blog的支持增强了 (7.0.0777发布) »
April 6, 2005
phpbb error creating new session - sessions.php
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本声明。 https://windtear.net/archives/2005/04/06/000621.html http://windtear.net/archives/2005/04/06/000621.html http://www.phpbb.com/phpBB/viewtopic.php?t=39397 http://www.phpbb.com/kb/article.php?article_id=42 DELETE FROM phpbb_sessions; ALTER TABLE phpbb_sessions MAX_ROWS = 2500; ALTER TABLE phpbb_sessions TYPE = MYISAM; -----> code VALUES ('$session_id', $user_id, $current_time, $current_time, '$user_ip', $page_id, $login)"; if ( !$db->sql_query($sql) ) { - message_die(CRITICAL_ERROR, 'Error creating new session', '', __LINE__, __FILE__, $sql); +$error = TRUE; +if (SQL_LAYER == "mysql" || SQL_LAYER == "mysql4") +{ + $sql_error = $db->sql_error($result); + if ($sql_error["code"] == 1114) + { + $result = $db->sql_query('SHOW TABLE STATUS LIKE "'.SESSIONS_TABLE.'"'); + $row = $db->sql_fetchrow($result); + if ($row["Type"] == "HEAP") + { + if ($row["Rows"] > 2500) + { + $delete_order = (SQL_LAYER=="mysql4") ? " ORDER BY session_time ASC" : ""; + $db->sql_query("DELETE QUICK FROM ".SESSIONS_TABLE."$delete_order LIMIT 50"); + } + else + { + $db->sql_query("ALTER TABLE ".SESSIONS_TABLE." MAX_ROWS=".($row["Rows"]+50)); + } + if ($db->sql_query($sql)) + { + $error = FALSE; + } + } + } +} +if ($error) +{ + message_die(CRITICAL_ERROR, "Error creating new session", "", __LINE__, __FILE__, $sql); +} + //message_die(CRITICAL_ERROR, 'Error creating new session', '', __LINE__, __FILE__, $sql); } } |
Posted by windtear at April 6, 2005 10:22 PM