[wp-trac] [WordPress Trac] #43316: REST API: Support autosaves

WordPress Trac noreply at wordpress.org
Fri Oct 19 12:37:14 UTC 2018


#43316: REST API: Support autosaves
---------------------------------------------+-----------------------
 Reporter:  kraftbj                          |       Owner:  rmccue
     Type:  enhancement                      |      Status:  assigned
 Priority:  normal                           |   Milestone:  5.0
Component:  REST API                         |     Version:
 Severity:  normal                           |  Resolution:
 Keywords:  has-patch has-unit-tests commit  |     Focuses:  rest-api
---------------------------------------------+-----------------------

Comment (by azaozz):

 Looking at 43316.21.diff, adding a filter for `DOING_AUTOSAVE` fixes
 testing but introduces possible regressions in plugins and themes. A quick
 search on GH shows
 [https://github.com/search?l=&q=DOING_AUTOSAVE+extension%3Aphp&type=Code
 350k hits for "DOING_AUTOSAVE"] (need to be logged in there), a lot more
 than what I'd expect. It's also used in TwentySixteen and TwentySeventeen.
 In that terms I don't think a filter is a good option.

 Other possible solution would be to define `DOING_AUTOSAVE` conditionally,
 only when not running PHP tests. We already have `WP_RUN_CORE_TESTS` for
 this (set in phpunit.xml.dist). Or even better: we can have a helper
 function to determine if tests are running, similarly to `is_admin()`,
 etc.

 In any case, we shouldn't add any changes that may introduce regressions,
 and not defining `DOING_AUTOSAVE` when in fact we are doing autosave seems
 to be one.

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


More information about the wp-trac mailing list