Discussion:
New wpdb instance
Dino Termini
2014-10-17 01:04:19 UTC
Permalink
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.
Konrad Karpieszuk
2014-10-22 20:37:22 UTC
Permalink
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
Post by Dino Termini
Hi list,
I need to connect to a different database to retrieve some data. So I'm
$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
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
http://lists.automattic.com/mailman/listinfo/wp-hackers
Loading...