Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| Run_Setup | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
| handle | |
0.00% |
0 / 9 |
|
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\Garbage_Collection; |
| 7 | use Automattic\Jetpack_Boost\Modules\Optimizations\Page_Cache\Page_Cache_Setup; |
| 8 | use Automattic\Jetpack_Boost\Modules\Optimizations\Page_Cache\Pre_WordPress\Boost_Cache_Settings; |
| 9 | |
| 10 | /** |
| 11 | * Critical CSS Action: request regeneration. |
| 12 | */ |
| 13 | class Run_Setup implements Data_Sync_Action { |
| 14 | |
| 15 | /** |
| 16 | * Handles the action logic. |
| 17 | * |
| 18 | * @param mixed $_data JSON Data passed to the action. |
| 19 | * @param \WP_REST_Request $_request The request object. |
| 20 | */ |
| 21 | public function handle( $_data, $_request ) { |
| 22 | $setup_result = Page_Cache_Setup::run_setup(); |
| 23 | |
| 24 | if ( is_wp_error( $setup_result ) ) { |
| 25 | return $setup_result; |
| 26 | } |
| 27 | |
| 28 | Garbage_Collection::activate(); |
| 29 | Boost_Cache_Settings::get_instance()->set( array( 'enabled' => true ) ); |
| 30 | |
| 31 | return array( |
| 32 | 'success' => true, |
| 33 | 'notices' => Page_Cache_Setup::get_notices(), |
| 34 | ); |
| 35 | } |
| 36 | } |