| @@ -21,9 +21,9 @@ | ||
| 21 | 21 | * Return the report title |
| 22 | 22 | * |
| 23 | 23 | * @return string |
| 24 | 24 | */ |
| 25 | - public function get_title() : string { | |
| 25 | + public function get_title(): string { | |
| 26 | 26 | return __( 'Last Sync', 'elasticpress' ); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
| @@ -30,12 +30,12 @@ | ||
| 30 | 30 | * Return the report fields |
| 31 | 31 | * |
| 32 | 32 | * @return array |
| 33 | 33 | */ |
| 34 | - public function get_groups() : array { | |
| 34 | + public function get_groups(): array { | |
| 35 | 35 | $fields = []; |
| 36 | 36 | |
| 37 | - $sync_info = \ElasticPress\IndexHelper::factory()->get_last_index(); | |
| 37 | + $sync_info = \ElasticPress\IndexHelper::factory()->get_last_sync(); | |
| 38 | 38 | |
| 39 | 39 | if ( empty( $sync_info ) ) { |
| 40 | 40 | return []; |
| 41 | 41 | } |
| @@ -70,8 +70,12 @@ | ||
| 70 | 70 | |
| 71 | 71 | $sync_info['method'] = $methods[ $sync_info['method'] ] ?? $sync_info['method']; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | + if ( isset( $sync_info['is_full_sync'] ) ) { | |
| 75 | + $sync_info['is_full_sync'] = $sync_info['is_full_sync'] ? esc_html__( 'Yes', 'elasticpress' ) : esc_html__( 'No', 'elasticpress' ); | |
| 76 | + } | |
| 77 | + | |
| 74 | 78 | $labels = [ |
| 75 | 79 | 'total' => esc_html__( 'Total', 'elasticpress' ), |
| 76 | 80 | 'synced' => esc_html__( 'Synced', 'elasticpress' ), |
| 77 | 81 | 'skipped' => esc_html__( 'Skipped', 'elasticpress' ), |
| @@ -77,8 +81,9 @@ | ||
| 77 | 81 | 'skipped' => esc_html__( 'Skipped', 'elasticpress' ), |
| 78 | 82 | 'failed' => esc_html__( 'Failed', 'elasticpress' ), |
| 79 | 83 | 'errors' => esc_html__( 'Errors', 'elasticpress' ), |
| 80 | 84 | 'method' => esc_html__( 'Method', 'elasticpress' ), |
| 85 | + 'is_full_sync' => esc_html__( 'Full Sync', 'elasticpress' ), | |
| 81 | 86 | 'end_date_time' => esc_html__( 'End Date Time', 'elasticpress' ), |
| 82 | 87 | 'start_date_time' => esc_html__( 'Start Date Time', 'elasticpress' ), |
| 83 | 88 | 'total_time' => esc_html__( 'Total Time', 'elasticpress' ), |
| 84 | 89 | ]; |
| @@ -89,9 +94,9 @@ | ||
| 89 | 94 | * As some rows could be unavailable (if the last sync was done using an older version of the plugin, for example), |
| 90 | 95 | * the usual `array_replace(array_flip())` strategy to reorder an array adds a wrong numeric value to the |
| 91 | 96 | * non-existent row. |
| 92 | 97 | */ |
| 93 | - $preferred_order = [ 'method', 'start_date_time', 'end_date_time', 'total_time', 'total', 'synced', 'skipped', 'failed', 'errors' ]; | |
| 98 | + $preferred_order = [ 'method', 'is_full_sync', 'start_date_time', 'end_date_time', 'total_time', 'total', 'synced', 'skipped', 'failed', 'errors' ]; | |
| 94 | 99 | $ordered_sync_info = []; |
| 95 | 100 | foreach ( $preferred_order as $field ) { |
| 96 | 101 | if ( array_key_exists( $field, $sync_info ) ) { |
| 97 | 102 | $ordered_sync_info[ $field ] = $sync_info[ $field ] ?? esc_html_x( 'N/A', 'Sync info not available', 'elasticpress' ); |
| @@ -105,9 +110,9 @@ | ||
| 105 | 110 | 'label' => $labels[ $label ] ?? $label, |
| 106 | 111 | 'value' => $value, |
| 107 | 112 | ]; |
| 108 | 113 | } |
| 109 | - $title = $sync_info['start_date_time']; | |
| 114 | + $title = $sync_info['start_date_time'] ?? ''; | |
| 110 | 115 | if ( false !== \ElasticPress\Utils\get_indexing_status() ) { |
| 111 | 116 | /* translators: last sync title */ |
| 112 | 117 | $title = sprintf( __( '%s (In Progress)', 'elasticpress' ), $title ); |
| 113 | 118 | } |