helpphpGroupWare - Support: sr #104067, PEAR-DB and PHPgw's nameclash on...

 
 

You are not allowed to post comments on this tracker with your current authentification level.

sr #104067: PEAR-DB and PHPgw's nameclash on the class DB.

Submitted by:  None
Submitted on:  Sun 03 Apr 2005 03:05:42 PM UTC  
 
Category: Feature RequestPriority: 5 - Normal
Severity: 3 - NormalStatus: None
Privacy: PublicAssigned to: None
Originator Email: -unavailable-Open/Closed: Open
Operating System: GNU/Linux

Sun 03 Apr 2005 11:43:43 PM UTC, comment #1:

We won't be making this change. There are several reasons for this.

We only support the use of 1 abstraction library, for 16 it is a modded version of phpLib for 18+ it will be ADOdb with a wrapper.

PEAR DB is released under the PHP License and so is not GPL compatiable, and I have little interest in making major changes to suport non GPL compatiable code.

We use a modified versioon of phpLib's DB abstraction library, they had the namespace first

I would never make a change like this in stable, even if the first 3 problems didn't exist.

I suggest you use the supported abstraction libraries for your app.

Cheers

Dave Hall (aka skwashd)
API Coordinator

PS - I had written most of this before I realised I wasn't logged in.

Anonymous
Sun 03 Apr 2005 03:05:42 PM UTC, original submission:

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

Anonymous

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follows 1 latest change.

Date Changed By Updated Field Previous Value => Replaced By
Sun 03 Apr 2005 03:05:42 PM UTCNoneCarbon-Copy-=>Added peter --DOT-- vd --DOT-- meer --AT-- yifan --DOT-- net

Back to the top


Powered by Savane 3.1-cleanup