diff --git a/projects/packages/my-jetpack/src/class-initializer.php b/projects/packages/my-jetpack/src/class-initializer.php index 256cb32d415ed..2b96ea802e97d 100644 --- a/projects/packages/my-jetpack/src/class-initializer.php +++ b/projects/packages/my-jetpack/src/class-initializer.php @@ -278,10 +278,7 @@ public static function enqueue_scripts() { array( 'blocked_logins' => (int) get_site_option( 'jetpack_protect_blocked_attempts', 0 ) ) ), ), - 'videopress' => array( - 'featuredStats' => self::get_videopress_stats(), - 'videoCount' => array_sum( (array) wp_count_attachments( 'video' ) ), - ), + 'videopress' => self::get_videopress_stats(), ) ); @@ -309,13 +306,20 @@ public static function enqueue_scripts() { * @return array|WP_Error */ public static function get_videopress_stats() { + $video_count = array_sum( (array) wp_count_attachments( 'video' ) ); + if ( ! class_exists( 'Automattic\Jetpack\VideoPress\Stats' ) ) { - return array(); + return array( + 'videoCount' => $video_count, + ); } $videopress_stats = new VideoPress_Stats(); - return $videopress_stats->get_featured_stats(); + return array( + 'featuredStats' => $videopress_stats->get_featured_stats(), + 'videoCount' => $video_count, + ); } /** diff --git a/projects/packages/my-jetpack/src/class-rest-product-data.php b/projects/packages/my-jetpack/src/class-rest-product-data.php index 15530adb28174..123d8cf0965e1 100644 --- a/projects/packages/my-jetpack/src/class-rest-product-data.php +++ b/projects/packages/my-jetpack/src/class-rest-product-data.php @@ -114,7 +114,7 @@ public static function get_site_backup_undo_event() { * This will collect a count of all the items that could be backed up * This is used to show what backup could be doing if it is not enabled * - * @return WP_Error|\WP_REST_Response + * @return WP_Error|array */ public static function count_things_that_can_be_backed_up() { $image_mime_type = 'image';