mirror of
https://github.com/Mibew/i18n.git
synced 2025-01-22 21:40:28 +03:00
Create indexes for database tables during installation process
This commit is contained in:
parent
65b00240d3
commit
b498de216e
@ -112,6 +112,12 @@ $dbtables = array(
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$dbtables_indexes = array(
|
||||||
|
"${mysqlprefix}chatmessage" => array(
|
||||||
|
"idx_agentid" => "agentid"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$memtables = array();
|
$memtables = array();
|
||||||
|
|
||||||
$dbtables_can_update = array(
|
$dbtables_can_update = array(
|
||||||
@ -139,7 +145,7 @@ function show_install_err($text)
|
|||||||
|
|
||||||
function create_table($id, $link)
|
function create_table($id, $link)
|
||||||
{
|
{
|
||||||
global $dbtables, $memtables, $dbencoding, $mysqlprefix;
|
global $dbtables, $dbtables_indexes, $memtables, $dbencoding, $mysqlprefix;
|
||||||
|
|
||||||
if (!isset($dbtables[$id])) {
|
if (!isset($dbtables[$id])) {
|
||||||
show_install_err("Unknown table: $id, " . mysql_error($link));
|
show_install_err("Unknown table: $id, " . mysql_error($link));
|
||||||
@ -152,6 +158,12 @@ function create_table($id, $link)
|
|||||||
$query .= " $k $v,\n";
|
$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 = preg_replace("/,\n$/", "", $query);
|
||||||
$query .= ") charset $dbencoding";
|
$query .= ") charset $dbencoding";
|
||||||
if (in_array($id, $memtables)) {
|
if (in_array($id, $memtables)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user