[geeklog-cvs] geeklog: pgsql install works!

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Tue Jan 26 15:53:28 EST 2010


changeset 7622:e257344c13fb
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/e257344c13fb
user: stan <yankees26an at gmail.com>
date: Sat Jun 20 23:42:32 2009 -0400
description:
pgsql install works!

diffstat:

 public_html/admin/index.php                    |   1 -
 public_html/admin/install/index.php            |  17 ++++++++++++++---
 public_html/admin/install/language/english.php |   1 +
 public_html/admin/install/lib-install.php      |  11 ++++++++++-
 system/classes/template.class.php              |  15 ++++++++-------
 5 files changed, 33 insertions(+), 12 deletions(-)

diffs (172 lines):

diff -r b697aad4d39c -r e257344c13fb public_html/admin/index.php
--- a/public_html/admin/index.php	Fri Jun 19 23:50:34 2009 -0400
+++ b/public_html/admin/index.php	Sat Jun 20 23:42:32 2009 -0400
@@ -30,7 +30,6 @@
 if (isset ($_GET['mode']) && ($_GET['mode'] == 'logout')) {
     print COM_refresh($_CONF['site_url'] . '/users.php?mode=logout');
 }
-
 print COM_refresh($_CONF['site_admin_url'] . '/moderation.php');
 
 ?>
diff -r b697aad4d39c -r e257344c13fb public_html/admin/install/index.php
--- a/public_html/admin/install/index.php	Fri Jun 19 23:50:34 2009 -0400
+++ b/public_html/admin/install/index.php	Sat Jun 20 23:42:32 2009 -0400
@@ -79,6 +79,7 @@
         $site_slogan = (isset($_POST['site_slogan'])) ? str_replace('\\', '', $_POST['site_slogan']) : $LANG_INSTALL[30];
         $mysql_innodb_selected = '';
         $mysql_selected = '';
+        $pgsql_selected = '';
         $mssql_selected = '';
         if (isset($_POST['db_type'])) {
             switch ($_POST['db_type']) {
@@ -88,6 +89,9 @@
                 case 'mssql':
                     $mssql_selected = ' selected="selected"';
                     break;
+                case 'pgsql':
+                    $pgsql_selected = ' selected="selected"';
+                    break;
                 default:
                     $mysql_selected = ' selected="selected"';
                     break;
@@ -97,6 +101,9 @@
                 case 'mssql':
                     $mssql_selected = ' selected="selected"';
                     break;
+                case 'pgsql':
+                    $mssql_selected = ' selected="selected"';
+                    break;
                 default:
                     $mysql_selected = ' selected="selected"';
                     break;
@@ -159,7 +166,7 @@
             <p><label class="' . $form_label_dir . '">' . $LANG_INSTALL[33] . ' ' . INST_helpLink('site_slogan') . '</label> <input type="text" name="site_slogan" value="' . $site_slogan . '" size="40"' . XHTML . '></p>
             <p><label class="' . $form_label_dir . '">' . $LANG_INSTALL[34] . ' ' . INST_helpLink('db_type') . '</label> <select name="db_type">
                 <option value="mysql"' . $mysql_selected . '>' . $LANG_INSTALL[35] . '</option>
-                ' . ($install_type == 'install' ? '<option value="mysql-innodb"' . $mysql_innodb_selected . '>' . $LANG_INSTALL[36] . '</option>' : '') . '
+                ' . ($install_type == 'install' ? '<option value="mysql-innodb"' . $mysql_innodb_selected . '>' . $LANG_INSTALL[36] . '</option><option value="pgsql"' . $pgsql_selected . '>' . $LANG_INSTALL[360] . '</option>': '') . '
                 <option value="mssql"' . $mssql_selected . '>' . $LANG_INSTALL[37] . '</option></select> ' . '</p>
             <p><label class="' . $form_label_dir . '">' . $LANG_INSTALL[39] . ' ' . INST_helpLink('db_host') . '</label> <input type="text" name="db_host" value="'. $db_host .'" size="20"' . XHTML . '></p>
             <p><label class="' . $form_label_dir . '">' . $LANG_INSTALL[40] . ' ' . INST_helpLink('db_name') . '</label> <input type="text" name="db_name" value="'. $db_name . '" size="20"' . XHTML . '></p>
@@ -219,7 +226,6 @@
 
         // Check if we can connect to the database
         } else if (!INST_dbConnect($DB)) { 
-
             $display .= '<h2>' . $LANG_INSTALL[54] . '</h2><p>'
                      . $LANG_INSTALL[55] . '</p>'
                      . INST_showReturnFormData($_POST) . LB;
@@ -764,6 +770,11 @@
                 $_DB->dbQuery($sql, 0, 1);
             }
             break;
+        case 'pgsql':
+            foreach ($_SQL as $sql) {
+                $_DB->dbQuery($sql, 0, 1);
+            }
+            break;
     }
 
     // Now insert mandatory data and a small subset of initial data
@@ -787,7 +798,7 @@
 {
     global $_TABLES, $_DB_dbms;
 
-    if (($_DB_dbms == 'mysql') || ($_DB_dbms == 'mssql')) {
+    if (($_DB_dbms == 'mysql') || ($_DB_dbms == 'mssql' || $_DB_dbms== 'pgsql')) {
 
         // let's try and personalize the Admin account a bit ...
 
diff -r b697aad4d39c -r e257344c13fb public_html/admin/install/language/english.php
--- a/public_html/admin/install/language/english.php	Fri Jun 19 23:50:34 2009 -0400
+++ b/public_html/admin/install/language/english.php	Sat Jun 20 23:42:32 2009 -0400
@@ -86,6 +86,7 @@
     34 => 'Database Type',
     35 => 'MySQL',
     36 => 'MySQL with InnoDB Table support',
+    360=>'PgSQL',
     37 => 'Microsoft SQL',
     38 => 'Error',
     39 => 'Database Hostname',
diff -r b697aad4d39c -r e257344c13fb public_html/admin/install/lib-install.php
--- a/public_html/admin/install/lib-install.php	Fri Jun 19 23:50:34 2009 -0400
+++ b/public_html/admin/install/lib-install.php	Sat Jun 20 23:42:32 2009 -0400
@@ -56,7 +56,7 @@
     * This constant defines Geeklog's version number. It will be written to
     * siteconfig.php and the database (in the latter case minus any suffix).
     */
-    define('VERSION', '1.6.0b2');
+    define('VERSION', '1.6.0b1');
 }
 if (!defined('XHTML')) {
     define('XHTML', ' /');
@@ -431,6 +431,11 @@
             return $db_handle;
         }
         break;
+    case 'pgsql':
+        if ($db_handle = @pg_connect('host='.$db['host'].' dbname='.$db['name'].' user='.$db['user'].' password='.$db['pass'])) {
+            return $db_handle;
+        }
+        break;
     }
     return $db_handle;
 }
@@ -457,6 +462,10 @@
             return true;
         }
         break;
+    case 'pgsql':
+        $result = @pg_query('select count(*) from pg_catalog.pg_database where datname = \''.$db['name'].'\' ;');
+        $ifExists = pg_fetch_row($result);
+        return $ifExists[0]?true:false;
     }
     return false;
 }
diff -r b697aad4d39c -r e257344c13fb system/classes/template.class.php
--- a/system/classes/template.class.php	Fri Jun 19 23:50:34 2009 -0400
+++ b/system/classes/template.class.php	Sat Jun 20 23:42:32 2009 -0400
@@ -82,7 +82,7 @@
   * @var       int
   * @access    public
   */
-  var $debug    = false;
+  var $debug    = 4;
 
  /**
   * The base directory from which template files are loaded.
@@ -91,7 +91,7 @@
   * @access    private
   * @see       set_root
   */
-  var $root     = '.';
+  var $root     = '';
 
  /**
   * A hash of strings forming a translation table which translates variable names
@@ -159,7 +159,8 @@
   * @access    public
   * @return    void
   */
-  function Template($root = '.', $unknowns = 'remove') {
+  function Template($root='.', $unknowns = 'remove') {
+ 
     if ($this->debug & 4) {
       echo "<p><b>Template:</b> root = $root, unknowns = $unknowns</p>\n";
     }
@@ -473,10 +474,10 @@
       return false;
     }
     
-	$varkeys = array_map(
-		create_function('$a', 'return "{" . $a . "}";'),
-		array_keys($this->varvals)
-	);
+    $varkeys = array_map(
+        create_function('$a', 'return "{" . $a . "}";'),
+        array_keys($this->varvals)
+    );
     $str = $this->get_var($varname);
     $str = str_replace($varkeys, array_values($this->varvals), $str);
     return $str;



More information about the geeklog-cvs mailing list