optimize many tables
This commit is contained in:
@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
|
|||||||
$Id$
|
$Id$
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
|
2002-02-02 Marc Delisle <lem9@users.sourceforge.net>
|
||||||
|
* db_stats.php3, db_details.php3, mult_submits.inc.php3,
|
||||||
|
tbl_properties.php3: Button to optimize many tables
|
||||||
|
|
||||||
2002-02-01 Marc Delisle <lem9@users.sourceforge.net>
|
2002-02-01 Marc Delisle <lem9@users.sourceforge.net>
|
||||||
* tbl_properties.inc.php3, add a link to doc for column types
|
* tbl_properties.inc.php3, add a link to doc for column types
|
||||||
|
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets some core libraries
|
* Gets some core libraries
|
||||||
*/
|
*/
|
||||||
@@ -23,7 +22,7 @@ $err_url = 'db_details.php3'
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensures the database exists (else move to the "parent" script) and diplays
|
* Ensures the database exists (else move to the "parent" script) and displays
|
||||||
* headers
|
* headers
|
||||||
*/
|
*/
|
||||||
if (!isset($is_db) || !$is_db) {
|
if (!isset($is_db) || !$is_db) {
|
||||||
@@ -62,7 +61,7 @@ window.parent.frames['nav'].location.replace('./left.php3?lang=<?php echo $lang;
|
|||||||
* Drop/delete multiple tables if required
|
* Drop/delete multiple tables if required
|
||||||
*/
|
*/
|
||||||
if ((!empty($submit_mult) && isset($selected_tbl))
|
if ((!empty($submit_mult) && isset($selected_tbl))
|
||||||
|| isset($mult_btnDrop)) {
|
|| isset($mult_btn)) {
|
||||||
$action = 'db_details.php3';
|
$action = 'db_details.php3';
|
||||||
include('./mult_submits.inc.php3');
|
include('./mult_submits.inc.php3');
|
||||||
}
|
}
|
||||||
@@ -349,6 +348,8 @@ else if (PMA_MYSQL_INT_VERSION >= 32300) {
|
|||||||
<input type="submit" name="submit_mult" value="<?php echo $strEmpty; ?>" />
|
<input type="submit" name="submit_mult" value="<?php echo $strEmpty; ?>" />
|
||||||
<i><?php echo $strOr; ?></i>
|
<i><?php echo $strOr; ?></i>
|
||||||
<input type="submit" name="submit_mult" value="<?php echo $strPrintView; ?>" />
|
<input type="submit" name="submit_mult" value="<?php echo $strPrintView; ?>" />
|
||||||
|
<i><?php echo $strOr; ?></i>
|
||||||
|
<input type="submit" name="submit_mult" value="<?php echo $strOptimizeTable; ?>" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
@@ -12,7 +12,7 @@ require('./header.inc.php3');
|
|||||||
* Drop databases if required
|
* Drop databases if required
|
||||||
*/
|
*/
|
||||||
if ((!empty($submit_mult) && isset($selected_db))
|
if ((!empty($submit_mult) && isset($selected_db))
|
||||||
|| isset($mult_btnDrop)) {
|
|| isset($mult_btn)) {
|
||||||
$err_url = 'db_stats.php3'
|
$err_url = 'db_stats.php3'
|
||||||
. '?lang=' . $lang
|
. '?lang=' . $lang
|
||||||
. '&server=' . $server;
|
. '&server=' . $server;
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Confirmation form if required or include of other scripts
|
* Confirmation form if required or include of other scripts
|
||||||
*/
|
*/
|
||||||
@@ -19,8 +18,18 @@ if (!empty($submit_mult)
|
|||||||
include('./tbl_printview.php3');
|
include('./tbl_printview.php3');
|
||||||
exit();
|
exit();
|
||||||
} else {
|
} else {
|
||||||
$selected = $selected_tbl;
|
$selected = $selected_tbl;
|
||||||
$what = (($submit_mult == $strDrop) ? 'drop_tbl' : 'empty_tbl');
|
switch ($submit_mult) {
|
||||||
|
case $strDrop:
|
||||||
|
$what = 'drop_tbl';
|
||||||
|
break;
|
||||||
|
case $strEmpty:
|
||||||
|
$what = 'empty_tbl';
|
||||||
|
break;
|
||||||
|
case $strOptimizeTable:
|
||||||
|
$what = 'optimize_tbl';
|
||||||
|
break;
|
||||||
|
} // end switch
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$selected = $selected_fld;
|
$selected = $selected_fld;
|
||||||
@@ -49,6 +58,12 @@ if (!empty($submit_mult)
|
|||||||
. (($i == $selected_cnt - 1) ? ';<br />' : '');
|
. (($i == $selected_cnt - 1) ? ';<br />' : '');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'optimize_tbl':
|
||||||
|
$full_query .= (empty($full_query) ? 'OPTIMIZE TABLE ' : ', ')
|
||||||
|
. PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
|
||||||
|
. (($i == $selected_cnt - 1) ? ';<br />' : '');
|
||||||
|
break;
|
||||||
|
|
||||||
case 'empty_tbl':
|
case 'empty_tbl':
|
||||||
$full_query .= 'DELETE FROM '
|
$full_query .= 'DELETE FROM '
|
||||||
. PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
|
. PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
|
||||||
@@ -94,8 +109,8 @@ if (!empty($submit_mult)
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<input type="hidden" name="query_type" value="<?php echo $what; ?>" />
|
<input type="hidden" name="query_type" value="<?php echo $what; ?>" />
|
||||||
<input type="submit" name="mult_btnDrop" value="<?php echo $strYes; ?>" />
|
<input type="submit" name="mult_btn" value="<?php echo $strYes; ?>" />
|
||||||
<input type="submit" name="mult_btnDrop" value="<?php echo $strNo; ?>" />
|
<input type="submit" name="mult_btn" value="<?php echo $strNo; ?>" />
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
echo"\n";
|
echo"\n";
|
||||||
@@ -107,8 +122,8 @@ if (!empty($submit_mult)
|
|||||||
/**
|
/**
|
||||||
* Executes the query
|
* Executes the query
|
||||||
*/
|
*/
|
||||||
else if ((get_magic_quotes_gpc() && stripslashes($mult_btnDrop) == $strYes)
|
else if ((get_magic_quotes_gpc() && stripslashes($mult_btn) == $strYes)
|
||||||
|| $mult_btnDrop == $strYes) {
|
|| $mult_btn == $strYes) {
|
||||||
|
|
||||||
$sql_query = '';
|
$sql_query = '';
|
||||||
$selected_cnt = count($selected);
|
$selected_cnt = count($selected);
|
||||||
@@ -127,6 +142,12 @@ else if ((get_magic_quotes_gpc() && stripslashes($mult_btnDrop) == $strYes)
|
|||||||
$reload = 1;
|
$reload = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'optimize_tbl':
|
||||||
|
$sql_query .= (empty($sql_query) ? 'OPTIMIZE TABLE ' : ', ')
|
||||||
|
. PMA_backquote(urldecode($selected[$i]))
|
||||||
|
. (($i == $selected_cnt-1) ? ';' : '');
|
||||||
|
break;
|
||||||
|
|
||||||
case 'empty_tbl':
|
case 'empty_tbl':
|
||||||
$a_query = 'DELETE FROM '
|
$a_query = 'DELETE FROM '
|
||||||
. PMA_backquote(urldecode($selected[$i]));
|
. PMA_backquote(urldecode($selected[$i]));
|
||||||
@@ -139,8 +160,11 @@ else if ((get_magic_quotes_gpc() && stripslashes($mult_btnDrop) == $strYes)
|
|||||||
break;
|
break;
|
||||||
} // end switch
|
} // end switch
|
||||||
|
|
||||||
// All "DROP TABLE" and "DROP FIELD" statements will be run at once below
|
// All "DROP TABLE","DROP FIELD" and "OPTIMIZE TABLE" statements
|
||||||
if ($query_type != 'drop_tbl' && $query_type != 'drop_fld') {
|
// will be run at once below
|
||||||
|
if ($query_type != 'drop_tbl'
|
||||||
|
&& $query_type != 'drop_fld'
|
||||||
|
&& $query_type != 'optimize_tbl') {
|
||||||
$sql_query .= $a_query . ';' . "\n";
|
$sql_query .= $a_query . ';' . "\n";
|
||||||
|
|
||||||
if ($query_type != 'drop_db') {
|
if ($query_type != 'drop_db') {
|
||||||
@@ -150,7 +174,9 @@ else if ((get_magic_quotes_gpc() && stripslashes($mult_btnDrop) == $strYes)
|
|||||||
} // end if
|
} // end if
|
||||||
} // end for
|
} // end for
|
||||||
|
|
||||||
if ($query_type == 'drop_tbl' || $query_type == 'drop_fld') {
|
if ($query_type == 'drop_tbl'
|
||||||
|
|| $query_type == 'drop_fld'
|
||||||
|
|| $query_type == 'optimize_tbl') {
|
||||||
mysql_select_db($db);
|
mysql_select_db($db);
|
||||||
$result = @mysql_query($sql_query) or PMA_mysqlDie('', '', FALSE, $err_url);
|
$result = @mysql_query($sql_query) or PMA_mysqlDie('', '', FALSE, $err_url);
|
||||||
}
|
}
|
||||||
|
@@ -64,7 +64,7 @@ if (!isset($message)) {
|
|||||||
* Drop/delete mutliple tables if required
|
* Drop/delete mutliple tables if required
|
||||||
*/
|
*/
|
||||||
if ((!empty($submit_mult) && isset($selected_fld))
|
if ((!empty($submit_mult) && isset($selected_fld))
|
||||||
|| isset($mult_btnDrop)) {
|
|| isset($mult_btn)) {
|
||||||
$action = 'tbl_properties.php3';
|
$action = 'tbl_properties.php3';
|
||||||
include('./mult_submits.inc.php3');
|
include('./mult_submits.inc.php3');
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user