get_error_code() === 'report-not-found' ) { return array( 'status' => 'not-found', 'message' => __( 'Report not found.', 'jetpack-boost' ), ); } // Other kinds of errors are a problem. return array( 'status' => 'error', 'message' => $report->get_error_message(), ); } if ( isset( $report['status'] ) && $report['status'] === 'completed' && empty( $report['groups'] ) ) { return array( 'status' => 'error', 'message' => __( 'Report is incomplete. Missing groups.', 'jetpack-boost' ), ); } $fixes = Image_Size_Analysis_Fixer::get_all_fixes(); if ( ! empty( $fixes ) ) { // $fixes is an array of post_ids. which is an array of image fixes. count the number of image fixes. $fixed_count = 0; foreach ( $fixes as $image_fixes ) { $fixed_count += count( $image_fixes ); } // add fixed group object to $report->groups $report['groups']['fixed'] = array(); $report['groups']['fixed']['issue_count'] = $fixed_count; $report['groups']['fixed']['scanned_pages'] = count( $fixes ); $report['groups']['fixed']['total_pages'] = 1; } // disable the fixed group for now. unset( $report['groups']['fixed'] ); return $report; } }