Make WordPress Core

Ticket #47480: 47480.diff

File 47480.diff, 1.5 KB (added by david.binda, 6 years ago)
  • src/wp-includes/class-wp-recovery-mode-cookie-service.php

     
    3535
    3636                $value = $this->generate_cookie();
    3737
    38                 setcookie( RECOVERY_MODE_COOKIE, $value, 0, COOKIEPATH, COOKIE_DOMAIN, is_ssl(), true );
     38                /**
     39                 * Filter the length of time a Recovery Mode cookie is valid for.
     40                 *
     41                 * @since 5.2.0
     42                 *
     43                 * @param int $length Length in seconds.
     44                 */
     45                $expire = time() + apply_filters( 'recovery_mode_cookie_length', WEEK_IN_SECONDS );
    3946
     47                setcookie( RECOVERY_MODE_COOKIE, $value, $expire, COOKIEPATH, COOKIE_DOMAIN, is_ssl(), true );
     48
    4049                if ( COOKIEPATH !== SITECOOKIEPATH ) {
    41                         setcookie( RECOVERY_MODE_COOKIE, $value, 0, SITECOOKIEPATH, COOKIE_DOMAIN, is_ssl(), true );
     50                        setcookie( RECOVERY_MODE_COOKIE, $value, $expire, SITECOOKIEPATH, COOKIE_DOMAIN, is_ssl(), true );
    4251                }
    4352        }
    4453
     
    8392                        return new WP_Error( 'invalid_created_at', __( 'Invalid cookie format.' ) );
    8493                }
    8594
    86                 /**
    87                  * Filter the length of time a Recovery Mode cookie is valid for.
    88                  *
    89                  * @since 5.2.0
    90                  *
    91                  * @param int $length Length in seconds.
    92                  */
     95                /** This filter is documented in wp-includes/class-wp-recovery-mode-cookie-service.php */
    9396                $length = apply_filters( 'recovery_mode_cookie_length', WEEK_IN_SECONDS );
    9497
    9598                if ( time() > $created_at + $length ) {