| @@ -296,8 +296,9 @@ | ||
| 296 | 296 | 'status' => 'running', |
| 297 | 297 | 'scan_id' => $polled['scan_id'], |
| 298 | 298 | 'step' => $polled['step'], |
| 299 | 299 | 'latest' => Scan::latest(), |
| 300 | + 'stored' => Scan::stored_state(), | |
| 300 | 301 | 'visibility' => Scan::visibility(), |
| 301 | 302 | 'private_supported' => Scan::private_supported(), |
| 302 | 303 | ) |
| 303 | 304 | ); |
| @@ -305,8 +306,9 @@ | ||
| 305 | 306 | return rest_ensure_response( |
| 306 | 307 | array( |
| 307 | 308 | 'status' => 'complete', |
| 308 | 309 | 'latest' => $polled, |
| 310 | + 'stored' => 'ok', | |
| 309 | 311 | 'visibility' => Scan::visibility(), |
| 310 | 312 | 'private_supported' => Scan::private_supported(), |
| 311 | 313 | ) |
| 312 | 314 | ); |
| @@ -315,8 +317,9 @@ | ||
| 315 | 317 | return rest_ensure_response( |
| 316 | 318 | array( |
| 317 | 319 | 'status' => 'idle', |
| 318 | 320 | 'latest' => Scan::latest(), |
| 321 | + 'stored' => Scan::stored_state(), | |
| 319 | 322 | 'visibility' => Scan::visibility(), |
| 320 | 323 | 'private_supported' => Scan::private_supported(), |
| 321 | 324 | ) |
| 322 | 325 | ); |
| @@ -925,8 +928,12 @@ | ||
| 925 | 928 | return; |
| 926 | 929 | } |
| 927 | 930 | |
| 928 | 931 | $latest = Scan::latest(); |
| 932 | + if ( null === $latest && 'unreadable' === Scan::stored_state() ) { | |
| 933 | + \WP_CLI::log( 'The last scan report could not be read back from the database and was discarded. Run `wp xspeed scan run --wait` again.' ); | |
| 934 | + return; | |
| 935 | + } | |
| 929 | 936 | if ( null === $latest ) { |
| 930 | 937 | \WP_CLI::log( 'No scan yet. Run `wp xspeed scan run --wait`.' ); |
| 931 | 938 | return; |
| 932 | 939 | } |