| @@ 24-28 (lines=5) @@ | ||
| 21 | 		public function import( $args ) { | |
| 22 | $guid = $args[0]; | |
| 23 | $attachment_id = create_local_media_library_for_videopress_guid( $guid ); | |
| 24 | 			if ( $attachment_id && ! is_wp_error( $attachment_id ) ) { | |
| 25 | WP_CLI::success( sprintf( __( 'The video has been imported as Attachment ID %d', 'jetpack' ), $attachment_id ) ); | |
| 26 | 			} else { | |
| 27 | WP_CLI::error( __( 'An error has been encountered.', 'jetpack' ) ); | |
| 28 | } | |
| 29 | } | |
| 30 | ||
| 31 | /** | |
| @@ 59-64 (lines=6) @@ | ||
| 56 | $schedules = wp_get_schedules(); | |
| 57 | ||
| 58 | ||
| 59 | 			if ( count( $crons ) === 0 ) { | |
| 60 | WP_CLI::success( __( 'Found no available cron jobs.', 'jetpack' ) ); | |
| 61 | ||
| 62 | 			} else { | |
| 63 | WP_CLI::success( sprintf( _n( 'Found %d available cron job.', 'Found %d available cron jobs.', count( $crons ), 'jetpack' ), count( $crons ) ) ); | |
| 64 | } | |
| 65 | ||
| 66 | 			foreach ( $crons as $cron_name => $cron ) { | |
| 67 | $interval = isset( $schedules[ $cron['interval'] ]['display'] ) ? $schedules[ $cron['interval'] ]['display'] : $cron['interval']; | |
| @@ 103-108 (lines=6) @@ | ||
| 100 | ||
| 101 | $time = $scheduler->check_cron( $args[0] ); | |
| 102 | ||
| 103 | 			if ( ! $time ) { | |
| 104 | WP_CLI::success( __( 'The cron is not scheduled to run.', 'jetpack' ) ); | |
| 105 | ||
| 106 | 			} else { | |
| 107 | WP_CLI::success( sprintf( __( 'Cron will run at: %s GMT', 'jetpack' ), gmdate( 'Y-m-d H:i:s', $time ) ) ); | |
| 108 | } | |
| 109 | } | |
| 110 | ||
| 111 | /** | |
| @@ 481-487 (lines=7) @@ | ||
| 478 | * Clear the whitelist | |
| 479 | */ | |
| 480 | 				if ( isset( $args[1] ) && 'clear' == $args[1] ) { | |
| 481 | 					if ( ! empty( $whitelist ) ) { | |
| 482 | $whitelist = array(); | |
| 483 | jetpack_protect_save_whitelist( $whitelist ); | |
| 484 | WP_CLI::success( __( 'Cleared all whitelisted IPs', 'jetpack' ) ); | |
| 485 | 					} else { | |
| 486 | WP_CLI::line( __( 'Whitelist is empty.', "jetpack" ) ) ; | |
| 487 | } | |
| 488 | break; | |
| 489 | } | |
| 490 | ||
| @@ 714-718 (lines=5) @@ | ||
| 711 | ||
| 712 | // Kick off a full sync | |
| 713 | 				if ( Jetpack_Sync_Actions::do_full_sync( $modules ) ) { | |
| 714 | 					if ( $modules ) { | |
| 715 | WP_CLI::log( sprintf( __( 'Initialized a new full sync with modules: %s', 'jetpack' ), join( ', ', array_keys( $modules ) ) ) ); | |
| 716 | 					} else { | |
| 717 | WP_CLI::log( __( 'Initialized a new full sync', 'jetpack' ) ); | |
| 718 | } | |
| 719 | 				} else { | |
| 720 | ||
| 721 | // Reset sync settings to original. | |
| @@ 719-729 (lines=11) @@ | ||
| 716 | 					} else { | |
| 717 | WP_CLI::log( __( 'Initialized a new full sync', 'jetpack' ) ); | |
| 718 | } | |
| 719 | 				} else { | |
| 720 | ||
| 721 | // Reset sync settings to original. | |
| 722 | Jetpack_Sync_Settings::update_settings( $original_settings ); | |
| 723 | ||
| 724 | 					if ( $modules ) { | |
| 725 | WP_CLI::error( sprintf( __( 'Could not start a new full sync with modules: %s', 'jetpack' ), join( ', ', $modules ) ) ); | |
| 726 | 					} else { | |
| 727 | WP_CLI::error( __( 'Could not start a new full sync', 'jetpack' ) ); | |
| 728 | } | |
| 729 | } | |
| 730 | ||
| 731 | // Keep sending to WPCOM until there's nothing to send | |
| 732 | $i = 1; | |