Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

db_global abstraction layer? #69

Open
alexstandiford opened this issue Aug 20, 2020 · 1 comment
Open

db_global abstraction layer? #69

alexstandiford opened this issue Aug 20, 2020 · 1 comment

Comments

@alexstandiford
Copy link
Collaborator

alexstandiford commented Aug 20, 2020

If we truly want to make BerlinDB compatible with systems outside of WordPress, it may be prudent to make a change to how Base::get_db() works. Not all systems utilize a DB global in the way WordPress does, and few classes actually have the exact same methods as $wpdb.

It may be best to consider creating an interface that allows BerlinDB to interact with other database systems dynamically. This could implement the methods that Berlin calls directly from $wpdb. This would allow people to translate their system into Berlin's system.

Instead of having BerlinDB look for a global, perhaps it would fetch the specified instance, check if it implements, and use it.

This would require an extra file to make WPDB work with it, which is kind-of a bummer, but I think that's a small price to-pay. Since 2.0 is compatible with Composer, this interface and implementation could be somehow added as a composer package. This would make installing a WP-compatible version of Berlin as simple as running composer require berlindb/wordpress, or something similar.

Further, I can see this pattern being used in other places, such as an object cache implementation.

@JJJ
Copy link
Collaborator

JJJ commented Sep 29, 2020

Completely agree. I think it's perfectly OK for there to be a new file for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants