WordPress.org

Make WordPress Core

Changeset 20135


Ignore:
Timestamp:
03/07/2012 03:41:56 AM (8 years ago)
Author:
nacin
Message:

Internally cache return values of wp_salt(). Always run the filter. Big performance gains on a pageload that generates hundreds of nonces. see #19599.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/pluggable.php

    r19918 r20135  
    13111311    global $wp_secret_key_default; // This is set for localized builds for versions > 3.4.0.
    13121312
     1313    static $cached_salts = array();
     1314    if ( isset( $cached_salts[ $scheme ] ) )
     1315        return apply_filters( 'salt', $cached_salts[ $scheme ], $scheme );
     1316
    13131317    static $duplicated_keys;
    13141318    if ( null === $duplicated_keys ) {
     
    13561360    }
    13571361
    1358     return apply_filters('salt', $key . $salt, $scheme);
     1362    $cached_salts[ $scheme ] = $key . $salt;
     1363    return apply_filters( 'salt', $cached_salts[ $scheme ], $scheme );
    13591364}
    13601365endif;
Note: See TracChangeset for help on using the changeset viewer.