|
@@ 730-735 (lines=6) @@
|
| 727 |
|
*/ |
| 728 |
|
public static function activate_module( $data ) { |
| 729 |
|
if ( Jetpack::is_module( $data['slug'] ) ) { |
| 730 |
|
if ( Jetpack::activate_module( $data['slug'], false, false ) ) { |
| 731 |
|
return rest_ensure_response( array( |
| 732 |
|
'code' => 'success', |
| 733 |
|
'message' => esc_html__( 'The requested Jetpack module was activated.', 'jetpack' ), |
| 734 |
|
) ); |
| 735 |
|
} |
| 736 |
|
return new WP_Error( 'activation_failed', esc_html__( 'The requested Jetpack module could not be activated.', 'jetpack' ), array( 'status' => 424 ) ); |
| 737 |
|
} |
| 738 |
|
|
|
@@ 1003-1008 (lines=6) @@
|
| 1000 |
|
if ( ! Jetpack::is_module_active( $data['slug'] ) ) { |
| 1001 |
|
return new WP_Error( 'already_inactive', esc_html__( 'The requested Jetpack module was already inactive.', 'jetpack' ), array( 'status' => 409 ) ); |
| 1002 |
|
} |
| 1003 |
|
if ( Jetpack::deactivate_module( $data['slug'] ) ) { |
| 1004 |
|
return rest_ensure_response( array( |
| 1005 |
|
'code' => 'success', |
| 1006 |
|
'message' => esc_html__( 'The requested Jetpack module was deactivated.', 'jetpack' ), |
| 1007 |
|
) ); |
| 1008 |
|
} |
| 1009 |
|
return new WP_Error( 'deactivation_failed', esc_html__( 'The requested Jetpack module could not be deactivated.', 'jetpack' ), array( 'status' => 400 ) ); |
| 1010 |
|
} |
| 1011 |
|
|