From f3367271f5dc8deea48c59cb01cf893df18708cc Mon Sep 17 00:00:00 2001 From: "Fedor A. Fetisov" Date: Fri, 15 Apr 2011 17:50:51 +0400 Subject: [PATCH] Create indexes for database tables during installation process --- src/messenger/webim/install/dbinfo.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/messenger/webim/install/dbinfo.php b/src/messenger/webim/install/dbinfo.php index 919effb9..f512a585 100644 --- a/src/messenger/webim/install/dbinfo.php +++ b/src/messenger/webim/install/dbinfo.php @@ -129,6 +129,15 @@ $dbtables = array( ), ); +$dbtables_indexes = array( + "${mysqlprefix}chatmessage" => array( + "idx_agentid" => "agentid" + ), + "${mysqlprefix}chatsitevisitor" => array( + "threadid" => "threadid" + ) +); + $memtables = array(); $dbtables_can_update = array( @@ -157,7 +166,7 @@ function show_install_err($text) function create_table($id, $link) { - global $dbtables, $memtables, $dbencoding, $mysqlprefix; + global $dbtables, $dbtables_indexes, $memtables, $dbencoding, $mysqlprefix; if (!isset($dbtables[$id])) { show_install_err("Unknown table: $id, " . mysql_error($link)); @@ -170,6 +179,12 @@ function create_table($id, $link) $query .= " $k $v,\n"; } + if (isset($dbtables_indexes[$id])) { + foreach ($dbtables_indexes[$id] as $k => $v) { + $query .= " INDEX $k ($v),\n"; + } + } + $query = preg_replace("/,\n$/", "", $query); $query .= ") charset $dbencoding"; if (in_array($id, $memtables)) {