wp/wp-includes/class-wp-fatal-error-handler.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
child 22 8c2e4d02f4ef
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
    14  * can override its methods individually as necessary. The file must return the instance of the class that should be
    14  * can override its methods individually as necessary. The file must return the instance of the class that should be
    15  * registered.
    15  * registered.
    16  *
    16  *
    17  * @since 5.2.0
    17  * @since 5.2.0
    18  */
    18  */
       
    19 #[AllowDynamicProperties]
    19 class WP_Fatal_Error_Handler {
    20 class WP_Fatal_Error_Handler {
    20 
    21 
    21 	/**
    22 	/**
    22 	 * Runs the shutdown handler.
    23 	 * Runs the shutdown handler.
    23 	 *
    24 	 *
    24 	 * This method is registered via `register_shutdown_function()`.
    25 	 * This method is registered via `register_shutdown_function()`.
    25 	 *
    26 	 *
    26 	 * @since 5.2.0
    27 	 * @since 5.2.0
       
    28 	 *
       
    29 	 * @global WP_Locale $wp_locale WordPress date and time locale object.
    27 	 */
    30 	 */
    28 	public function handle() {
    31 	public function handle() {
    29 		if ( defined( 'WP_SANDBOX_SCRAPING' ) && WP_SANDBOX_SCRAPING ) {
    32 		if ( defined( 'WP_SANDBOX_SCRAPING' ) && WP_SANDBOX_SCRAPING ) {
    30 			return;
    33 			return;
    31 		}
    34 		}
   182 		}
   185 		}
   183 
   186 
   184 		if ( true === $handled && wp_is_recovery_mode() ) {
   187 		if ( true === $handled && wp_is_recovery_mode() ) {
   185 			$message = __( 'There has been a critical error on this website, putting it in recovery mode. Please check the Themes and Plugins screens for more details. If you just installed or updated a theme or plugin, check the relevant page for that first.' );
   188 			$message = __( 'There has been a critical error on this website, putting it in recovery mode. Please check the Themes and Plugins screens for more details. If you just installed or updated a theme or plugin, check the relevant page for that first.' );
   186 		} elseif ( is_protected_endpoint() && wp_recovery_mode()->is_initialized() ) {
   189 		} elseif ( is_protected_endpoint() && wp_recovery_mode()->is_initialized() ) {
   187 			$message = __( 'There has been a critical error on this website. Please check your site admin email inbox for instructions.' );
   190 			if ( is_multisite() ) {
       
   191 				$message = __( 'There has been a critical error on this website. Please reach out to your site administrator, and inform them of this error for further assistance.' );
       
   192 			} else {
       
   193 				$message = __( 'There has been a critical error on this website. Please check your site admin email inbox for instructions.' );
       
   194 			}
   188 		} else {
   195 		} else {
   189 			$message = __( 'There has been a critical error on this website.' );
   196 			$message = __( 'There has been a critical error on this website.' );
   190 		}
   197 		}
   191 
   198 
   192 		$message = sprintf(
   199 		$message = sprintf(
   193 			'<p>%s</p><p><a href="%s">%s</a></p>',
   200 			'<p>%s</p><p><a href="%s">%s</a></p>',
   194 			$message,
   201 			$message,
   195 			/* translators: Documentation about troubleshooting. */
   202 			/* translators: Documentation about troubleshooting. */
   196 			__( 'https://wordpress.org/support/article/faq-troubleshooting/' ),
   203 			__( 'https://wordpress.org/documentation/article/faq-troubleshooting/' ),
   197 			__( 'Learn more about troubleshooting WordPress.' )
   204 			__( 'Learn more about troubleshooting WordPress.' )
   198 		);
   205 		);
   199 
   206 
   200 		$args = array(
   207 		$args = array(
   201 			'response' => 500,
   208 			'response' => 500,