PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.7
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.7
16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 All 506 releases
← All changes | modules/videopress/class.videopress-cli.php +10 -5 12.1.3 → 16.3-a.7 View file →
@@ -4,8 +4,12 @@
4 4 *
5 5 * @package automattic/jetpack
6 6 */
7 7
8 +if ( ! defined( 'ABSPATH' ) ) {
9 + exit( 0 );
10 +}
11 +
8 12 if ( defined( 'WP_CLI' ) && WP_CLI ) {
9 13
10 14 /**
11 15 * VideoPress command line utilities.
@@ -57,23 +61,24 @@
57 61 * wp videopress list_crons
58 62 */
59 63 public function list_crons() {
60 64
61 - $scheduler = VideoPress_Scheduler::init();
62 - $crons = $scheduler->get_crons();
65 + $scheduler = VideoPress_Scheduler::init();
66 + $crons = $scheduler->get_crons();
67 + $crons_count = is_countable( $crons ) ? count( $crons ) : 0;
63 68
64 69 $schedules = wp_get_schedules();
65 70
66 - if ( count( $crons ) === 0 ) {
71 + if ( $crons_count === 0 ) {
67 72 WP_CLI::success( __( 'Found no available cron jobs.', 'jetpack' ) );
68 73
69 74 } else {
70 75 /* translators: %d is the number of crons */
71 - WP_CLI::success( sprintf( _n( 'Found %d available cron job.', 'Found %d available cron jobs.', count( $crons ), 'jetpack' ), count( $crons ) ) );
76 + WP_CLI::success( sprintf( _n( 'Found %d available cron job.', 'Found %d available cron jobs.', $crons_count, 'jetpack' ), $crons_count ) );
72 77 }
73 78
74 79 foreach ( $crons as $cron_name => $cron ) {
75 - $interval = isset( $schedules[ $cron['interval'] ]['display'] ) ? $schedules[ $cron['interval'] ]['display'] : $cron['interval'];
80 + $interval = $schedules[ $cron['interval'] ]['display'] ?? $cron['interval'];
76 81 $runs_next = $scheduler->check_cron( $cron_name );
77 82 $status = $runs_next ? sprintf( 'Scheduled - Runs Next at %s GMT', gmdate( 'Y-m-d H:i:s', $runs_next ) ) : 'Not Scheduled';
78 83
79 84 WP_CLI::log( 'Name: ' . $cron_name );