[wp-trac] [WordPress Trac] #42151: Create a filter to add information to query data saved when SAVEQUERIES is true

WordPress Trac noreply at wordpress.org
Tue Jul 9 08:22:48 UTC 2019


#42151: Create a filter to add information to query data saved when SAVEQUERIES is
true
-------------------------+---------------------
 Reporter:  CrazyJaco    |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  5.3
Component:  Database     |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:
-------------------------+---------------------

Comment (by johnbillion):

 Replying to [comment:20 pento]:
 > @johnbillion: As one of my favourite consumers of `wpdb::queries`, do
 you foresee problems with this patch?
 Thank you for your kind words. I enjoy consuming queries, in moderation.

 I'm generally in favour of this patch, but I'd like to recommend some
 changes.

 1. The signature of the `log_query()` method could be improved by
 accepting each parameter individually instead of as an array, and then
 construct the data array inside `log_query()`.
 2. Where `log_query()` is called within `_do_query()`, the
 `$this->time_start` parameter is missing. The above would help prevent
 this.
 3. I stand by my concerns in [comment:3 comment #3], filtering the entire
 data array seems risky. What's the use case for filtering the SQL, the
 time spent, the stack trace, and the start time? I would prefer a filter
 on just the "Custom query data" array.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/42151#comment:22>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list