[wp-trac] [WordPress Trac] #10788: (set|delete)_transient need some filters

WordPress Trac wp-trac at lists.automattic.com
Mon Nov 30 05:47:27 UTC 2009


#10788: (set|delete)_transient need some filters
--------------------------+-------------------------------------------------
 Reporter:  dd32          |       Owner:  ryan                  
     Type:  defect (bug)  |      Status:  new                   
 Priority:  normal        |   Milestone:  2.9                   
Component:  Cache         |     Version:  2.9                   
 Severity:  normal        |    Keywords:  has-patch dev-feedback
--------------------------+-------------------------------------------------

Comment(by nacin):

 This is probably too big for 2.9, and with the merge in 3.0, some of this
 may become irrelevant (or important). That said, I wanted to get it out
 there:

 Latest patch standardizes actions and filters across all 14 option and
 transient functions (including their MU counterparts). Phpdoc, whitespace,
 and code cleanup as well.

  - The pre_* filters (some of which I think were added) now require null
 instead of false to bypass per dd32's suggestion. Presents a back compat
 issue, however.
  - All action option/transient functions (update/set/add/delete) now run
 the same three actions, one before (i.e. delete_option) and, on success,
 two after (e.g. delete_option_$option and deleted_option).
  - Standardizes references to the word "option" (previously, various
 functions used "option name", "key" and "setting" in parameters, variables
 and phpdoc). Likewise, a parameter of "newvalue" would now be "value,"
 etc.
  - reference to $wpdb removed from transient functions, which don't use
 it.
  - Numerous actions were added to MU wrapper functions that would need to
 be added to their MU counterparts.

 Hook and logic changes function by function:

 == Option Changes ==

 get_option() -
  - pre_option_$option now uses null instead of false to continue. (Back
 compat issue)

 update_option() -
  - If add_option is used, then return result of add_option, not simply
 true.

 add_option() -
  - pre_add_option_$option filter added. (Exists in add_site_option
 already.)
  - autoload parameter is now true/false, not 'yes' and 'no', but still
 accepts 'yes' and 'no'.
  - now returns true on success and false on failure, instead of alwauys
 returning null.

 delete_option() -
  - delete_option_$option action added.

 get_site_option() -
  - pre_site_option_$option filter now uses null instead of false. (Back
 compat issue)

 add_site_option() -
  - add_site_option, added_site_option actions added.
 (add_site_option_$option already existed.)

 delete_site_option() -
  - delete_site_option, deleted_site_option actions added.
 (delete_site_option_$option already existed.)

 update_site_option() -
  - Now includes logic (from update_option) that allows it to call
 add_site_option, instead of allowing update_option to call add_option, if
 the option doesn't exist. (Also now returns false if the value isn't
 changed, like update_option.)
  - update_site_option, updated_site_option actions added.
 (update_site_option_$option already existed.)

 == Transient Changes ==

 delete_transient(), delete_site_transient() -
  - delete_(site_)transient, delete_(site_)transient_$transient, and
 deleted_(site_)transient actions added.

 get_transient(), get_site_transient() -
  - pre_(site_)transient_$transient filter now uses null instead of false.
 (Back compat issue)

 set_transient(), set_site_transient() -
  - pre_set_(site_)transient_$transient and
 pre_set_(site_)transient_expiration_$transient filters added.
  - set_(site_)transient, set_(site_)transient_$transient, and
 setted_(site_)transient actions added.

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


More information about the wp-trac mailing list