Changeset 51902
- Timestamp:
- 10/11/2021 03:07:52 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-upgrader.php
r51899 r51902 844 844 if ( is_wp_error( $result ) ) { 845 845 if ( ! empty( $options['hook_extra']['temp_backup'] ) ) { 846 $this->restore_temp_backup( $options['hook_extra']['temp_backup'] ); 846 /* 847 * Restore the backup on shutdown. 848 * Actions running on `shutdown` are immune to PHP timeouts, 849 * so in case the failure was due to a PHP timeout, 850 * we'll still be able to properly restore the previous version. 851 */ 852 add_action( 853 'shutdown', 854 function() use ( $options ) { 855 $this->restore_temp_backup( $options['hook_extra']['temp_backup'] ); 856 } 857 ); 847 858 } 848 859 $this->skin->error( $result ); … … 860 871 // Clean up the backup kept in the temp-backup directory. 861 872 if ( ! empty( $options['hook_extra']['temp_backup'] ) ) { 862 $this->delete_temp_backup( $options['hook_extra']['temp_backup'] ); 873 // Delete the backup on `shutdown` to avoid a PHP timeout. 874 add_action( 875 'shutdown', 876 function() use ( $options ) { 877 $this->delete_temp_backup( $options['hook_extra']['temp_backup'] ); 878 } 879 ); 863 880 } 864 881
Note: See TracChangeset
for help on using the changeset viewer.