[wp-trac] [WordPress Trac] #29710: Add hooks to wpdb's insert(), update(), delete() and similar methods

WordPress Trac noreply at wordpress.org
Mon Jul 27 13:28:29 UTC 2015


#29710: Add hooks to wpdb's insert(), update(), delete() and similar methods
-------------------------+------------------------------
 Reporter:  borekb       |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Database     |     Version:  2.5
 Severity:  normal       |  Resolution:
 Keywords:  2nd-opinion  |     Focuses:
-------------------------+------------------------------

Comment (by borekb):

 Replying to [comment:16 SergeyBiryukov]:

 That would still allow only one plugin / drop-in to hook into the query if
 I understand it correctly. We tried to take your idea a bit further and
 replace inheritance with composition by creating a proxy class and
 replacing `$wpdb` with that. It worked but there were still some issues
 with that approach:

 * If the proxy was created manually, it was quite a bit of work
 * New releases of WordPress might break the proxy, e.g., if there are new
 public members in `wpdb`
 * The proxy can be generated on-the-fly using a library like
 [https://github.com/Ocramius/ProxyManager ProxyManager] but that has its
 own set of issues:
   * The external dependency is quite large (look at the source code of
 ProxyManager)
   * It is PHP 5.5+ only and there's not a lot of choice amongst those
 libraries

 New built-in hooks / filters still seem like a vastly preferable solution.

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


More information about the wp-trac mailing list