6
6
use Automattic \Jetpack \Sync \Actions ;
7
7
use Automattic \Jetpack \Sync \Listener ;
8
8
use Automattic \Jetpack \Sync \Queue ;
9
+ use Automattic \Jetpack \Sync \Settings ;
9
10
10
11
/**
11
12
* Control your local Jetpack installation.
@@ -832,7 +833,7 @@ public function sync( $args, $assoc_args ) {
832
833
break ;
833
834
case 'settings ' :
834
835
WP_CLI ::log ( __ ( 'Sync Settings: ' , 'jetpack ' ) );
835
- foreach ( Jetpack_Sync_Settings ::get_settings () as $ setting => $ item ) {
836
+ foreach ( Settings ::get_settings () as $ setting => $ item ) {
836
837
$ settings [] = array (
837
838
'setting ' => $ setting ,
838
839
'value ' => is_scalar ( $ item ) ? $ item : json_encode ( $ item )
@@ -841,18 +842,18 @@ public function sync( $args, $assoc_args ) {
841
842
WP_CLI \Utils \format_items ( 'table ' , $ settings , array ( 'setting ' , 'value ' ) );
842
843
843
844
case 'disable ' :
844
- // Don't set it via the Jetpack_Sync_Settings since that also resets the queues.
845
+ // Don't set it via the Settings since that also resets the queues.
845
846
update_option ( 'jetpack_sync_settings_disable ' , 1 );
846
847
/* translators: %s is the site URL */
847
848
WP_CLI ::log ( sprintf ( __ ( 'Sync Disabled on %s ' , 'jetpack ' ), get_site_url () ) );
848
849
break ;
849
850
case 'enable ' :
850
- Jetpack_Sync_Settings ::update_settings ( array ( 'disable ' => 0 ) );
851
+ Settings ::update_settings ( array ( 'disable ' => 0 ) );
851
852
/* translators: %s is the site URL */
852
853
WP_CLI ::log ( sprintf ( __ ( 'Sync Enabled on %s ' , 'jetpack ' ), get_site_url () ) );
853
854
break ;
854
855
case 'reset ' :
855
- // Don't set it via the Jetpack_Sync_Settings since that also resets the queues.
856
+ // Don't set it via the Settings since that also resets the queues.
856
857
update_option ( 'jetpack_sync_settings_disable ' , 1 );
857
858
858
859
/* translators: %s is the site URL */
@@ -887,7 +888,7 @@ public function sync( $args, $assoc_args ) {
887
888
break ;
888
889
case 'start ' :
889
890
if ( ! Actions::sync_allowed () ) {
890
- if ( ! Jetpack_Sync_Settings ::get_setting ( 'disable ' ) ) {
891
+ if ( ! Settings ::get_setting ( 'disable ' ) ) {
891
892
WP_CLI ::error ( __ ( 'Jetpack sync is not currently allowed for this site. It is currently disabled. Run `wp jetpack sync enable` to enable it. ' , 'jetpack ' ) );
892
893
return ;
893
894
}
@@ -906,19 +907,19 @@ public function sync( $args, $assoc_args ) {
906
907
907
908
}
908
909
// Get the original settings so that we can restore them later
909
- $ original_settings = Jetpack_Sync_Settings ::get_settings ();
910
+ $ original_settings = Settings ::get_settings ();
910
911
911
912
// Initialize sync settigns so we can sync as quickly as possible
912
913
$ sync_settings = wp_parse_args (
913
- array_intersect_key ( $ assoc_args , Jetpack_Sync_Settings ::$ valid_settings ),
914
+ array_intersect_key ( $ assoc_args , Settings ::$ valid_settings ),
914
915
array (
915
916
'sync_wait_time ' => 0 ,
916
917
'enqueue_wait_time ' => 0 ,
917
918
'queue_max_writes_sec ' => 10000 ,
918
919
'max_queue_size_full_sync ' => 100000
919
920
)
920
921
);
921
- Jetpack_Sync_Settings ::update_settings ( $ sync_settings );
922
+ Settings ::update_settings ( $ sync_settings );
922
923
923
924
// Convert comma-delimited string of modules to an array
924
925
if ( ! empty ( $ assoc_args ['modules ' ] ) ) {
@@ -959,7 +960,7 @@ public function sync( $args, $assoc_args ) {
959
960
} else {
960
961
961
962
// Reset sync settings to original.
962
- Jetpack_Sync_Settings ::update_settings ( $ original_settings );
963
+ Settings ::update_settings ( $ original_settings );
963
964
964
965
if ( $ modules ) {
965
966
/* translators: %s is a comma separated list of Jetpack modules */
@@ -990,7 +991,7 @@ public function sync( $args, $assoc_args ) {
990
991
} while ( $ result && ! is_wp_error ( $ result ) );
991
992
992
993
// Reset sync settings to original.
993
- Jetpack_Sync_Settings ::update_settings ( $ original_settings );
994
+ Settings ::update_settings ( $ original_settings );
994
995
995
996
WP_CLI ::success ( __ ( 'Finished syncing to WordPress.com ' , 'jetpack ' ) );
996
997
break ;
0 commit comments