Adds vacuum of a specific table
authorxzilla <xzilla>
Wed, 25 Aug 2004 17:23:20 +0000 (17:23 +0000)
committerxzilla <xzilla>
Wed, 25 Aug 2004 17:23:20 +0000 (17:23 +0000)
lang/english.php
lang/recoded/english.php
tables.php

index 92ef05e9804e5471c423c6ec11958c65dc7dcc13..e4610fc319e5d28413825192e7bc4555a08bb25b 100755 (executable)
@@ -4,7 +4,7 @@
         * English language file for phpPgAdmin.  Use this as a basis
         * for new translations.
         *
-        * $Id: english.php,v 1.161 2004/08/22 00:06:34 soranzo Exp $
+        * $Id: english.php,v 1.162 2004/08/25 17:23:20 xzilla Exp $
         */
 
        // Language and character set
        $lang['strstructureanddata'] = 'Structure and data';
        $lang['strtabbed'] = 'Tabbed';
        $lang['strauto'] = 'Auto';
+       $lang['strconfvacuumtable'] = 'Are you sure you want to vacuum "%s"?';
 
        // Users
        $lang['struser'] = 'User';
index 615c471ffc2b8f0ad9dabbf0bc88eaa542d78a2b..0c7e6982ac4885c8074935d496b22772351a3325 100644 (file)
@@ -4,9 +4,10 @@
         * English language file for phpPgAdmin.  Use this as a basis
         * for new translations.
         *
-        * $Id: english.php,v 1.113 2004/08/22 00:06:34 soranzo Exp $
+        * $Id: english.php,v 1.114 2004/08/25 17:23:21 xzilla Exp $
         */
 
+       $lang['strconfvacuumtable'] = 'Are you sure you want to vacuum "%s"?';
        // Language and character set
        $lang['applang'] = 'English';
        $lang['appcharset'] = 'ISO-8859-1';
index 23d67b2f9244d0df6b1a92a4422e4dc731ef0562..cdfe99b1a147dd86a718cffdaa7ba128e227ac21 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * List tables in a database
         *
-        * $Id: tables.php,v 1.61 2004/08/22 00:06:33 soranzo Exp $
+        * $Id: tables.php,v 1.62 2004/08/25 17:23:20 xzilla Exp $
         */
 
        // Include application functions
                
        }
 
+
+       /**
+        * Show confirmation of vacuum and perform actual vacuum
+        */
+       function doVacuum($confirm) {
+               global $data, $misc;
+               global $lang, $_reload_browser;
+               global $PHP_SELF;
+
+               if ($confirm) {
+                       $misc->printTitle(array($misc->printVal($_REQUEST['database']), $lang['strtables'], $misc->printVal($_REQUEST['table']), $lang['strvacuum']), '');
+
+                       echo "<p>", sprintf($lang['strconfvacuumtable'], $misc->printVal($_REQUEST['table'])), "</p>\n";
+
+                       echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
+                       echo "<input type=\"hidden\" name=\"action\" value=\"vacuum\" />\n";
+                       echo "<input type=\"hidden\" name=\"table\" value=\"", htmlspecialchars($_REQUEST['table']), "\" />\n";
+                       echo $misc->form;
+                       // Show vacuum full option if supportd
+                       if ($data->hasFullVacuum()) {
+                               echo "<p><input type=\"checkbox\" name=\"vacuum_full\" /> {$lang['strfull']}</p>\n";
+                               echo "<p><input type=\"checkbox\" name=\"vacuum_analyze\" /> {$lang['stranalyze']}</p>\n";
+                       }
+                       echo "<input type=\"submit\" name=\"vacuum\" value=\"{$lang['strvacuum']}\" />\n";
+                       echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" />\n";
+                       echo "</form>\n";
+               }
+               else {
+                       $status = $data->vacuumDB($_POST['table'], isset($_REQUEST['vacuum_analyze']), isset($_REQUEST['vacuum_full']), '');
+                       if ($status == 0) {
+                               $_reload_browser = true;
+                               doDefault($lang['strvacuumgood']);
+                       }
+                       else
+                               doDefault($lang['strvacuumbad']);
+               }
+               
+       }
+
        /**
         * Show default list of tables in the database
         */
                                'url'   => "{$PHP_SELF}?action=confirm_drop&amp;{$misc->href}&amp;",
                                'vars'  => array('table' => 'relname'),
                        ),
-               );
+                       'vacuum' => array(
+                               'title' => $lang['strvacuum'],
+                               'url'   => "{$PHP_SELF}?action=confirm_vacuum&amp;{$misc->href}&amp;",
+                               'vars'  => array('table' => 'relname'),
+                       ),
+       );
                
                if (!$data->hasTablespaces()) unset($columns['tablespace']);
 
                case 'confirm_drop':
                        doDrop(true);
                        break;
+               case 'vacuum':
+                       if (isset($_POST['vacuum'])) doVacuum(false);
+                       else doDefault();
+                       break;
+               case 'confirm_vacuum':
+                       doVacuum(true);
+                       break;
                default:
                        doDefault();
                        break;