Make WordPress Core

Changeset 48056


Ignore:
Timestamp:
06/16/2020 07:07:54 AM (5 years ago)
Author:
whyisjake
Message:

Administration: Remove wp-auth-check from the Heartbeat API.

As of [27153], wp-auth-check is returned on all heartbeats without the need for data from client-side. This also means that the timing and scheduling of this request data is ineffectual.

Fixes #50305.

Props dsixinetu, azaozz, whyisjake.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/lib/auth-check.js

    r47122 r48056  
    77/* global adminpage */
    88(function($){
    9     var wrap, next;
     9    var wrap;
    1010
    1111    /**
     
    112112
    113113    /**
    114      * Schedules when the next time the authentication check will be done.
    115      *
    116      * @since 3.6.0
    117      * @private
    118      */
    119     function schedule() {
    120         // In seconds, default 3 min.
    121         var interval = parseInt( window.authcheckL10n.interval, 10 ) || 180;
    122         next = ( new Date() ).getTime() + ( interval * 1000 );
    123     }
    124 
    125     /**
    126114     * Binds to the Heartbeat Tick event.
    127115     *
     
    139127    $( document ).on( 'heartbeat-tick.wp-auth-check', function( e, data ) {
    140128        if ( 'wp-auth-check' in data ) {
    141             schedule();
    142129            if ( ! data['wp-auth-check'] && wrap.hasClass('hidden') ) {
    143130                show();
     
    146133            }
    147134        }
    148 
    149     /**
    150      * Binds to the Heartbeat Send event.
    151      *
    152      * @ignore
    153      *
    154      * @since 3.6.0
    155      *
    156      * @param {Object} e The heartbeat-send event that has been triggered.
    157      * @param {Object} data Response data.
    158      */
    159     }).on( 'heartbeat-send.wp-auth-check', function( e, data ) {
    160         if ( ( new Date() ).getTime() > next ) {
    161             data['wp-auth-check'] = true;
    162         }
    163 
    164135    }).ready( function() {
    165         schedule();
    166136
    167137        /**
  • trunk/src/wp-includes/script-loader.php

    r48038 r48056  
    720720        array(
    721721            'beforeunload' => __( 'Your session has expired. You can log in again from this page or go to the login page.' ),
    722 
    723             /**
    724              * Filters the authentication check interval.
    725              *
    726              * @since 3.6.0
    727              *
    728              * @param int $interval The interval in which to check a user's authentication.
    729              *                      Default 3 minutes in seconds, or 180.
    730              */
    731             'interval'     => apply_filters( 'wp_auth_check_interval', 3 * MINUTE_IN_SECONDS ),
    732722        )
    733723    );
Note: See TracChangeset for help on using the changeset viewer.