From f6d33db15ef194a972e67f4e816509a81d96c8d7 Mon Sep 17 00:00:00 2001 From: Darin Wilton Date: Mon, 1 Feb 2016 08:20:28 -0500 Subject: [PATCH] fixed prune sql --- acp/ajaxchat_module.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/acp/ajaxchat_module.php b/acp/ajaxchat_module.php index 544b192..683b249 100644 --- a/acp/ajaxchat_module.php +++ b/acp/ajaxchat_module.php @@ -199,18 +199,16 @@ public function prune_chat($value, $key) } if ($this->u_action === 'prune_chat') { - $sql = 'SELECT message_id - FROM ' . CHAT_TABLE . ' - ORDER BY message_id DESC '; - $result = $this->db->sql_query_limit($sql, $this->config['prune_keep_ajax_chat'], 1); - $row = $this->db->sql_fetchrow($result); + $sql = 'SELECT message_id + FROM ' . CHAT_TABLE . ' + ORDER BY message_id DESC '; + $result = $this->db->sql_query_limit($sql, 1, $this->config['prune_keep_ajax_chat']); + $row = $this->db->sql_fetchfield('message_id'); $this->db->sql_freeresult($result); $sql1 = 'DELETE FROM ' . CHAT_TABLE . ' - WHERE `message_id` < ' . (int) $row['message_id'] . ''; + WHERE `message_id` <= ' . (int) $row . ''; $this->db->sql_query($sql1); - add_log('admin', 'PRUNE_LOG_AJAXCHAT'); - if ($this->request->is_ajax()) { trigger_error($this->user->lang['PRUNE_CHAT_SUCCESS']); @@ -252,8 +250,6 @@ public function truncate_chat($value, $key) $sql1 = 'TRUNCATE ' . CHAT_TABLE . ''; $this->db->sql_query($sql1); - add_log('admin', 'TRUNCATE_LOG_AJAXCHAT'); - if ($this->request->is_ajax()) { trigger_error($this->user->lang['TRUNCATE_CHAT_SUCCESS']);