phpgroupware-tracker
[Top][All Lists]
Advanced

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

[Phpgroupware-tracker] [sr #104067] PEAR-DB and PHPgw's nameclash on the


From: anonymous
Subject: [Phpgroupware-tracker] [sr #104067] PEAR-DB and PHPgw's nameclash on the class DB.
Date: Sun, 3 Apr 2005 15:05:43 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20050210 Firefox/1.0 (Debian package 1.0+dfsg.1-6)

URL:
  <http://savannah.gnu.org/support/?func=detailitem&item_id=104067>

                 Summary: PEAR-DB and PHPgw's nameclash on the class DB.
                 Project: phpGroupWare
            Submitted by: None
            Submitted on: Sun 04/03/2005 at 15:05
                Category: Feature Request
                Priority: 5 - Normal
                Severity: 3 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: address@hidden
             Open/Closed: Open
        Platform Version: GNU/Linux

    _______________________________________________________

Details:

Hi,

I'm creating some custom modules for PHP-groupware and I like to use PEAR-DB
in my modules.

But a nameclash between PEAR-DB and PHPgw's DB-class makes this very
difficult. (PHPgw on my Debian terminates on loading PEAR-DB with: "Fatal
error: Cannot redeclare class db in /usr/share/php/DB.php on line 271") I've
seen many people complain about this problem in the newsgroups, but I've not
seen any sollution for PHP-groupware so far.

After some research, I fixed this problem for myself by the following steps:

-rename [path_to_phpgw]/phpgwapi/inc/class.db.inc.php
 to     [path_to_phpgw]/phpgwapi/inc/class.db_phpgw.inc.php

-change the class name 'db' to 'db_phpgw' at least in the following files:
  [path_to_phpgw]/phpgwapi/inc/class.db_mysql.inc.php
  [path_to_phpgw]/phpgwapi/inc/class.db_pgsql.inc.php
  [path_to_phpgw]/phpgwapi/inc/class.db_oracle.inc.php
  [path_to_phpgw]/phpgwapi/inc/class.db_mysql.inc.php
  [path_to_phpgw]/phpgwapi/inc/class.db_sapdb.inc.php
  [path_to_phpgw]/phpgwapi/inc/class.db_[db_you_actually_use].inc.php

-Replace "CreateObject('phpgwapi.db')" with
"CreateObject('phpgwapi.db_phpgw')"
 in the following files:
   phpgwapi/inc/class.setup.inc.php
   phpgwapi/inc/functions.inc.php

This is a very fundamental change, but I think the impact in PHPgroupware
should not be too big, since only the framework and the setup scripts are
supposed to create instances of PHPgroupware's db class. And personally I
believe supporting PEAR-DB in the modules is worth this change.

My sollution only lasts until I upgrade my phpgroupware installation (when
files mentioned above are overwritten), so I hope my sollution can help in
finding a more permanent sollution for all people who build custom
phpgroupware modules.

I'm currently using 'phpGroupWare API version 0.9.16.005' on Debian
Unstable.

Regards,
Peter van der Meer




    _______________________________________________________

Carbon-Copy List:

CC Address                          | Comment
------------------------------------+-----------------------------
peter --DOT-- vd --DOT-- meer --AT-- yifan --DOT-- net | Originator Email




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/support/?func=detailitem&item_id=104067>

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





reply via email to

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