|
@@ 692-697 (lines=6) @@
|
| 689 |
|
*/ |
| 690 |
|
public static function activate_module( $data ) { |
| 691 |
|
if ( Jetpack::is_module( $data['slug'] ) ) { |
| 692 |
|
if ( Jetpack::activate_module( $data['slug'], false, false ) ) { |
| 693 |
|
return rest_ensure_response( array( |
| 694 |
|
'code' => 'success', |
| 695 |
|
'message' => esc_html__( 'The requested Jetpack module was activated.', 'jetpack' ), |
| 696 |
|
) ); |
| 697 |
|
} |
| 698 |
|
return new WP_Error( 'activation_failed', esc_html__( 'The requested Jetpack module could not be activated.', 'jetpack' ), array( 'status' => 424 ) ); |
| 699 |
|
} |
| 700 |
|
|
|
@@ 966-971 (lines=6) @@
|
| 963 |
|
if ( ! Jetpack::is_module_active( $data['slug'] ) ) { |
| 964 |
|
return new WP_Error( 'already_inactive', esc_html__( 'The requested Jetpack module was already inactive.', 'jetpack' ), array( 'status' => 409 ) ); |
| 965 |
|
} |
| 966 |
|
if ( Jetpack::deactivate_module( $data['slug'] ) ) { |
| 967 |
|
return rest_ensure_response( array( |
| 968 |
|
'code' => 'success', |
| 969 |
|
'message' => esc_html__( 'The requested Jetpack module was deactivated.', 'jetpack' ), |
| 970 |
|
) ); |
| 971 |
|
} |
| 972 |
|
return new WP_Error( 'deactivation_failed', esc_html__( 'The requested Jetpack module could not be deactivated.', 'jetpack' ), array( 'status' => 400 ) ); |
| 973 |
|
} |
| 974 |
|
|