Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| Run_Setup | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
| handle | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Automattic\Jetpack_Boost\Modules\Optimizations\Page_Cache\Data_Sync_Actions; |
| 4 | |
| 5 | use Automattic\Jetpack\WP_JS_Data_Sync\Contracts\Data_Sync_Action; |
| 6 | use Automattic\Jetpack_Boost\Modules\Optimizations\Page_Cache\Page_Cache_Setup; |
| 7 | |
| 8 | /** |
| 9 | * Critical CSS Action: request regeneration. |
| 10 | */ |
| 11 | class Run_Setup implements Data_Sync_Action { |
| 12 | |
| 13 | /** |
| 14 | * Handles the action logic. |
| 15 | * |
| 16 | * @param mixed $_data JSON Data passed to the action. |
| 17 | * @param \WP_REST_Request $_request The request object. |
| 18 | */ |
| 19 | public function handle( $_data, $_request ) { |
| 20 | $setup_result = Page_Cache_Setup::enable(); |
| 21 | |
| 22 | if ( is_wp_error( $setup_result ) ) { |
| 23 | return $setup_result; |
| 24 | } |
| 25 | |
| 26 | return array( |
| 27 | 'success' => true, |
| 28 | 'notices' => Page_Cache_Setup::get_notices(), |
| 29 | ); |
| 30 | } |
| 31 | } |