[wp-trac] [WordPress Trac] #26887: Make wpdb::base_prefix explicitly public

WordPress Trac noreply at wordpress.org
Mon Jan 20 21:06:58 UTC 2014


#26887: Make wpdb::base_prefix explicitly public
---------------------------+-----------------------------
 Reporter:  DavidAnderson  |      Owner:
     Type:  enhancement    |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Database       |    Version:
 Severity:  normal         |   Keywords:
---------------------------+-----------------------------
 Currently in the WPDB class, there is no clear/explicit way for a plugin
 (e.g. a backup plugin that wants to backup all database tables) to know
 the base table prefix. (Not the current table prefix, but the base one).

 The value is stored in wpdb::base_prefix, but this is not explicitly made
 public. Hence, a coder is likely to look for alternatives.
 wpdb::get_blog_prefix(0) looks like it is intended to supply this lack
 (the case of $blog_id == 0 is explicitly coded for in there), but actually
 fails in the case of pre-3.0 WPMU installs that have been upgraded (i.e.
 if MULTISITE is not defined).

 In the proposed patch, I make explicit that wpdb::base_prefix is a public
 property, thus allowing coders to rely on it (and hindering future hackers
 from accidentally setting it as private).

--
Ticket URL: <https://core.trac.wordpress.org/ticket/26887>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list