[wp-trac] [WordPress Trac] #15023: wpdb Filters

WordPress Trac wp-trac at lists.automattic.com
Sun Oct 3 20:10:11 UTC 2010


#15023: wpdb Filters
-------------------------+--------------------------------------------------
 Reporter:  sc0ttkclark  |       Owner:                 
     Type:  enhancement  |      Status:  new            
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Plugins      |     Version:  3.1            
 Severity:  normal       |    Keywords:                 
-------------------------+--------------------------------------------------
 Plugins wishing to hook into wpdb would benefit from having a few
 additional filters added. Right now, the only filter running is on query,
 which absolutely requires use of complex regex or a mysql parser to figure
 out what's going on.

 Furthermore, I believe adding filters to the following functions would be
 useful for adding additional database support apart from MySQL without
 much code rewriting.

 Existing Filter:

 - wpdb::query 'query' (normal apply_filters) [Filter the query and rewrite
 if necessary]

 New / Updated Filters:

 (note, new filters use _exec at the end to differentiate from format
 original filter uses for 'query')

 - wpdb::query 'query' (use apply_filters_ref_array and pass through
 &$this) [Filter the query and rewrite if necessary]

 - wpdb::query 'query_exec' (use apply_filters_ref_array and pass through
 &$this) [Same as 'query' except it allows for a plugin to intercept the
 function and perform it's operations through other DB functions vs forcing
 mysql_query]

 - wpdb::_insert_replace_helper 'insert_replace_exec' (use
 apply_filters_ref_array and pass through &$this) [Allows for a plugin to
 intercept the function and perform it's operations through other DB
 functions vs forcing mysql_query] {This function is used by wpdb::insert
 and wpdb::replace}

 - wpdb::update 'update_exec' (use apply_filters_ref_array and pass through
 &$this) [Allows for a plugin to intercept the function and perform it's
 operations through other DB functions vs forcing mysql_query]

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/15023>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list