proxy代理   soft软件   IT 业界特快   norton 诺顿病毒库   代理列表   search FTP搜索   whois IP地理位置   blog 追求完美  
money理财   life生活   RSS聚合门户   firefox WEB浏览器   免费域名   typeset 假古文   AntiVirus 反病毒   ipcn 站点导航  

« 被封了 & 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);
                }
        }
本blog WWW

Posted by windtear at April 6, 2005 10:22 PM

本站使用中的任何问题,请与 windtear @ windtear.net 联系
Copyright© 1999-2024 Windtear. All rights reserved.