WP_Site_Health_Auto_Updates::test_if_failed_update() WordPress Method
If the test_if_failed_update() method is called, it will check if there is a failed update attempt. If there is a failed update attempt, it will return true. Otherwise, it will return false.
WP_Site_Health_Auto_Updates::test_if_failed_update() #
Check if automatic updates have tried to run, but failed, previously.
Return
(array|false) The test results. False if the auto-updates failed.
Source
File: wp-admin/includes/class-wp-site-health-auto-updates.php
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | public function test_if_failed_update() { $failed = get_site_option( 'auto_core_update_failed' ); if ( ! $failed ) { return false; } if ( ! empty ( $failed [ 'critical' ] ) ) { $description = __( 'A previous automatic background update ended with a critical failure, so updates are now disabled.' ); $description .= ' ' . __( 'You would have received an email because of this.' ); $description .= ' ' . __( "When you've been able to update using the \"Update now\" button on Dashboard > Updates, we'll clear this error for future update attempts." ); $description .= ' ' . sprintf( /* translators: %s: Code of error shown. */ __( 'The error code was %s.' ), '<code>' . $failed [ 'error_code' ] . '</code>' ); return array ( 'description' => $description , 'severity' => 'warning' , ); } $description = __( 'A previous automatic background update could not occur.' ); if ( empty ( $failed [ 'retry' ] ) ) { $description .= ' ' . __( 'You would have received an email because of this.' ); } $description .= ' ' . __( "We'll try again with the next release." ); $description .= ' ' . sprintf( /* translators: %s: Code of error shown. */ __( 'The error code was %s.' ), '<code>' . $failed [ 'error_code' ] . '</code>' ); return array ( 'description' => $description , 'severity' => 'warning' , ); } |
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
5.2.0 | Introduced. |