phpgroupware-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-tracker] [bug #5628] Setup does not create db


From: nobody
Subject: [Phpgroupware-tracker] [bug #5628] Setup does not create db
Date: Thu, 09 Oct 2003 10:16:55 -0400
User-agent: Mozilla/5.0 Galeon/1.2.7 (X11; Linux i686; U;) Gecko/20030131

=================== BUG #5628: LATEST MODIFICATIONS ==================
http://savannah.gnu.org/bugs/?func=detailbug&bug_id=5628&group_id=509

Changes by: Johnson <address@hidden>
Date: Thu 10/09/2003 at 14:16 (GMT)

------------------ Additional Follow-up Comments ----------------------------
I'm not sure what you want, there are two patches for the same information 
posted here as separate entries.  One against the original file, and one 
against cvs







=================== BUG #5628: FULL BUG SNAPSHOT ===================


Submitted by: jecinc                  Project: phpGroupWare                 
Submitted on: Tue 09/30/2003 at 03:30
Category:  API - Setup                Bug Group:  0.9.16RC1                 
Severity:  5 - Major                  Priority:  None                       
Resolution:  None                     Assigned to:  skwashd                 
Status:  Open                         Component Version:  CVS               
Platform Version:  Linux - RedHat     Reproducibility:  None                

Summary:  Setup does not create db 

Original Submission:  It is my understanding that the setup app is to create 
the db if it doesn't exist (after the header file is made).



When I log into setup I get:

Warning: pg_pconnect() PostgreSQL link lost, unable to reconnect in 
/home/htdocs/phpgroupwaretest16/phpgwapi/inc/class.db_pgsql.inc.php on line 69



Warning: pg_errormessage(): supplied argument is not a valid PostgreSQL link 
resource in /home/htdocs/phpgroupwaretest16/phpgwapi/inc/class.db_pgsql.inc.php 
on line 164



Warning: pg_errormessage(): supplied argument is not a valid PostgreSQL link 
resource in /home/htdocs/phpgroupwaretest16/phpgwapi/inc/class.db_pgsql.inc.php 
on line 208



Warning: pg_pconnect() unable to connect to PostgreSQL server: FATAL 1: 
Database "phpgroupwaretest16" does not exist in the system catalog. in 
/home/htdocs/phpgroupwaretest16/phpgwapi/inc/class.db_pgsql.inc.php on line 69



Warning: pg_errormessage(): supplied argument is not a valid PostgreSQL link 
resource in /home/htdocs/phpgroupwaretest16/phpgwapi/inc/class.db_pgsql.inc.php 
on line 164



Warning: pg_pconnect() unable to connect to PostgreSQL server: FATAL 1: 
Database "phpgroupwaretest16" does not exist in the system catalog. in 
/home/htdocs/phpgroupwaretest16/phpgwapi/inc/class.db_pgsql.inc.php on line 69



Warning: pg_errormessage(): supplied argument is not a valid PostgreSQL link 
resource in /home/htdocs/phpgroupwaretest16/phpgwapi/inc/class.db_pgsql.inc.php 
on line 164



Warning: pg_pconnect() unable to connect to PostgreSQL server: FATAL 1: 
Database "phpgroupwaretest16" does not exist in the system catalog. in 
/home/htdocs/phpgroupwaretest16/phpgwapi/inc/class.db_pgsql.inc.php on line 69



Warning: pg_errormessage(): supplied argument is not a valid PostgreSQL link 
resource in /home/htdocs/phpgroupwaretest16/phpgwapi/inc/class.db_pgsql.inc.php 
on line 164



Warning: pg_errormessage(): supplied argument is not a valid PostgreSQL link 
resource in /home/htdocs/phpgroupwaretest16/phpgwapi/inc/class.db_pgsql.inc.php 
on line 208



Warning: pg_pconnect() unable to connect to PostgreSQL server: FATAL 1: 
Database "phpgroupwaretest16" does not exist in the system catalog. in 
/home/htdocs/phpgroupwaretest16/phpgwapi/inc/class.db_pgsql.inc.php on line 69



Warning: pg_errormessage(): supplied argument is not a valid PostgreSQL link 
resource in /home/htdocs/phpgroupwaretest16/phpgwapi/inc/class.db_pgsql.inc.php 
on line 164



Warning: pg_errormessage(): supplied argument is not a valid PostgreSQL link 
resource in /home/htdocs/phpgroupwaretest16/phpgwapi/inc/class.db_pgsql.inc.php 
on line 208



Warning: pg_pconnect() unable to connect to PostgreSQL server: FATAL 1: 
Database "phpgroupwaretest16" does not exist in the system catalog. in 
/home/htdocs/phpgroupwaretest16/phpgwapi/inc/class.db_pgsql.inc.php on line 69



Warning: pg_errormessage(): supplied argument is not a valid PostgreSQL link 
resource in /home/htdocs/phpgroupwaretest16/phpgwapi/inc/class.db_pgsql.inc.php 
on line 164



Warning: pg_pconnect() unable to connect to PostgreSQL server: FATAL 1: 
Database "phpgroupwaretest16" does not exist in the system catalog. in 
/home/htdocs/phpgroupwaretest16/phpgwapi/inc/class.db_pgsql.inc.php on line 69



Warning: pg_errormessage(): supplied argument is not a valid PostgreSQL link 
resource in /home/htdocs/phpgroupwaretest16/phpgwapi/inc/class.db_pgsql.inc.php 
on line 164



Follow-up Comments
*******************

-------------------------------------------------------
Date: Thu 10/09/2003 at 14:16       By: jecinc
I'm not sure what you want, there are two patches for the same information 
posted here as separate entries.  One against the original file, and one 
against cvs





-------------------------------------------------------
Date: Thu 10/09/2003 at 13:31       By: cw
what's the difference?  a diff is a diff, cvs uses diff too, so doing a diff on 
CVS and a diff on a file saved from cvs will produce the same results.  Though 
i do agree that the patchmanager should be used instead of spamming it in to 
the bug report, which could be the problem.





-------------------------------------------------------
Date: Thu 10/09/2003 at 08:31       By: skwashd
Tried appling the patch ... it is fux0r ... please submit it via the patch 
manager using diff not cvs diff

-------------------------------------------------------
Date: Wed 10/08/2003 at 19:20       By: cw
Dave can you see that this get's commited?

-------------------------------------------------------
Date: Fri 10/03/2003 at 16:15       By: jecinc
another try



cvs -z6 diff -u class.db_pgsql.inc.php



Index: class.db_pgsql.inc.php

===================================================================

RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.db_pgsql.inc.php,v

retrieving revision 1.30.2.1.2.4

diff -u -r1.30.2.1.2.4 class.db_pgsql.inc.php

--- class.db_pgsql.inc.php      8 Sep 2003 01:27:44 -0000       1.30.2.1.2.4

+++ class.db_pgsql.inc.php      3 Oct 2003 16:14:10 -0000

@@ -56,7 +56,6 @@

                        {

                                $Password = $this->Password;

                        }

-

                        if (! $this->Link_ID)

                        {

                                $cstr = 'dbname=' . $Database

@@ -66,27 +65,28 @@

                                        . $this->ifadd("'".$Password."'", 
'password=');

                                if 
($GLOBALS['phpgw_info']['server']['db_persistent'])

                                {

-                                       $this->Link_ID=pg_pconnect($cstr);

+                                       $this->address@hidden($cstr);

                                }

                                else

                                {

-                                       $this->Link_ID=pg_connect($cstr);

+                                       $this->address@hidden($cstr);

                                }

  

                                if (! $this->Link_ID)

                                {

-                                       $this->halt('Link-ID == false, 
'.($GLOBALS['phpgw_info']['server']['db_persistent']?'p':'').'connect failed');

+                                        
$this->halt(($GLOBALS['phpgw_info']['server']['db_persistent']?'p':'')."connect($Host,
 $User, $Password) failed.");

+                                       return 0;

                                }

                                else

                                {

                                        $this->query("select 
version()",__LINE__,__FILE__);

                                        $this->next_record();

-

                                        $version          = $this->f('version');

                                        $parts            = explode(' 
',$version);

                                        $this->db_version = $parts[1];

                                }

                        }

+                       return $this->Link_ID;

                }

  

                function to_timestamp($epoch)

@@ -147,6 +147,7 @@

                        return @pg_close($this->Link_ID);

                }

  

+

                function query($Query_String, $line = '', $file = '')

                {

                        if ($Query_String == '')

@@ -154,20 +155,33 @@

                                return 0;

                        }

  

-                       $this->connect();

-

-                       /* printf("<br>Debug: query = %s<br>n", $Query_String); 
*/

+                       if (!$this->connect())

+                        {

+                                return 0; /* we already complained in 
connect() about that. */

+                        };

+                        # New query, discard previous result.

+                        if ($this->Query_ID)

+                        {

+                                $this->free();

+                        }

+

  

+                        if ($this->Debug)

+                        {

+                                printf("Debug: query = %s<br>n", 
$Query_String);

+                        }

  

                        $this->Query_ID = @pg_Exec($this->Link_ID, 
$Query_String);

                        $this->Row   = 0;

  

-                       $this->Error = pg_ErrorMessage($this->Link_ID);

+                       $this->Error = @pg_ErrorMessage($this->Link_ID);

                        $this->Errno = ($this->Error == '') ? 0 : 1;

                        if (! $this->Query_ID)

                        {

+                               return 0;

                                $this->halt('Invalid SQL: ' . $Query_String, 
$line, $file);

                        }

  

+                       # Will return nada if it fails. That's fine.

                        return $this->Query_ID;

                }

  

@@ -205,8 +219,11 @@

                {

                        $this->Record = @pg_fetch_array($this->Query_ID, 
$this->Row++);

  

-                       $this->Error = pg_ErrorMessage($this->Link_ID);

-                       $this->Errno = ($this->Error == '') ? 0 : 1;

+                       if ($this->Link_ID)

+                       {

+                               $this->Error = pg_ErrorMessage($this->Link_ID);

+                               $this->Errno = ($this->Error == '') ? 0 : 1;

+                       }

  

                        $stat = is_array($this->Record);

                        if (!$stat && $this->Auto_Free)

@@ -241,7 +258,7 @@

  

                function transaction_abort()

                {

-                       return pg_Exec($this->Link_ID,'rollback');

+                       return @pg_Exec($this->Link_ID,'rollback');

                }

  

                function get_last_insert_id($table, $field)

@@ -392,17 +409,19 @@

                        return pg_numfields($this->Query_ID);

                }

  

+               /* private: error handling */

                function halt($msg, $line = '', $file = '')

                {

+                        $this->Error = @pg_ErrorMessage($this->Link_ID);

+                        $this->Errno = 1;

+

  

                        if ($this->Halt_On_Error == 'no')

                        {

                                return;

                        }

-

                        /* Just in case there is a table currently locked */

                        $this->transaction_abort();

  

-

                        if ($this->xmlrpc || $this->soap)

                        {

                                $s = sprintf("Database error: %sn", $msg);

@@ -500,8 +519,13 @@

                        {

                                $this->User = $adminname;

                                $this->Password = $adminpasswd;

+                               $this->Database = "template1";

                        }

  

+                       /*

+                       This doesn't work if the httpd server user doesn't have 
execute permissions on the createdb program

+                       */

+                       /*

                        if (! $this->Host)

                        {

                                system('createdb ' . $currentDatabase, $outval);

@@ -510,13 +534,16 @@

                        {

                                system('createdb -h ' . $this->Host . ' ' . 
$currentDatabase, $outval);

                        }

-

                        if($outval != 0)

                        {

-                               /* either the rights r not available or the 
postmaster is not running .... */

+                               // either the rights r not available or the 
postmaster is not running ....

                                echo 'database creation failure <BR>';

                                echo 'please setup the postreSQL database 
manually<BR>';

                        }

+                       */

+

+                        $this->query("CREATE DATABASE $currentDatabase");

+                        $this->query("grant all on $currentDatabase.* to 
address@hidden identified by

'$currentPassword'");

  

                        $this->User = $currentUser;

                        $this->Password = $currentPassword;



-------------------------------------------------------
Date: Fri 10/03/2003 at 15:48       By: jecinc
Here is patch (diff phpgwapi/inc/class.db_pgsql.inc.php 
phpgwapi/inc/class.db_pgsql.inc.php.orig):



58a59

>

68c69

<                                       $this->address@hidden($cstr);

---

>                                       $this->Link_ID=pg_pconnect($cstr);

72c73

<                                       $this->address@hidden($cstr);

---

>                                       $this->Link_ID=pg_connect($cstr);

77,78c78

<                                         
$this->halt(($GLOBALS['phpgw_info']['server']['db_persistent']?'p':'')."connect($Host,
 $User, $Password) failed.");

<                                       return 0;

---

>                                       $this->halt('Link-ID == false, 
> '.($GLOBALS['phpgw_info']['server']['db_persistent']?'p':'').'connect 
> failed');

83a84

>

89d89

<                       return $this->Link_ID;

150d149

<

158,171c157,159

<                       if (!$this->connect())

<                         {

<                                 return 0; /* we already complained in 
connect() about that. */

<                         };

<                         # New query, discard previous result.

<                         if ($this->Query_ID)

<                         {

<                                 $this->free();

<                         }

<

                                                                                
                               

<                         if ($this->Debug)

<                         {

<                                 printf("Debug: query = %s<br>n", 
$Query_String);

<                         }

---

>                       $this->connect();

>

>                       /* printf("<br>Debug: query = %s<br>n", $Query_String); 
> */

176c164

<                       $this->Error = @pg_ErrorMessage($this->Link_ID);

---

>                       $this->Error = pg_ErrorMessage($this->Link_ID);

180d167

<                               return 0;

184d170

<                       # Will return nada if it fails. That's fine.

222,226c208,209

<                       if ($this->Link_ID)

<                       {

<                               $this->Error = pg_ErrorMessage($this->Link_ID);

<                               $this->Errno = ($this->Error == '') ? 0 : 1;

<                       }

---

>                       $this->Error = pg_ErrorMessage($this->Link_ID);

>                       $this->Errno = ($this->Error == '') ? 0 : 1;

261c244

<                       return @pg_Exec($this->Link_ID,'rollback');

---

>                       return pg_Exec($this->Link_ID,'rollback');

412d394

<               /* private: error handling */

415,417d396

<                         $this->Error = @pg_ErrorMessage($this->Link_ID);

<                         $this->Errno = 1;

<

                                                                                
                               

421a401

>

424a405

>

522d502

<                               $this->Database = "template1";

525,528d504

<                       /*

<                       This doesn't work if the httpd server user doesn't have 
execute permissions on the createdb program

<                       */

<                       /*

536a513

>

539c516

<                               // either the rights r not available or the 
postmaster is not running ....

---

>                               /* either the rights r not available or the 
> postmaster is not running .... */

543,546d519

<                       */

<

<                         $this->query("CREATE DATABASE $currentDatabase");

<                         $this->query("grant all on $currentDatabase.* to 
address@hidden identified by '$currentPassword'");



-------------------------------------------------------
Date: Tue 09/30/2003 at 21:18       By: cw
um, yeah, I added/fixed this for mysql, but I don't have a pgsql install (and 
don't plan on learning it anytime soon).  Can someone port teh mysql functions 
to pg?


CC list is empty


No files currently attached


For detailed info, follow this link:
http://savannah.gnu.org/bugs/?func=detailbug&bug_id=5628&group_id=509

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]