@@ 23-27 (lines=5) @@ | ||
20 | public function import( $args ) { |
|
21 | $guid = $args[0]; |
|
22 | $attachment_id = create_local_media_library_for_videopress_guid( $guid ); |
|
23 | if ( $attachment_id && ! is_wp_error( $attachment_id ) ) { |
|
24 | WP_CLI::success( sprintf( __( 'The video has been imported as Attachment ID %d', 'jetpack' ), $attachment_id ) ); |
|
25 | } else { |
|
26 | WP_CLI::error( __( 'An error has been encountered.', 'jetpack' ) ); |
|
27 | } |
|
28 | } |
|
29 | ||
30 | /** |
|
@@ 57-62 (lines=6) @@ | ||
54 | ||
55 | $schedules = wp_get_schedules(); |
|
56 | ||
57 | if ( count( $crons ) === 0 ) { |
|
58 | WP_CLI::success( __( 'Found no available cron jobs.', 'jetpack' ) ); |
|
59 | ||
60 | } else { |
|
61 | WP_CLI::success( sprintf( _n( 'Found %d available cron job.', 'Found %d available cron jobs.', count( $crons ), 'jetpack' ), count( $crons ) ) ); |
|
62 | } |
|
63 | ||
64 | foreach ( $crons as $cron_name => $cron ) { |
|
65 | $interval = isset( $schedules[ $cron['interval'] ]['display'] ) ? $schedules[ $cron['interval'] ]['display'] : $cron['interval']; |
|
@@ 101-106 (lines=6) @@ | ||
98 | ||
99 | $time = $scheduler->check_cron( $args[0] ); |
|
100 | ||
101 | if ( ! $time ) { |
|
102 | WP_CLI::success( __( 'The cron is not scheduled to run.', 'jetpack' ) ); |
|
103 | ||
104 | } else { |
|
105 | WP_CLI::success( sprintf( __( 'Cron will run at: %s GMT', 'jetpack' ), gmdate( 'Y-m-d H:i:s', $time ) ) ); |
|
106 | } |
|
107 | } |
|
108 | ||
109 | /** |
@@ 278-287 (lines=10) @@ | ||
275 | ||
276 | $is_dry_run = ! empty( $assoc_args['dry-run'] ); |
|
277 | ||
278 | if ( $is_dry_run ) { |
|
279 | WP_CLI::warning( |
|
280 | __( "\nThis is a dry run.\n", 'jetpack' ) . |
|
281 | __( "No actions will be taken.\n", 'jetpack' ) . |
|
282 | __( "The following messages will give you preview of what will happen when you run this command.\n\n", 'jetpack' ) |
|
283 | ); |
|
284 | } else { |
|
285 | // We only need to confirm "Are you sure?" when we are not doing a dry run. |
|
286 | jetpack_cli_are_you_sure(); |
|
287 | } |
|
288 | ||
289 | switch ( $action ) { |
|
290 | case 'options': |
|
@@ 966-971 (lines=6) @@ | ||
963 | ||
964 | // Kick off a full sync |
|
965 | if ( Actions::do_full_sync( $modules ) ) { |
|
966 | if ( $modules ) { |
|
967 | /* translators: %s is a comma separated list of Jetpack modules */ |
|
968 | WP_CLI::log( sprintf( __( 'Initialized a new full sync with modules: %s', 'jetpack' ), join( ', ', array_keys( $modules ) ) ) ); |
|
969 | } else { |
|
970 | WP_CLI::log( __( 'Initialized a new full sync', 'jetpack' ) ); |
|
971 | } |
|
972 | } else { |
|
973 | ||
974 | // Reset sync settings to original. |
|
@@ 972-983 (lines=12) @@ | ||
969 | } else { |
|
970 | WP_CLI::log( __( 'Initialized a new full sync', 'jetpack' ) ); |
|
971 | } |
|
972 | } else { |
|
973 | ||
974 | // Reset sync settings to original. |
|
975 | Settings::update_settings( $original_settings ); |
|
976 | ||
977 | if ( $modules ) { |
|
978 | /* translators: %s is a comma separated list of Jetpack modules */ |
|
979 | WP_CLI::error( sprintf( __( 'Could not start a new full sync with modules: %s', 'jetpack' ), join( ', ', $modules ) ) ); |
|
980 | } else { |
|
981 | WP_CLI::error( __( 'Could not start a new full sync', 'jetpack' ) ); |
|
982 | } |
|
983 | } |
|
984 | ||
985 | // Keep sending to WPCOM until there's nothing to send |
|
986 | $i = 1; |