[wp-hackers] WP and Plugins DB connection conflicts
Peter Adams
peter at oncefuture.com
Thu Jun 28 21:26:28 GMT 2007
That what Open Web analytics does as well. it creates it's own
connection but uses the same credentials.
The issue I found was fixed in v2.1 when wp-db.php was fixed to call
for mysql errors on it's own link instead of on the last used link.
So this is not an issue anymore but something that plugin developers
should be aware of if they want to support v2.0 installs and need to
produce and ignore errors on their own DB link.
-P-
On Jun 27, 2007, at 7:27 AM, Omry Yadan wrote:
> 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).
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
More information about the wp-hackers
mailing list