phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] phpgwapi/inc/functions.inc.php, 1.121.2.13.2.21.2.2


From: nomail
Subject: [Phpgroupware-cvs] phpgwapi/inc/functions.inc.php, 1.121.2.13.2.21.2.2
Date: Thu, 30 Dec 2004 05:51:47 +0100

Update of /phpgwapi/inc
Modified Files:
        Branch: proposed-0_9_18-branch
          functions.inc.php

date: 2004/12/30 04:51:47;  author: skwashd;  state: Exp;  lines: +24 -16

Log Message:
switch to ADOdb
=====================================================================
Index: phpgwapi/inc/functions.inc.php
diff -u phpgwapi/inc/functions.inc.php:1.121.2.13.2.21.2.1 
phpgwapi/inc/functions.inc.php:1.121.2.13.2.21.2.2
--- phpgwapi/inc/functions.inc.php:1.121.2.13.2.21.2.1  Sun Oct 31 12:55:10 2004
+++ phpgwapi/inc/functions.inc.php      Thu Dec 30 04:51:47 2004
@@ -124,24 +124,32 @@
         
/************************************************************************\
         * Load up the main instance of the db class.                           
  *
         
\************************************************************************/
-       $GLOBALS['phpgw']->db           = CreateObject('phpgwapi.db');
-       $GLOBALS['phpgw']->db->Host     = 
$GLOBALS['phpgw_info']['server']['db_host'];
-       $GLOBALS['phpgw']->db->Type     = 
$GLOBALS['phpgw_info']['server']['db_type'];
-       $GLOBALS['phpgw']->db->Database = 
$GLOBALS['phpgw_info']['server']['db_name'];
-       $GLOBALS['phpgw']->db->User     = 
$GLOBALS['phpgw_info']['server']['db_user'];
-       $GLOBALS['phpgw']->db->Password = 
$GLOBALS['phpgw_info']['server']['db_pass'];
-       if ($GLOBALS['phpgw']->debug)
+       $GLOBALS['phpgw']->db                = CreateObject('phpgwapi.db');
+       $GLOBALS['phpgw']->db->Debug         = $GLOBALS['phpgw']->debug ? 1 : 0;
+       $GLOBALS['phpgw']->db->Halt_On_Error = 'no';
+       $GLOBALS['phpgw']->adodb             =& $GLOBALS['phpgw']->db->adodb; 
//Reference
+       
+       
@$GLOBALS['phpgw']->adodb->connect($GLOBALS['phpgw_info']['server']['db_host'],
+                                          
$GLOBALS['phpgw_info']['server']['db_user'],
+                                          
$GLOBALS['phpgw_info']['server']['db_pass'],
+                                          
$GLOBALS['phpgw_info']['server']['db_name']
+                                         );
+       if(!$GLOBALS['phpgw']->adodb->ErrorMsg())
        {
-               $GLOBALS['phpgw']->db->Debug = 1;
+               $GLOBALS['phpgw']->adodb->query('select count(config_name) from 
phpgw_config');
+               if($GLOBALS['phpgw']->adodb->ErrorMsg())
+               {
+                       $setup_dir = 
ereg_replace($_SERVER['PHP_SELF'],'index.php','setup/');
+                       echo '<center><b>Fatal Error:</b> It appears that you 
have not created the database tables for '
+                       .'phpGroupWare.  Click <a href="' . $setup_dir . 
'">here</a> to run setup.</center>';
+                       exit;
+               }
        }
-
-       $GLOBALS['phpgw']->db->Halt_On_Error = 'no';
-       @$GLOBALS['phpgw']->db->query("select count(config_name) from 
phpgw_config");
-       if (! @$GLOBALS['phpgw']->db->next_record())
+       else
        {
                $setup_dir = 
ereg_replace($_SERVER['PHP_SELF'],'index.php','setup/');
-               echo '<center><b>Fatal Error:</b> It appears that you have not 
created the database tables for '
-               .'phpGroupWare.  Click <a href="' . $setup_dir . '">here</a> to 
run setup.</center>';
+               echo '<center><b>Fatal Error:</b> Unable to connect to database 
server '
+               .'Click <a href="' . $setup_dir . '">here</a> to run 
setup.</center>';
                exit;
        }
        $GLOBALS['phpgw']->db->Halt_On_Error = 'yes';




reply via email to

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