|
@@ 625-630 (lines=6) @@
|
| 622 |
|
*/ |
| 623 |
|
public static function activate_module( $data ) { |
| 624 |
|
if ( Jetpack::is_module( $data['slug'] ) ) { |
| 625 |
|
if ( Jetpack::activate_module( $data['slug'], false, false ) ) { |
| 626 |
|
return rest_ensure_response( array( |
| 627 |
|
'code' => 'success', |
| 628 |
|
'message' => esc_html__( 'The requested Jetpack module was activated.', 'jetpack' ), |
| 629 |
|
) ); |
| 630 |
|
} |
| 631 |
|
return new WP_Error( 'activation_failed', esc_html__( 'The requested Jetpack module could not be activated.', 'jetpack' ), array( 'status' => 424 ) ); |
| 632 |
|
} |
| 633 |
|
|
|
@@ 899-904 (lines=6) @@
|
| 896 |
|
if ( ! Jetpack::is_module_active( $data['slug'] ) ) { |
| 897 |
|
return new WP_Error( 'already_inactive', esc_html__( 'The requested Jetpack module was already inactive.', 'jetpack' ), array( 'status' => 409 ) ); |
| 898 |
|
} |
| 899 |
|
if ( Jetpack::deactivate_module( $data['slug'] ) ) { |
| 900 |
|
return rest_ensure_response( array( |
| 901 |
|
'code' => 'success', |
| 902 |
|
'message' => esc_html__( 'The requested Jetpack module was deactivated.', 'jetpack' ), |
| 903 |
|
) ); |
| 904 |
|
} |
| 905 |
|
return new WP_Error( 'deactivation_failed', esc_html__( 'The requested Jetpack module could not be deactivated.', 'jetpack' ), array( 'status' => 400 ) ); |
| 906 |
|
} |
| 907 |
|
|