Add amp option wp cli command to manage plugin options#7430
Add amp option wp cli command to manage plugin options#7430westonruter merged 59 commits intodevelopfrom
amp option wp cli command to manage plugin options#7430Conversation
amp option wp cli command to manage amp settingsamp option wp cli command to manage plugin options
|
Plugin builds for 68bc2ac are ready 🛎️!
|
westonruter
left a comment
There was a problem hiding this comment.
Just pulling in this previous PR review: #7368 (review)
Co-authored-by: Weston Ruter <westonruter@google.com>
westonruter
left a comment
There was a problem hiding this comment.
Code looks good! Just a few more bits of feedback.
Co-authored-by: Weston Ruter <westonruter@google.com>
8e82e22 to
0afc408
Compare
* Remove .babelrc, .eslintrc files and add *.feature file extension
… options to be managed by amp option command
… guard in update subcommand
| // Update type for some options. | ||
| if ( Option::SANDBOXING_LEVEL === $option_name ) { | ||
| $option_value = (int) $option_value; | ||
| } |
There was a problem hiding this comment.
There was a problem hiding this comment.
I believe when we update options using REST API then it first validates the options(and return any validation failures) through provided schema. In the case of '0' and '1' and 'true' and 'false' with schema type as boolean, it runs it through the rest_sanitize_boolean first hence type cast is not required but in the case of enums it fails:
Line 56 in c28b8f1
Lines 68 to 72 in c28b8f1
In other words, it doesn't reach here:
It seems like the Sandboxing service should be doing that cast to int as well since it is already doing so for bool:
Type cast here is done by REST schema's rest_sanitize_boolean IMO.
Summary
Fixes #5783
Previously #7368
Checklist