| @@ -803,12 +803,18 @@ | ||
| 803 | 803 | $wp_upgrades = MainWP_DB::instance()->get_website_option( $site, 'wp_upgrades' ); |
| 804 | 804 | $wp_upgrades = ! empty( $wp_upgrades ) ? json_decode( $wp_upgrades, true ) : array(); |
| 805 | 805 | $wp_update_available = is_array( $wp_upgrades ) && ! empty( $wp_upgrades ); |
| 806 | 806 | |
| 807 | - // Get health score if available. | |
| 807 | + // Get health score if available. The health_value column is a sortable | |
| 808 | + // composite (score - critical * 100) that goes negative when critical | |
| 809 | + // issues exist; recompute the real 0-100 score from the stored Site | |
| 810 | + // Health issue counts like the REST and UI surfaces do. | |
| 808 | 811 | $health_score = null; |
| 809 | - if ( isset( $site->health_value ) ) { | |
| 810 | - $health_score = (int) $site->health_value; | |
| 812 | + // json_format=true returns a guaranteed array (scalars coerced to array()). | |
| 813 | + $health_status = MainWP_DB::instance()->get_website_option( $site, 'health_site_status', array(), true ); | |
| 814 | + if ( ! empty( $health_status ) ) { | |
| 815 | + $hstatus = MainWP_Utility::get_site_health( $health_status ); | |
| 816 | + $health_score = (int) $hstatus['val']; | |
| 811 | 817 | } |
| 812 | 818 | |
| 813 | 819 | return array( |
| 814 | 820 | 'plugin_updates' => $plugin_count, |