<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[45268] trunk/src/wp-includes: Bootstrap/Load: Tweak the recovery mode email text and behaviour.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/45268">45268</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/45268","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>pento</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2019-04-25 00:46:39 +0000 (Thu, 25 Apr 2019)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Bootstrap/Load: Tweak the recovery mode email text and behaviour.

- Change the recovery mode link expiry to 1 day.
- Improve the email text.
- Add a new `recovery_email_support_info` filter, for hosts to be able to customise their support contact information.

Props pento, chanthaboune, michelleweber, matt.
Fixes <a href="https://core.trac.wordpress.org/ticket/46898">#46898</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesclasswprecoverymodeemailservicephp">trunk/src/wp-includes/class-wp-recovery-mode-email-service.php</a></li>
<li><a href="#trunksrcwpincludesclasswprecoverymodephp">trunk/src/wp-includes/class-wp-recovery-mode.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesclasswprecoverymodeemailservicephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-recovery-mode-email-service.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-recovery-mode-email-service.php    2019-04-25 00:07:23 UTC (rev 45267)
+++ trunk/src/wp-includes/class-wp-recovery-mode-email-service.php      2019-04-25 00:46:39 UTC (rev 45268)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -122,20 +122,32 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $details = '';
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                /**
+                * Filters the support message sent with the the fatal error protection email.
+                *
+                * @since 5.2.0
+                *
+                * @param $message string The Message to include in the email.
+                */
+               $support = apply_filters( 'recovery_email_support_info', __( 'Please contact your host for assistance with investigating this issue further.' ) );
+
+               /* translators: Do not translate LINK, EXPIRES, CAUSE, DETAILS, SITEURL, PAGEURL, SUPPORT: those are placeholders. */
</ins><span class="cx" style="display: block; padding: 0 10px">                 $message = __(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'Howdy,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'Howdy!
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-Your site recently crashed and may not be working as expected.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+Since WordPress 5.2 there is a built-in feature that detects when a plugin or theme causes a fatal error on your site, and notifies you with this automated email.
</ins><span class="cx" style="display: block; padding: 0 10px"> ###CAUSE###
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-Please click the link below to initiate recovery mode and fix the problem.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+First, visit your website (###SITEURL###) and check for any visible issues. Next, visit the page where the error was caught (###PAGEURL###) and check for any visible issues.
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-This link expires in ###EXPIRES###.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+###SUPPORT###
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-###LINK### ###DETAILS###
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+If your site appears broken and you can\'t access your dashboard normally, WordPress now has a special "recovery mode". This lets you safely login to your dashboard and investigate further.
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">---The WordPress Team
-https://wordpress.org/
-'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+###LINK###
+
+To keep your site safe, this link will expire in ###EXPIRES###. Don\'t worry about that, though: a new link will be emailed to you if the error occurs again after it expires.
+
+###DETAILS###'
</ins><span class="cx" style="display: block; padding: 0 10px">                 );
</span><span class="cx" style="display: block; padding: 0 10px">                $message = str_replace(
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -143,6 +155,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                '###EXPIRES###',
</span><span class="cx" style="display: block; padding: 0 10px">                                '###CAUSE###',
</span><span class="cx" style="display: block; padding: 0 10px">                                '###DETAILS###',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                '###SITEURL###',
+                               '###PAGEURL###',
+                               '###SUPPORT###',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><span class="cx" style="display: block; padding: 0 10px">                                $url,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -149,6 +164,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                human_time_diff( time() + $rate_limit ),
</span><span class="cx" style="display: block; padding: 0 10px">                                $cause ? "\n{$cause}\n" : "\n",
</span><span class="cx" style="display: block; padding: 0 10px">                                $details,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                home_url( '/' ),
+                               home_url( $_SERVER['REQUEST_URI'] ),
+                               $support,
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px">                        $message
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -224,7 +242,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                $name = $plugins[ "{$extension['slug']}/{$extension['slug']}.php" ]['Name'];
</span><span class="cx" style="display: block; padding: 0 10px">                        } else {
</span><span class="cx" style="display: block; padding: 0 10px">                                foreach ( $plugins as $file => $plugin_data ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        if ( 0 === strpos( $file, "{$extension['slug']}/" ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 if ( 0 === strpos( $file, "{$extension['slug']}/" ) || $file === $extension['slug'] ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 $name = $plugin_data['Name'];
</span><span class="cx" style="display: block; padding: 0 10px">                                                break;
</span><span class="cx" style="display: block; padding: 0 10px">                                        }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -236,13 +254,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        /* translators: %s: plugin name */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $cause = sprintf( __( 'This was caused by the following plugin: %s.' ), $name );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $cause = sprintf( __( 'In this case, WordPress caught an error with one of your plugins, %s.' ), $name );
</ins><span class="cx" style="display: block; padding: 0 10px">                 } else {
</span><span class="cx" style="display: block; padding: 0 10px">                        $theme = wp_get_theme( $extension['slug'] );
</span><span class="cx" style="display: block; padding: 0 10px">                        $name  = $theme->exists() ? $theme->display( 'Name' ) : $extension['slug'];
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        /* translators: %s: theme name */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $cause = sprintf( __( 'This was caused by the following theme: %s.' ), $name );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $cause = sprintf( __( 'In this case, WordPress caught an error with your theme, %s.' ), $name );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                return $cause;
</span></span></pre></div>
<a id="trunksrcwpincludesclasswprecoverymodephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-recovery-mode.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-recovery-mode.php  2019-04-25 00:07:23 UTC (rev 45267)
+++ trunk/src/wp-includes/class-wp-recovery-mode.php    2019-04-25 00:46:39 UTC (rev 45268)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -299,9 +299,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><span class="cx" style="display: block; padding: 0 10px">                 * @since 5.2.0
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * @param int $rate_limit Time to wait in seconds. Defaults to 4 hours.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          * @param int $rate_limit Time to wait in seconds. Defaults to 1 day.
</ins><span class="cx" style="display: block; padding: 0 10px">                  */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                return apply_filters( 'recovery_mode_email_rate_limit', 4 * HOUR_IN_SECONDS );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         return apply_filters( 'recovery_mode_email_rate_limit', DAY_IN_SECONDS );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span></span></pre>
</div>
</div>

</body>
</html>