[wp-hackers] WP and Plugins DB connection conflicts

Omry Yadan omry at yadan.net
Wed Jun 27 14:27:35 GMT 2007


Paul Menard wrote:

>
> On Jun 27, 2007, at 8:55 AM, Omry Yadan wrote:
>
>>> I'd be interested to know what these cases are, because I can't think
>>> of any. Plugins already have the $wpdb connection available to them,
>>> why would they ever need to make another connection to the same DB?
>> FireStats for example, does not depend on WordPress (it can work as 
>> standalone), so it has its own database infrastructure.
>
> Is this for the FireStats stand-alone implementation? Regardless, I 
> think the rule should be don't mess with the global $wpdb object. Use 
> it but don't try to manipulate it. End of issue.
>
> If you want/need to create your own connection (dumb in my opinion) 
> then create your own instance of the WPDB class.
>
> // From inside your plugin
> // You will need to make sure wpdb.php is included.
> $my_wpdb = new wpdb($USER, $PASSWORD, $NAME, $HOST);
As I said, I have my own db connectivity infrastructure, and I can't 
depend on wordpress (or its classes) for that.
the point here that some plugins DO have to create their own connection, 
it has nothing to do with wpdb. (I don't think any plugin should try to 
'manipulate' it).



More information about the wp-hackers mailing list