: Import the video with the specified guid
*
* ## EXAMPLES
*
* wp videopress import kUJmAcSf
*
* @param array $args CLI arguments.
*/
public function import( $args ) {
$guid = $args[0];
$attachment_id = create_local_media_library_for_videopress_guid( $guid );
if ( $attachment_id && ! is_wp_error( $attachment_id ) ) {
/* translators: %d: attachment id */
WP_CLI::success( sprintf( __( 'The video has been imported as Attachment ID %d', 'jetpack' ), $attachment_id ) );
} else {
WP_CLI::error( __( 'An error has been encountered.', 'jetpack' ) );
}
}
/**
* Manually runs the job to cleanup videos from the media library that failed during the upload process.
*
* ## EXAMPLES
*
* wp videopress cleanup_videos
*/
public function cleanup_videos() {
$num_cleaned = videopress_cleanup_media_library();
/* translators: %d: number of videos cleaned */
WP_CLI::success( sprintf( _n( 'Cleaned up %d video.', 'Cleaned up a total of %d videos.', $num_cleaned, 'jetpack' ), $num_cleaned ) );
}
/**
* List out all of the crons that can be run.
*
* ## EXAMPLES
*
* wp videopress list_crons
*/
public function list_crons() {
$scheduler = VideoPress_Scheduler::init();
$crons = $scheduler->get_crons();
$crons_count = is_countable( $crons ) ? count( $crons ) : 0;
$schedules = wp_get_schedules();
if ( $crons_count === 0 ) {
WP_CLI::success( __( 'Found no available cron jobs.', 'jetpack' ) );
} else {
/* translators: %d is the number of crons */
WP_CLI::success( sprintf( _n( 'Found %d available cron job.', 'Found %d available cron jobs.', $crons_count, 'jetpack' ), $crons_count ) );
}
foreach ( $crons as $cron_name => $cron ) {
$interval = isset( $schedules[ $cron['interval'] ]['display'] ) ? $schedules[ $cron['interval'] ]['display'] : $cron['interval'];
$runs_next = $scheduler->check_cron( $cron_name );
$status = $runs_next ? sprintf( 'Scheduled - Runs Next at %s GMT', gmdate( 'Y-m-d H:i:s', $runs_next ) ) : 'Not Scheduled';
WP_CLI::log( 'Name: ' . $cron_name );
WP_CLI::log( 'Method: ' . $cron['method'] );
WP_CLI::log( 'Interval: ' . $interval );
WP_CLI::log( 'Status: ' . $status );
}
}
/**
* Checks for the current status of a cron job.
*
* ## OPTIONS
*
*