[wp-trac] [WordPress Trac] #43159: Introduce helper function for XMLRPC checks

WordPress Trac noreply at wordpress.org
Fri Jan 26 14:55:11 UTC 2018


#43159: Introduce helper function for XMLRPC checks
----------------------------+------------------------------
 Reporter:  NathanAtmoz     |       Owner:
     Type:  enhancement     |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Bootstrap/Load  |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |     Focuses:
----------------------------+------------------------------
Changes (by birgire):

 * keywords:   => has-patch


Comment:

 Thanks for the patch @NathanAtmoz

 I'm not sure what the consensus is regarding {{{wp_doing_xmlrpc()}}} but
 we now have {{{wp_doing_ajax()}}} since 4.7 and {{{wp_doing_cron()}}}
 since 4.8. So it would seem logical to introduce it.

 I reviewed [attachment:43159.diff] and here are some notes:

 - I don't think we should add {{{wp_doing_xmlrpc()}}} in that line in
 {{{wp-cron.php}}}, because that file can be called directly, (see e.g.
 {{{spawn_cron()}}} ) and then {{{wp_doing_xmlrpc()}}} wouldn't be defined
 and resulting in a PHP error.
 - It removes the {{{|| defined( 'DOING_AJAX' )}}} check in
 {{{is_admin_bar_showing()}}}. I think that removal must have been
 accidental and should be reverted.
 - I found an extra {{{defined( 'XMLRPC_REQUEST' )}}} check in
 {{{spawn_cron()}}} [[https://core.trac.wordpress.org/browser/tags/4.9/src
 /wp-includes/cron.php#L275 src]], but I noticed that {{{defined(
 'DOING_AJAX' )}}} and {{{defined( 'DOING_CRON' )}}} have not been
 replaced. Most likely a reason for that, but we could look further into
 that.
 - I also found an extra {{{defined( 'XMLRPC_REQUEST' )}}} check in
 {{{_publish_post_hook()}}}
 [[https://core.trac.wordpress.org/browser/tags/4.9/src/wp-
 includes/post.php#L6003 src]], that seems to be a valid replacement for
 {{{wp_doing_xmlrpc()}}}.

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


More information about the wp-trac mailing list