| @@ 403-412 (lines=10) @@ | ||
| 400 | $updates = $this->get_updates( 'database', 'new' ); |
|
| 401 | ||
| 402 | // Bailout if we do not have nay updates. |
|
| 403 | if ( empty( $updates ) ) { |
|
| 404 | $this->send_ajax_response( |
|
| 405 | array( |
|
| 406 | 'message' => __( 'The database is already up to date.', 'give' ), |
|
| 407 | 'heading' => __( 'Updates Completed.', 'give' ), |
|
| 408 | 'percentage' => 0, |
|
| 409 | ), |
|
| 410 | 'success' |
|
| 411 | ); |
|
| 412 | } |
|
| 413 | ||
| 414 | ||
| 415 | // Process update. |
|
| @@ 418-431 (lines=14) @@ | ||
| 415 | // Process update. |
|
| 416 | foreach ( $updates as $index => $update ) { |
|
| 417 | // Check if update depend upon any other update. |
|
| 418 | if ( ! $this->is_parent_updates_completed( $update ) ) { |
|
| 419 | if ( 1 === count( $updates ) ) { |
|
| 420 | $this->send_ajax_response( |
|
| 421 | array( |
|
| 422 | 'message' => __( 'Error occurred while running current update because it contains invalid update dependencies', 'give' ), |
|
| 423 | 'heading' => '', |
|
| 424 | 'percentage' => 0, |
|
| 425 | ), |
|
| 426 | 'error' |
|
| 427 | ); |
|
| 428 | } |
|
| 429 | ||
| 430 | continue; |
|
| 431 | } |
|
| 432 | ||
| 433 | // Run update. |
|
| 434 | if ( is_array( $update['callback'] ) ) { |
|
| @@ 441-452 (lines=12) @@ | ||
| 438 | } |
|
| 439 | ||
| 440 | // Check if current update completed or not. |
|
| 441 | if ( give_has_upgrade_completed( $update['id'] ) ) { |
|
| 442 | if ( 1 === count( $updates ) ) { |
|
| 443 | $this->send_ajax_response( |
|
| 444 | array( |
|
| 445 | 'message' => __( 'Database updated successfully.', 'give' ), |
|
| 446 | 'heading' => __( 'Updates Completed.', 'give' ), |
|
| 447 | 'percentage' => 0, |
|
| 448 | ), |
|
| 449 | 'success' |
|
| 450 | ); |
|
| 451 | } |
|
| 452 | } |
|
| 453 | ||
| 454 | $doing_upgrade_args = array( |
|
| 455 | 'update_info' => $update, |
|