|
@@ 738-743 (lines=6) @@
|
| 735 |
|
*/ |
| 736 |
|
public static function activate_module( $data ) { |
| 737 |
|
if ( Jetpack::is_module( $data['slug'] ) ) { |
| 738 |
|
if ( Jetpack::activate_module( $data['slug'], false, false ) ) { |
| 739 |
|
return rest_ensure_response( array( |
| 740 |
|
'code' => 'success', |
| 741 |
|
'message' => esc_html__( 'The requested Jetpack module was activated.', 'jetpack' ), |
| 742 |
|
) ); |
| 743 |
|
} |
| 744 |
|
return new WP_Error( 'activation_failed', esc_html__( 'The requested Jetpack module could not be activated.', 'jetpack' ), array( 'status' => 424 ) ); |
| 745 |
|
} |
| 746 |
|
|
|
@@ 1010-1015 (lines=6) @@
|
| 1007 |
|
if ( ! Jetpack::is_module_active( $data['slug'] ) ) { |
| 1008 |
|
return new WP_Error( 'already_inactive', esc_html__( 'The requested Jetpack module was already inactive.', 'jetpack' ), array( 'status' => 409 ) ); |
| 1009 |
|
} |
| 1010 |
|
if ( Jetpack::deactivate_module( $data['slug'] ) ) { |
| 1011 |
|
return rest_ensure_response( array( |
| 1012 |
|
'code' => 'success', |
| 1013 |
|
'message' => esc_html__( 'The requested Jetpack module was deactivated.', 'jetpack' ), |
| 1014 |
|
) ); |
| 1015 |
|
} |
| 1016 |
|
return new WP_Error( 'deactivation_failed', esc_html__( 'The requested Jetpack module could not be deactivated.', 'jetpack' ), array( 'status' => 400 ) ); |
| 1017 |
|
} |
| 1018 |
|
|