[wp-trac] Re: [WordPress Trac] #9422: Make WP transaction safe

WordPress Trac wp-trac at lists.automattic.com
Tue Mar 31 18:17:01 GMT 2009


#9422: Make WP transaction safe
-------------------------------+--------------------------------------------
 Reporter:  Denis-de-Bernardy  |       Owner:  Denis-de-Bernardy            
     Type:  enhancement        |      Status:  new                          
 Priority:  normal             |   Milestone:  2.8                          
Component:  Optimization       |     Version:  2.8                          
 Severity:  major              |    Keywords:  has-patch tested dev-feedback
-------------------------------+--------------------------------------------
Changes (by Denis-de-Bernardy):

  * keywords:  => has-patch tested dev-feedback
  * owner:  anonymous => Denis-de-Bernardy
  * version:  2.7.1 => 2.8
  * severity:  normal => major
  * milestone:  Unassigned => 2.8


Comment:

 The attach patch, against WP 2.8 latest trunk:

  1. switches the order of the delete statements where needed
  2. moves the delete_post hook call to *before* things are deleted (as is
 done for users)

 The first point has zero impact on the way things already are.

 The only point worth considering is whether calling the delete_post before
 or after makes any difference. The only place where this hook is used in
 WP is to flush the recent posts widget cache, and it indeed makes no
 difference whether it's done before or after.

 Side note: In SQL terms, this would correspond to turning an ON AFTER
 DELETE trigger into an ON BEFORE DELETE trigger. It's not a benign
 difference, but it would make the various delete_* hooks consistent
 throughout WP (for attachments, links, terms, etc, the delete hook is
 called before the actual query).

 An alternative patch would leave the current hook as is, and add a
 before_delete_post hook, e.g. before_delete_post, before the post gets
 deleted (so that tables with foreign key constraints don't complain).

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


More information about the wp-trac mailing list