New wpdb instance

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

New wpdb instance

Dino Termini
Hi list,

I need to connect to a different database to retrieve some data. So I'm
instantiating a new $wpdb object:

$new_wpdb = new wpdb( params );

It happens sometimes that I enter the wrong credentials, and if WP_DEBUG
is true, this renders the WP admin totally inaccessible and I need to
rename my plugin's folder to get it back:

https://core.trac.wordpress.org/browser/trunk/src/wp-includes/wp-db.php#L581

How can I check that the credentials I have are legit without blowing up
the admin?

Thanks,
Dino.
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|

Re: New wpdb instance

Konrad Karpieszuk
I think real problem you have with wpdb->bail() which has wp_die() inside.

Anyway, whenever where problem is exactly, you can always extend wpdb class
to your my_wpdb() class (name it better) and overwrite some methods. Then
call new my_wpdb( params ) and all will be good


--
(en) regards / (pl) pozdrawiam
Konrad Karpieszuk
http://tradematik.pl wtyczka do WordPressa do tworzenia sklepów dla
klientów z Polski


On Fri, Oct 17, 2014 at 3:04 AM, Dino Termini <[hidden email]>
wrote:

> Hi list,
>
> I need to connect to a different database to retrieve some data. So I'm
> instantiating a new $wpdb object:
>
> $new_wpdb = new wpdb( params );
>
> It happens sometimes that I enter the wrong credentials, and if WP_DEBUG
> is true, this renders the WP admin totally inaccessible and I need to
> rename my plugin's folder to get it back:
>
> https://core.trac.wordpress.org/browser/trunk/src/wp-
> includes/wp-db.php#L581
>
> How can I check that the credentials I have are legit without blowing up
> the admin?
>
> Thanks,
> Dino.
> _______________________________________________
> wp-hackers mailing list
> [hidden email]
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers