[wp-trac] [WordPress Trac] #14508: Always require wp-db.php

WordPress Trac wp-trac at lists.automattic.com
Mon Aug 2 19:18:35 UTC 2010


#14508: Always require wp-db.php
----------------------------+-----------------------------------------------
 Reporter:  nacin           |       Owner:  westi   
     Type:  task (blessed)  |      Status:  accepted
 Priority:  normal          |   Milestone:  3.1     
Component:  Database        |     Version:          
 Severity:  normal          |    Keywords:          
----------------------------+-----------------------------------------------

Comment(by Denis-de-Bernardy):

 Replying to [comment:4 nacin]:
 > In fact the only thing we're preventing is a db drop-in that defines its
 own wpdb, which is unnecessary and easily fixed.

 FWIW, there are basically three types of plugins that mess with wp-
 content/db.php

 One goes something like:

 {{{
 class whatever {
 }
 $wpdb = new whatever; // replace wpdb
 }}}

 The next goes:

 {{{
 include wpdb
 class whatever extends wpdb {
 }
 $wpdb = new whatever; // override wpdb
 }}}

 The last is included as a plugin rather than from wp-content/db.php and
 goes:


 {{{
 class whatever {
 }
 $wpdb = new whatever($wpdb); // extend wpdb using php's magic functions
 }}}

 I'd personally advise to not change the assumptions under which things
 work; but if you must, be sure to announce it long, long in advance on the
 wp.org blog, so that any potential plugin author and site owner that
 messes around with wpdb can update his plugin accordingly. Else, it's not
 Joe user's site that will be broken; it'll be larger WP site owners.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14508#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list