Partial implementation of autovacuum editor. Does the display, edit link, and page...
authorxzilla <xzilla>
Fri, 17 Mar 2006 21:14:30 +0000 (21:14 +0000)
committerxzilla <xzilla>
Fri, 17 Mar 2006 21:14:30 +0000 (21:14 +0000)
classes/database/Postgres.php
classes/database/Postgres81.php
database.php
lang/english.php
lang/recoded/english.php

index d8d74cb540dd507ba4f34754554f4022aa6c9ea5..d0d2ff3188b2f1099bdbf3ea86b2b9b1ca9897f6 100755 (executable)
@@ -4,7 +4,7 @@
  * A class that implements the DB interface for Postgres
  * Note: This class uses ADODB and returns RecordSets.
  *
- * $Id: Postgres.php,v 1.281 2006/01/06 21:06:57 xzilla Exp $
+ * $Id: Postgres.php,v 1.282 2006/03/17 21:14:30 xzilla Exp $
  */
 
 // @@@ THOUGHT: What about inherits? ie. use of ONLY???
@@ -4513,6 +4513,7 @@ class Postgres extends ADODB_base {
        function hasReadOnlyQueries() { return false; }
        function hasFuncPrivs() { return false; }
        function hasServerAdminFuncs() { return false; }
+       function hasAutovacuum() { return false; }
 
 }
 
index 3f4bac95f62eaaba095ce3f4f55523bac5224266..4237ee4f42c24021315b7c78902535c365d33a58 100644 (file)
@@ -3,7 +3,7 @@
 /**
  * PostgreSQL 8.1 support
  *
- * $Id: Postgres81.php,v 1.4 2006/01/06 21:06:57 xzilla Exp $
+ * $Id: Postgres81.php,v 1.5 2006/03/17 21:14:30 xzilla Exp $
  */
 
 include_once('./classes/database/Postgres80.php');
@@ -110,10 +110,21 @@ class Postgres81 extends Postgres80 {
                return $this->selectSet($sql);
        }
 
+       /**
+        * Returns all available process information.
+        * @param $database (optional) Find only connections to specified database
+        * @return A recordset
+        */
+       function getAutovacuum() {
+               $sql = "SELECT vacrelid, nspname, relname, enabled, vac_base_thresh, vac_scale_factor, anl_base_thresh, anl_scale_factor, vac_cost_delay, vac_cost_limit 
+                                       FROM pg_autovacuum join pg_class on (oid=vacrelid) join pg_namespace on (oid=relnamespace) ORDER BY nspname, relname";
+               
+               return $this->selectSet($sql);
+       }
 
        // Capabilities
        function hasServerAdminFuncs() { return true; }
-
+       function hasAutovacuum() { return true; }
 }
 
 ?>
index 391f6056deea2d79e86b44200a04f2ee6e127342..8f6911964275e7d19bc03cdf34588886a86fe41e 100755 (executable)
@@ -3,7 +3,7 @@
        /**
         * Manage schemas within a database
         *
-        * $Id: database.php,v 1.80 2006/01/09 05:43:48 chriskl Exp $
+        * $Id: database.php,v 1.81 2006/03/17 21:14:30 xzilla Exp $
         */
 
        // Include application functions
                                $misc->printTabs('database','admin');
                                $misc->printMsg($msg);
                                
+                               echo "<table width=\"60%\">\n";
+                               echo "<tr>\n";
+                               echo "<th class=\"data\">";
+                               $misc->printHelp($lang['strvacuum'],'pg.admin.vacuum')."</th>\n";
+                               echo "</th>";
+                               echo "<th class=\"data\">";
+                               $misc->printHelp($lang['stranalyze'],'pg.admin.analyze');
+                               echo "</th>";
+                               if ($data->hasRecluster()){
+                                       echo "<th class=\"data\">";
+                                       $misc->printHelp($lang['strclusterindex'],'pg.index.cluster');
+                                       echo "</th>";
+                               }
+                               echo "<th class=\"data\">";
+                               $misc->printHelp($lang['strreindex'],'pg.index.reindex');
+                               echo "</th>";
+                               echo "</tr>";   
+
                                // Vacuum
+                               echo "<tr>\n";
+                               echo "<td class=\"data1\" align=\"center\" valign=\"bottom\">\n";
                                echo "<form name=\"adminfrm\" id=\"adminfrm\" action=\"{$PHP_SELF}\" method=\"post\">\n";
-                               echo "<h3>";
-                               $misc->printHelp($lang['strvacuum'],'pg.admin.vacuum');
-                               echo "</h3>\n";
                                echo "<input type=\"checkbox\" id=\"vacuum_analyze\" name=\"vacuum_analyze\" />{$lang['stranalyze']}<br />\n";
                                if ($data->hasFullVacuum()) {
                                        echo "<input type=\"checkbox\" id=\"vacuum_full\" name=\"vacuum_full\" />{$lang['strfull']}<br />\n";                           
                                echo "<input type=\"hidden\" name=\"action\" value=\"vacuum\" />\n";
                                echo $misc->form;
                                echo "</form>\n";                                                               
+                               echo "</td>\n";
 
                                // Analyze
+                               echo "<td class=\"data1\" align=\"center\" valign=\"bottom\">\n";
                                echo "<form name=\"adminfrm\" id=\"adminfrm\" action=\"{$PHP_SELF}\" method=\"post\">\n";
-                               echo "<h3>";
-                               $misc->printHelp($lang['stranalyze'],'pg.admin.analyze');
-                               echo "</h3>\n";
                                echo "<input type=\"submit\" value=\"{$lang['stranalyze']}\" />\n";
                                echo "<input type=\"hidden\" name=\"action\" value=\"analyze\" />\n";
                                echo $misc->form;
                                echo "</form>\n";
+                               echo "</td>\n";
                                
                                // Recluster
                                if ($data->hasRecluster()){
+                                       echo "<td class=\"data1\" align=\"center\" valign=\"bottom\">\n";
                                        echo "<form name=\"adminfrm\" id=\"adminfrm\" action=\"{$PHP_SELF}\" method=\"post\">\n";
-                                       echo "<h3>";
-                                       $misc->printHelp($lang['strclusterindex'],'pg.index.cluster');
-                                       echo "</h3>\n";
                                        echo "<input type=\"submit\" value=\"{$lang['strclusterindex']}\" />\n";
                                        echo "<input type=\"hidden\" name=\"action\" value=\"recluster\" />\n";
                                        echo $misc->form;
                                        echo "</form>\n";
+                                       echo "</td>\n";
                                }
                                
                                // Reindex
+                               echo "<td class=\"data1\" align=\"center\" valign=\"bottom\">\n";
                                echo "<form name=\"adminfrm\" id=\"adminfrm\" action=\"{$PHP_SELF}\" method=\"post\">\n";
-                               echo "<h3>";
-                               $misc->printHelp($lang['strreindex'],'pg.index.reindex');
-                               echo "</h3>\n";
                                echo "<input type=\"checkbox\" id=\"reindex_force\" name=\"reindex_force\" />{$lang['strforce']}<br />\n";
                                echo "<input type=\"submit\" value=\"{$lang['strreindex']}\" />\n";
                                echo "<input type=\"hidden\" name=\"action\" value=\"reindex\" />\n";
                                echo $misc->form;
                                echo "</form>\n";
+                               echo "</td>\n";
+                               echo "</tr>\n";
+                               echo "</table>\n";
+
+                               echo "<br />";
+                               echo "<br />";
+                               echo "<h3>{$lang['strautovacuum']}</h3>";
+                               // Autovacuum
+                               // Fetch the processes from the database
+                               $autovac = $data->getAutovacuum();
+               
+                               $columns = array(
+                                       'namespace' => array(
+                                               'title' => $lang['strschema'],
+                                               'field' => 'nspname',
+                                       ),
+                                       'relname' => array(
+                                               'title' => $lang['strtable'],
+                                               'field' => 'relname',
+                                       ),
+                                       'enabled' => array(
+                                               'title' => $lang['strenabled'],
+                                               'field' => 'enabled',
+                                       ),
+                                       'vac_base_thresh' => array(
+                                               'title' => $lang['strvacuumbasethreshold'],
+                                               'field' => 'vac_base_thresh',
+                                       ),
+                                       'vac_scale_factor' => array(
+                                               'title' => $lang['strvacuumscalefactor'],
+                                               'field' => 'vac_scale_factor',
+                                       ),
+                                       'anl_base_thresh' => array(
+                                               'title' => $lang['stranalybasethreshold'],
+                                               'field' => 'anl_base_thresh',
+                                       ),
+                                       'anl_scale_factor' => array(
+                                               'title' => $lang['stranalyzescalefactor'],
+                                               'field' => 'anl_scale_factor',
+                                       ),
+                                       'vac_cost_delay' => array(
+                                               'title' => $lang['strvacuumcostdelay'],
+                                               'field' => 'vac_cost_delay',
+                                       ),
+                                       'vac_cost_limit' => array(
+                                               'title' => $lang['strvacuumcostlimit'],
+                                               'field' => 'vac_cost_limit',
+                                       ),
+                               );
+
+
+                               // Maybe we need to check permissions here?
+                               $columns['actions'] = array('title' => $lang['stractions']);
+                       
+                               $actions = array(
+                                       'edit' => array(
+                                       'title' => $lang['stredit'],
+                                       'url'   => "{$PHP_SELF}?action=autovacuum&amp;{$misc->href}&amp;",
+                                       'vars'  => array('vacrelid' => 'vacrelid')
+                                       )
+                               );
+               
+                               $misc->printTable($autovac, $columns, $actions, $lang['strnodata']);
+                                       
                                break;
                }
        }
 
+
+       /**
+        * Modify specific entries in the autovacuum table
+     */
+       function doAutovacuum() {
+               global $PHP_SELF, $data, $misc;
+               global $lang;
+
+               if (!isset($_REQUEST['query'])) $_REQUEST['query'] = '';
+
+
+               echo " editing a specific autovacuum row goes here "; 
+
+               $misc->printTrail('database');
+               $misc->printTabs('database','admin');
+
+       }
+
+
        /**
         * Allow execution of arbitrary SQL statements on a database
         */
                case 'signal':
                        doSignal();
                        break;
+               case 'autovacuum':
+                       doAutovacuum();
+                       break;
                default:
                        doSQL();
                        break;
index 364436233749a97879a7a2e9168858d9fca53675..ea1a6444e3240e101c204bcf9e3df344f115e9db 100755 (executable)
@@ -4,7 +4,7 @@
         * English language file for phpPgAdmin.  Use this as a basis
         * for new translations.
         *
-        * $Id: english.php,v 1.184 2006/01/06 21:06:57 xzilla Exp $
+        * $Id: english.php,v 1.185 2006/03/17 21:14:31 xzilla Exp $
         */
 
        // Language and character set
        $lang['strerrorloading'] = 'Error Loading';
        $lang['strclicktoreload'] = 'Click to reload';
 
+       //Autovacuum
+       $lang['strautovacuum'] = 'Autovacuum'; 
+       $lang['strenabled'] = 'Enabled'; 
+       $lang['strvacuumbasethreshold'] = 'Vacuum Base Threshold'; 
+       $lang['strvacuumscalefactor'] = 'Vacuum Scale Factor';  
+       $lang['stranalybasethreshold'] = 'Analyze Base Threshold';  
+       $lang['stranalyzescalefactor'] = 'Analyze Scale Factor'; 
+       $lang['strvacuumcostdelay'] = 'Vacuum Cost Delay'; 
+       $lang['strvacuumcostlimit'] = 'Vacuum Cost Limit';  
+
 ?>
index d6a64cec6453c109b3f1dbcda061c53dc5ee0288..ead3b92d1614700ef000155f07a2de93ef3b3687 100644 (file)
@@ -4,7 +4,7 @@
         * English language file for phpPgAdmin.  Use this as a basis
         * for new translations.
         *
-        * $Id: english.php,v 1.137 2006/01/06 21:06:58 xzilla Exp $
+        * $Id: english.php,v 1.138 2006/03/17 21:14:31 xzilla Exp $
         */
 
        // Language and character set
        $lang['strerrorloading'] = 'Error Loading';
        $lang['strclicktoreload'] = 'Click to reload';
 
+       //Autovacuum
+       $lang['strautovacuum'] = 'Autovacuum'; 
+       $lang['strenabled'] = 'Enabled'; 
+       $lang['strvacuumbasethreshold'] = 'Vacuum Base Threshold'; 
+       $lang['strvacuumscalefactor'] = 'Vacuum Scale Factor';  
+       $lang['stranalybasethreshold'] = 'Analyze Base Threshold';  
+       $lang['stranalyzescalefactor'] = 'Analyze Scale Factor'; 
+       $lang['strvacuumcostdelay'] = 'Vacuum Cost Delay'; 
+       $lang['strvacuumcostlimit'] = 'Vacuum Cost Limit';  
+
 ?>