|
@@ 755-760 (lines=6) @@
|
| 752 |
|
*/ |
| 753 |
|
public static function activate_module( $data ) { |
| 754 |
|
if ( Jetpack::is_module( $data['slug'] ) ) { |
| 755 |
|
if ( Jetpack::activate_module( $data['slug'], false, false ) ) { |
| 756 |
|
return rest_ensure_response( array( |
| 757 |
|
'code' => 'success', |
| 758 |
|
'message' => esc_html__( 'The requested Jetpack module was activated.', 'jetpack' ), |
| 759 |
|
) ); |
| 760 |
|
} |
| 761 |
|
return new WP_Error( 'activation_failed', esc_html__( 'The requested Jetpack module could not be activated.', 'jetpack' ), array( 'status' => 424 ) ); |
| 762 |
|
} |
| 763 |
|
|
|
@@ 1027-1032 (lines=6) @@
|
| 1024 |
|
if ( ! Jetpack::is_module_active( $data['slug'] ) ) { |
| 1025 |
|
return new WP_Error( 'already_inactive', esc_html__( 'The requested Jetpack module was already inactive.', 'jetpack' ), array( 'status' => 409 ) ); |
| 1026 |
|
} |
| 1027 |
|
if ( Jetpack::deactivate_module( $data['slug'] ) ) { |
| 1028 |
|
return rest_ensure_response( array( |
| 1029 |
|
'code' => 'success', |
| 1030 |
|
'message' => esc_html__( 'The requested Jetpack module was deactivated.', 'jetpack' ), |
| 1031 |
|
) ); |
| 1032 |
|
} |
| 1033 |
|
return new WP_Error( 'deactivation_failed', esc_html__( 'The requested Jetpack module could not be deactivated.', 'jetpack' ), array( 'status' => 400 ) ); |
| 1034 |
|
} |
| 1035 |
|
|