* A class that implements the DB interface for Postgres
* Note: This class uses ADODB and returns RecordSets.
*
- * $Id: BaseDB.php,v 1.45 2004/05/14 07:56:37 chriskl Exp $
+ * $Id: BaseDB.php,v 1.46 2004/05/19 01:28:34 soranzo Exp $
*/
include_once('./classes/database/ADODB_base.php');
function hasSchemas() { return false; }
function hasConversions() { return false; }
function hasGrantOption() { return false; }
- function hasCluster() { return false; }
+ function hasIsClustered() { return false; }
function hasDropBehavior() { return false; }
+ function hasDropColumn() { return false; }
function hasSRFs() { return false; }
function hasDomains() { return false; }
function hasDomainConstraints() { return false; }
function hasSchemaDump() { return false; }
function hasFunctionRename() { return false; }
function hasAlterColumnType() { return false; }
+ function hasUserSessionDefaults() { return false; }
+ function hasUserRename() { return false; }
+ function hasRecluster() { return false; }
+ function hasFullVacuum() { return false; }
}
* A class that implements the DB interface for Postgres
* Note: This class uses ADODB and returns RecordSets.
*
- * $Id: Postgres.php,v 1.208 2004/05/16 15:46:24 chriskl Exp $
+ * $Id: Postgres.php,v 1.209 2004/05/19 01:28:34 soranzo Exp $
*/
// @@@ THOUGHT: What about inherits? ie. use of ONLY???
/**
* Formats a value or expression for sql purposes
* @param $type The type of the field
- * @param $mode VALUE or EXPRESSION
+ * @param $format VALUE or EXPRESSION
* @param $value The actual value entered in the field. Can be NULL
* @return The suitably quoted and escaped value.
*/
}
+ // Index functions
+
/**
* Grabs a list of indexes for a table
* @param $table The name of a table whose indexes to retrieve
return $this->execute($sql);
}
+ /**
+ * Clusters an index
+ * @param $index The name of the index
+ * @param $table The table the index is on
+ * @return 0 success
+ */
+ function clusterIndex($index, $table) {
+ $this->fieldClean($index);
+ $this->fieldClean($table);
+
+ // We don't bother with a transaction here, as there's no point rolling
+ // back an expensive cluster if a cheap analyze fails for whatever reason
+ $sql = "CLUSTER \"{$index}\" ON \"{$table}\"";
+
+ return $this->execute($sql);
+ }
+
// Rule functions
/**
/**
* Vacuums a database
- * @param $table (optional) The table to vacuum
- */
- function vacuumDB($table = '') {
+ * @param $table The table to vacuum
+ * @param $analyze If true, also does analyze
+ * @param $full If true, selects "full" vacuum (PostgreSQL >= 7.2)
+ * @param $freeze If true, selects aggressive "freezing" of tuples (PostgreSQL >= 7.2)
+ */
+ function vacuumDB($table = '', $analyze = false, $full = false, $freeze = false) {
+ $sql = "VACUUM";
+ if ($analyze) $sql .= " ANALYZE";
if ($table != '') {
$this->fieldClean($table);
- $sql = "VACUUM \"{$table}\"";
+ $sql .= " \"{$table}\"";
}
- else
- $sql = "VACUUM";
return $this->execute($sql);
}
return $this->execute($sql);
}
+ /**
+ * Rebuild indexes
+ * @param $type 'DATABASE' or 'TABLE' or 'INDEX'
+ * @param $name The name of the specific database, table, or index to be reindexed
+ * @param $force If true, recreates indexes forcedly in PostgreSQL 7.0-7.1, forces rebuild of system indexes in 7.2-7.3, ignored in >=7.4
+ */
+ function reindex($type, $name, $force=false) {
+ $this->fieldClean($name);
+ switch($type) {
+ case 'DATABASE':
+ case 'TABLE':
+ case 'INDEX':
+ $sql = "REINDEX {$type} {$name}";
+ if ($force) $sql .= ' FORCE';
+ break;
+ default:
+ return -1;
+ }
+ return $this->execute($sql);
+ }
+
// Constraint functions
/**
function hasIndicies() { return true; }
function hasRules() { return true; }
function hasLanguages() { return true; }
- function hasDropColumn() { return false; }
function hasSRFs() { return true; }
function hasOpClasses() { return true; }
- function hasUserSessionDefaults() { return false; }
- function hasUserRename() { return false; }
function hasFunctionRename() { return true; }
}
* A class that implements the DB interface for Postgres
* Note: This class uses ADODB and returns RecordSets.
*
- * $Id: Postgres72.php,v 1.64 2004/05/14 07:56:38 chriskl Exp $
+ * $Id: Postgres72.php,v 1.65 2004/05/19 01:28:34 soranzo Exp $
*/
// Administration functions
+ /**
+ * Vacuums a database
+ * @param $table The table to vacuum
+ * @param $analyze If true, also does analyze
+ * @param $full If true, selects "full" vacuum (PostgreSQL >= 7.2)
+ * @param $freeze If true, selects aggressive "freezing" of tuples (PostgreSQL >= 7.2)
+ */
+ function vacuumDB($table = '', $analyze = false, $full = false, $freeze = false) {
+ $sql = "VACUUM";
+ if ($full) $sql .= " FULL";
+ if ($freeze) $sql .= " FREEZE";
+ if ($analyze) $sql .= " ANALYZE";
+ if ($table != '') {
+ $this->fieldClean($table);
+ $sql .= " \"{$table}\"";
+ }
+
+ return $this->execute($sql);
+ }
+
/**
* Analyze a database
* @note PostgreSQL 7.2 finally had an independent ANALYZE command
function hasPartialIndexes() { return true; }
function hasProcesses() { return true; }
function hasStatsCollector() { return true; }
+ function hasFullVacuum() { return true; }
}
* A class that implements the DB interface for Postgres
* Note: This class uses ADODB and returns RecordSets.
*
- * $Id: Postgres73.php,v 1.107 2004/05/16 15:42:30 chriskl Exp $
+ * $Id: Postgres73.php,v 1.108 2004/05/19 01:28:34 soranzo Exp $
*/
// @@@ THOUGHT: What about inherits? ie. use of ONLY???
return $this->selectSet($sql);
}
-
- /**
- * Clusters an index
- * @param $index The name of the index
- * @param $table The table the index is on
- * @param $analyze True to run analyze afterward, false otherwise
- * @return 0 success
- */
- function clusterIndex($index, $table, $analyze) {
- $this->fieldClean($index);
- $this->fieldClean($table);
-
- // We don't bother with a transaction here, as there's no point rolling
- // back an expensive cluster if a cheap analyze fails for whatever reason
- $sql = "CLUSTER \"{$index}\" ON \"{$table}\"";
- $status = $this->execute($sql);
- if ($status != 0) return $status;
-
- if ($analyze) {
- $sql = "ANALYZE \"{$table}\"";
- return $this->execute($sql);
- }
- else
- return $status;
- }
/**
* Grabs a single trigger
}
// Constraint functions
+
/**
- * A function for getting all linking fields on the foreign keys based on the table names
- * @param $table array of table names
- * @return an array of linked tables and fields
+ * A function for getting all columns linked by foreign keys given a group of tables
+ * @param $tables Array of table names
+ * @return An array of linked tables and columns
+ * @return -1 $tables isn't an array\r
*/
- function &getLinkingKeys($arrTables) {
- $this->arrayClean($arrTables);
+ function &getLinkingKeys($tables) {
+ if (!is_array($tables)) return -1;
+
+ $this->arrayClean($tables);
+ $tables_list = "'" . implode("', '", $tables) . "'";
$maxDimension = 1;
-
- // Properly quote the tables
- $tables = "'" . implode("', '", $arrTables) . "'";
-
- //7.3 requires some workarounds since ANY doesn't support arrays
+
$sql = "
SELECT DISTINCT
array_dims(pc.conkey) AS arr_dim,
- pgc1.relname AS p_table
- FROM
+ pgc1.relname AS p_table
+ FROM
pg_catalog.pg_constraint AS pc,
- pg_catalog.pg_class AS pgc1
- WHERE
+ pg_catalog.pg_class AS pgc1
+ WHERE
pc.contype = 'f'
AND (pc.conrelid = pgc1.relfilenode OR pc.confrelid = pgc1.relfilenode)
- AND pgc1.relname IN ($tables)
+ AND pgc1.relname IN ($tables_list)
";
//parse our output for find the highest dimension of foreign keys since pc.conkey is stored in an array
$maxDimension = $tmpDimension > $maxDimension ? $tmpDimension : $maxDimension;
$rs->MoveNext();
}
-
- //we know the highest index for foreign keys thaat conkey goes up to, expand for us in an IN query
- $cons_str = '( (pfield.attnum = conkey[1] AND cfield.attnum = confkey[1]) ';
+
+ //we know the highest index for foreign keys that conkey goes up to, expand for us in an IN query
+ $cons_str = '( (pfield.attnum = conkey[1] AND cfield.attnum = confkey[1]) ';
for ($i = 2; $i <= $maxDimension; $i++) {
- $cons_str .= "OR (pfield.attnum = conkey[{$i}] AND cfield.attnum = confkey[{$i}]) ";
+ $cons_str .= "OR (pfield.attnum = conkey[{$i}] AND cfield.attnum = confkey[{$i}]) ";
}
$cons_str .= ') ';
-
+
$sql = "
- SELECT
- pgc1.relname AS p_table,
+ SELECT
+ pgc1.relname AS p_table,
pgc2.relname AS f_table,
pfield.attname AS p_field,
- cfield.attname AS f_field
+ cfield.attname AS f_field
FROM
pg_catalog.pg_constraint AS pc,
pg_catalog.pg_class AS pgc1,
pg_catalog.pg_attribute AS pfield,
pg_catalog.pg_attribute AS cfield
WHERE
- pc.contype = 'f'
+ pc.contype = 'f'
AND pc.conrelid = pgc1.relfilenode
AND pc.confrelid = pgc2.relfilenode
AND pfield.attrelid = pc.conrelid
AND cfield.attrelid = pc.confrelid
- AND $cons_str
- AND pgc1.relname IN ($tables)
- AND pgc2.relname IN ($tables)
+ AND $cons_str
+ AND pgc1.relname IN ($tables_list)
+ AND pgc2.relname IN ($tables_list)
AND pgc1.relnamespace = (SELECT oid FROM pg_catalog.pg_namespace
WHERE nspname='{$this->_schema}')
";
- return $this->selectSet($sql);
+ return $this->selectSet($sql);
}
/**
// Capabilities
function hasSchemas() { return true; }
function hasConversions() { return true; }
- function hasCluster() { return true; }
+ function hasIsClustered() { return true; }
function hasDropBehavior() { return true; }
function hasDropColumn() { return true; }
function hasDomains() { return true; }
* A class that implements the DB interface for Postgres
* Note: This class uses ADODB and returns RecordSets.
*
- * $Id: Postgres74.php,v 1.30 2004/05/14 01:16:14 soranzo Exp $
+ * $Id: Postgres74.php,v 1.31 2004/05/19 01:28:35 soranzo Exp $
*/
include_once('./classes/database/Postgres73.php');
return $this->selectSet($sql);
}
-
+
+ // Administration functions
+
+ /**
+ * Recluster a table or all the tables in the current database
+ * @param $table (optional) The table to recluster
+ */
+ function recluster($table = '') {
+ if ($table != '') {
+ $this->fieldClean($table);
+ $sql = "CLUSTER \"{$table}\"";
+ }
+ else
+ $sql = "CLUSTER";
+
+ return $this->execute($sql);
+ }
+
// Domain functions
/**
function hasUserRename() { return true; }
function hasFunctionRename() { return true; }
function hasSchemaDump() { return true; }
+ function hasRecluster() { return true; }
}
/**
* List constraints on a table
*
- * $Id: constraints.php,v 1.27 2004/05/09 06:21:26 chriskl Exp $
+ * $Id: constraints.php,v 1.28 2004/05/19 01:28:34 soranzo Exp $
*/
// Include application functions
if ($confirm) {
// Default analyze to on
- if ($action == 'confirm_cluster_constraint') $_REQUEST['analyze'] = 'on';
+ $_REQUEST['analyze'] = true;
echo "<h2>", $misc->printVal($_REQUEST['database']), ": {$lang['strtables']}: ",
$misc->printVal($_REQUEST['table']), ": " , $misc->printVal($_REQUEST['constraint']), ": {$lang['strcluster']}</h2>\n";
echo "<p>", sprintf($lang['strconfcluster'], $misc->printVal($_REQUEST['constraint'])), "</p>\n";
echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
+ echo "<p><input type=\"checkbox\" name=\"analyze\"", (isset($_REQUEST['analyze']) ? ' checked="checked"' : ''), " /> {$lang['stranalyze']}</p>\n";
echo "<input type=\"hidden\" name=\"action\" value=\"cluster_constraint\" />\n";
echo "<input type=\"hidden\" name=\"table\" value=\"", htmlspecialchars($_REQUEST['table']), "\" />\n";
echo "<input type=\"hidden\" name=\"constraint\" value=\"", htmlspecialchars($_REQUEST['constraint']), "\" />\n";
echo $misc->form;
- echo "<p><input type=\"checkbox\" name=\"analyze\"", (isset($_REQUEST['analyze']) ? ' checked="checked"' : ''), " /> {$lang['stranalyze']}</p>\n";
echo "<input type=\"submit\" name=\"cluster\" value=\"{$lang['strcluster']}\" />\n";
echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" />\n";
echo "</form>\n";
}
else {
- $status = $data->clusterIndex($_POST['constraint'], $_POST['table'], isset($_POST['analyze']));
+ $status = $data->clusterIndex($_POST['constraint'], $_POST['table']);
if ($status == 0)
- doDefault($lang['strclusteredgood'] . ((isset($_POST['analyze']) ? ' ' . $lang['stranalyzegood'] : '')));
+ if (isset($_POST['analyze'])) {
+ $status = $data->analyzeDB($_POST['table']);
+ if ($status == 0)
+ doDefault($lang['strclusteredgood'] . ' ' . $lang['stranalyzegood']);
+ else
+ doDefault($lang['stranalyzebad']);
+ } else
+ doDefault($lang['strclusteredgood']);
else
doDefault($lang['strclusteredbad']);
}
}
+ function doReindex() {
+ global $data, $lang;
+
+ $status = $data->reindex('INDEX', $_REQUEST['constraint']);
+ if ($status == 0)
+ doDefault($lang['strreindexgood']);
+ else
+ doDefault($lang['strreindexbad']);
+ }
+
/**
* Confirm and then actually add a FOREIGN KEY constraint
*/
if ($constraints->recordCount() > 0) {
echo "<table>\n";
echo "<tr><th class=\"data\">{$lang['strname']}</th><th class=\"data\">{$lang['strdefinition']}</th>\n";
- if ($data->hasCluster()) {
+ if ($data->hasIsClustered()) {
echo "<th class=\"data\">{$lang['strclustered']}</th>";
- echo "<th class=\"data\" colspan=\"2\">{$lang['stractions']}</th>\n";
- }
- else {
- echo "<th class=\"data\">{$lang['stractions']}</th>\n";
}
+ echo "<th class=\"data\" colspan=\"3\">{$lang['stractions']}</th>\n";
echo "</tr>\n";
$i = 0;
echo ")";
}
echo "</td>";
- if ($data->hasCluster()) {
- if ($constraints->f['indisclustered'] !== null) {
+ if ($data->hasIsClustered()) {
+ if ($constraints->f['contype'] == 'u' || $constraints->f['contype'] == 'p') {
$constraints->f['indisclustered'] = $data->phpBool($constraints->f['indisclustered']);
echo "<td class=\"data{$id}\">", ($constraints->f['indisclustered'] ? $lang['stryes'] : $lang['strno']), "</td>";
} else {
echo "<td class=\"data{$id}\"></td>";
}
}
+ // You can only cluster primary key and unique constraints!
+ if ($constraints->f['contype'] == 'u' || $constraints->f['contype'] == 'p') {
+ echo "<td class=\"opbutton{$id}\">";
+ echo "<a href=\"$PHP_SELF?action=confirm_cluster_constraint&{$misc->href}&constraint=",
+ urlencode($constraints->f[$data->cnFields['conname']]),
+ "&table=", urlencode($_REQUEST['table']), "\">{$lang['strcluster']}</a></td>";
+ echo "<td class=\"opbutton{$id}\">";
+ echo "<a href=\"$PHP_SELF?action=reindex&{$misc->href}&constraint=",
+ urlencode($constraints->f[$data->cnFields['conname']]),
+ "&table=", urlencode($_REQUEST['table']), "\">{$lang['strreindex']}</a></td>";
+ }
+ else {
+ echo "<td class=\"data{$id}\"></td>";
+ echo "<td class=\"data{$id}\"></td>";
+ }
echo "<td class=\"opbutton{$id}\">";
echo "<a href=\"$PHP_SELF?action=confirm_drop&{$misc->href}&constraint=", urlencode($constraints->f[$data->cnFields['conname']]),
"&table=", urlencode($_REQUEST['table']), "&type=", urlencode($constraints->f['contype']), "\">{$lang['strdrop']}</td>";
- if ($data->hasCluster()) {
- echo "<td class=\"opbutton{$id}\">";
- // You can only cluster primary key and unique constraints!
- if ($constraints->f['contype'] == 'u' || $constraints->f['contype'] == 'p') {
- echo "<a href=\"$PHP_SELF?action=confirm_cluster_constraint&{$misc->href}&constraint=", urlencode($constraints->f[$data->cnFields['conname']]),
- "&table=", urlencode($_REQUEST['table']), "\">{$lang['strcluster']}</a>";
- }
- echo "</td>\n";
-
- }
echo "</tr>\n";
$constraints->moveNext();
case 'confirm_cluster_constraint':
doClusterIndex(true);
break;
+ case 'reindex':
+ doReindex();
+ break;
case 'add_foreign_key':
addForeignKey(1);
break;
/**
* Manage schemas within a database
*
- * $Id: database.php,v 1.42 2004/05/16 15:40:20 chriskl Exp $
+ * $Id: database.php,v 1.43 2004/05/19 01:28:34 soranzo Exp $
*/
// Include application functions
if ($status == 0) doAdmin('', $lang['stranalyzegood']);
else doAdmin('', $lang['stranalyzebad']);
break;
- case 'cluster':
- $status = $data->analyzeDB();
+ case 'recluster':
+ $status = $data->recluster();
if ($status == 0) doAdmin('', $lang['strclusteredgood']);
- else doAdmin('', $lang['strclusterbad']);
+ else doAdmin('', $lang['strclusteredbad']);
break;
case 'reindex';
- $status = $data->analyzeDB();
+ $status = $data->reindex('DATABASE', $_REQUEST['database'], isset($_REQUEST['reindex_force']));
if ($status == 0) doAdmin('', $lang['strreindexgood']);
else doAdmin('', $lang['strreindexbad']);
break;
echo "<form name=\"adminfrm\" id=\"adminfrm\" action=\"{$PHP_SELF}\" method=\"post\">\n";
echo "<h3>{$lang['strvacuum']}</h3>\n";
echo "<input type=\"checkbox\" id=\"vacuum_analyze\" name=\"vacuum_analyze\" />{$lang['stranalyze']}<br />\n";
- echo "<input type=\"checkbox\" id=\"vacuum_full\" name=\"vacuum_full\" />{$lang['strfull']}<br />\n";
- echo "<input type=\"checkbox\" id=\"vacuum_freeze\" name=\"vacuum_freeze\" />{$lang['strfreeze']}<br />\n";
+ if ($data->hasFullVacuum()) {
+ echo "<input type=\"checkbox\" id=\"vacuum_full\" name=\"vacuum_full\" />{$lang['strfull']}<br />\n";
+ echo "<input type=\"checkbox\" id=\"vacuum_freeze\" name=\"vacuum_freeze\" />{$lang['strfreeze']}<br />\n";
+ }
echo "<input type=\"submit\" value=\"{$lang['strvacuum']}\" />\n";
echo "<input type=\"hidden\" name=\"action\" value=\"vacuum\" />\n";
echo $misc->form;
echo $misc->form;
echo "</form>\n";
- // Cluster
- echo "<form name=\"adminfrm\" id=\"adminfrm\" action=\"{$PHP_SELF}\" method=\"post\">\n";
- echo "<h3>{$lang['strcluster']}</h3>\n";
- echo "<input type=\"submit\" value=\"{$lang['strcluster']}\" />\n";
- echo "<input type=\"hidden\" name=\"action\" value=\"cluster\" />\n";
- echo $misc->form;
- echo "</form>\n";
+ // Recluster
+ if ($data->hasRecluster()){
+ echo "<form name=\"adminfrm\" id=\"adminfrm\" action=\"{$PHP_SELF}\" method=\"post\">\n";
+ echo "<h3>{$lang['strcluster']}</h3>\n";
+ echo "<input type=\"submit\" value=\"{$lang['strcluster']}\" />\n";
+ echo "<input type=\"hidden\" name=\"action\" value=\"recluster\" />\n";
+ echo $misc->form;
+ echo "</form>\n";
+ }
// Reindex
echo "<form name=\"adminfrm\" id=\"adminfrm\" action=\"{$PHP_SELF}\" method=\"post\">\n";
if (isset($_GET['term'])) doFind(false);
else doFind(true);
break;
- case 'cluster':
+ case 'recluster':
case 'reindex':
case 'analyze':
case 'vacuum':
/**
* List indexes on a table
*
- * $Id: indexes.php,v 1.23 2004/05/11 07:12:09 chriskl Exp $
+ * $Id: indexes.php,v 1.24 2004/05/19 01:28:34 soranzo Exp $
*/
// Include application functions
if ($confirm) {
// Default analyze to on
- if ($action == 'confirm_cluster_index') $_REQUEST['analyze'] = 'on';
+ $_REQUEST['analyze'] = true;
echo "<h2>", $misc->printVal($_REQUEST['database']), ": {$lang['strtables']}: ",
$misc->printVal($_REQUEST['table']), ": " , $misc->printVal($_REQUEST['index']), ": {$lang['strcluster']}</h2>\n";
echo "<p>", sprintf($lang['strconfcluster'], $misc->printVal($_REQUEST['index'])), "</p>\n";
echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
+ echo "<p><input type=\"checkbox\" name=\"analyze\"", (isset($_REQUEST['analyze']) ? ' checked="checked"' : ''), " /> {$lang['stranalyze']}</p>\n";
echo "<input type=\"hidden\" name=\"action\" value=\"cluster_index\" />\n";
echo "<input type=\"hidden\" name=\"table\" value=\"", htmlspecialchars($_REQUEST['table']), "\" />\n";
echo "<input type=\"hidden\" name=\"index\" value=\"", htmlspecialchars($_REQUEST['index']), "\" />\n";
echo $misc->form;
- echo "<p><input type=\"checkbox\" name=\"analyze\"", (isset($_REQUEST['analyze']) ? ' checked="checked"' : ''), " /> {$lang['stranalyze']}</p>\n";
echo "<input type=\"submit\" name=\"cluster\" value=\"{$lang['strcluster']}\" />\n";
echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" />\n";
echo "</form>\n";
}
else {
- $status = $data->clusterIndex($_POST['index'], $_POST['table'], isset($_POST['analyze']));
+ $status = $data->clusterIndex($_POST['index'], $_POST['table']);
if ($status == 0)
- doDefault($lang['strclusteredgood'] . ((isset($_POST['analyze']) ? ' ' . $lang['stranalyzegood'] : '')));
+ if (isset($_POST['analyze'])){
+ $status = $data->analyzeDB($_POST['table']);
+ if ($status == 0)
+ doDefault($lang['strclusteredgood'] . ' ' . $lang['stranalyzegood']);
+ else
+ doDefault($lang['stranalyzebad']);
+ } else
+ doDefault($lang['strclusteredgood']);
else
doDefault($lang['strclusteredbad']);
}
}
+ function doReindex() {
+ global $data, $lang;
+
+ $status = $data->reindex('INDEX', $_REQUEST['index']);
+ if ($status == 0)
+ doDefault($lang['strreindexgood']);
+ else
+ doDefault($lang['strreindexbad']);
+ }
+
/**
* Displays a screen where they can enter a new index
*/
echo "<table>\n";
echo "<tr>\n";
echo "<th class=\"data\">{$lang['strname']}</th><th class=\"data\">{$lang['strdefinition']}</th>";
- if ($data->hasCluster()) {
+ if ($data->hasIsClustered()) {
echo "<th class=\"data\">{$lang['strclustered']}</th>";
- echo "<th class=\"data\" colspan=\"2\">{$lang['stractions']}</th>\n";
- }
- else {
- echo "<th class=\"data\">{$lang['stractions']}</th>\n";
}
+ echo "<th class=\"data\" colspan=\"3\">{$lang['stractions']}</th>\n";
echo "</tr>\n";
$i = 0;
$id = ( ($i % 2 ) == 0 ? '1' : '2' );
echo "<tr><td class=\"data{$id}\">", $misc->printVal( $indexes->f[$data->ixFields['idxname']]), "</td>";
echo "<td class=\"data{$id}\">", $misc->printVal( $indexes->f[$data->ixFields['idxdef']]), "</td>";
- if ($data->hasCluster()) {
+ if ($data->hasIsClustered()) {
$indexes->f['indisclustered'] = $data->phpBool($indexes->f['indisclustered']);
echo "<td class=\"data{$id}\">", ($indexes->f['indisclustered'] ? $lang['stryes'] : $lang['strno']), "</td>";
}
echo "<td class=\"opbutton{$id}\">";
+ echo "<a href=\"$PHP_SELF?action=confirm_cluster_index&{$misc->href}&index=", urlencode( $indexes->f[$data->ixFields['idxname']]),
+ "&table=", urlencode($_REQUEST['table']), "\">{$lang['strcluster']}</a></td>";
+ echo "<td class=\"opbutton{$id}\">";
+ echo "<a href=\"$PHP_SELF?action=reindex&{$misc->href}&index=", urlencode( $indexes->f[$data->ixFields['idxname']]),
+ "&table=", urlencode($_REQUEST['table']), "\">{$lang['strreindex']}</a></td>";
+ echo "<td class=\"opbutton{$id}\">";
echo "<a href=\"$PHP_SELF?action=confirm_drop_index&{$misc->href}&index=", urlencode( $indexes->f[$data->ixFields['idxname']]),
- "&table=", urlencode($_REQUEST['table']), "\">{$lang['strdrop']}</td>";
- if ($data->hasCluster()) {
- echo "<td class=\"opbutton{$id}\">";
- echo "<a href=\"$PHP_SELF?action=confirm_cluster_index&{$misc->href}&index=", urlencode( $indexes->f[$data->ixFields['idxname']]),
- "&table=", urlencode($_REQUEST['table']), "\">{$lang['strcluster']}</td>";
- }
+ "&table=", urlencode($_REQUEST['table']), "\">{$lang['strdrop']}</a></td>";
echo "</tr>\n";
$indexes->movenext();
case 'confirm_cluster_index':
doClusterIndex(true);
break;
+ case 'reindex':
+ doReindex();
+ break;
case 'save_create_index':
if (isset($_POST['cancel'])) doDefault();
else doSaveCreateIndex();