A new DBAL-based bridge core, and supporting phpBB3 driver A new DBAL-based bridge core, and supporting phpBB3 driver
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

A new DBAL-based bridge core, and supporting phpBB3 driver

Started by Dion, February 21, 2014, 09:22:19 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dion

One issue I've had with Coppermine, for myself as well as with clients, is that it doesn't support bridging to applications that use non-MySQL databases. The issue is that the bridge core is hard-coded to MySQL.

So one day I sat down and modified the udb_base.inc.php bridge core to create a database abstraction layer (DBAL), and then completely rewrote the phpbb3.inc.php phpBB3 bridge driver to utilize the DBAL in the new bridge core. It works great, and I wanted to share it with the folks here. While I had no interest in writing additional bridge drivers, they should be easy to write.

Here is where you can find the new files: http://forum.dion-designs.com/t9012/improved-copperminephpbb3-bridge/

I thought about attaching the ZIP file here, but since the instructions in the above topic are also required, I felt it was better to link to the topic.

Please let me know what you think.

gmc

Dion,
Thank you for the documentation and sharing your code!

A Database Abstraction Layer has definitely been a topic of discussion - we certainly know we need to replace the direct mysql calls due to deprecation... The direction for the abstraction hasn't been determined yet as several options are being explored...

I've downloaded your code and will take a closer look at what you did. (haven't had a chance to do more than read the post and linked page...)

I've already documented several 'missing' functions for the dev teamincluding 'free result' to be covered as well as we go through the process as I found those in writing some plugin code.

Greg
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

phill104

Dion,

Absolutely fantastic work. As Greg says, a DBAL is something that we have wanted to add to CPG for a very long time. Keep it coming, we would love to know your thoughts on adding an abstraction layer to the core for CPG1.6.
It is a mistake to think you can solve any major problems just with potatoes.

Dion

I didn't mention it in my original post, but if you want to use my revised bridge code in CPG, feel free to do so. You have my permission to remove my copyright blocks in the two files.

I think adding a DBAL would be a great idea. Creating it will be easy; a $CONFIG['dbal'] line in config.inc.php specifying a DBAL (mysqli/pgsql/mssql/etc) driver, and each driver having its own set of cpg_db_xxx() functions. Most of the required functions have already been written; I added the missing "simple" functions in my bridge DBAL, but a few more will be needed for manipulating tables (creating/truncating/dropping/altering).

The biggest issue will be replacing the large number of hard-coded mysql calls in the current code with DBAL-based calls.

I'm curious about something...what is this? http://sourceforge.net/p/coppermine/code/HEAD/tree/trunk/cpgdbal/include/cpgdb/

ΑndrĂ©

Quote from: Dion on February 22, 2014, 09:30:09 PM
what is this? http://sourceforge.net/p/coppermine/code/HEAD/tree/trunk/cpgdbal/include/cpgdb/

That was an attempt (or proof of concept) of a DBAL for Coppermine. As far as I know Abbas created it and it also seemed to work as expected. I don't know why it was abandoned, that was before I joined the dev team.