Make WordPress Core

Changeset 52767


Ignore:
Timestamp:
02/17/2022 07:51:30 PM (5 years ago)
Author:
hellofromTonya
Message:

Options: Disable transients while installing.

Prevent the transient setters and getters from attempting to use the database table before they exist during the installation process.

During installation transients now use the wp_cache_*() functions on all sites, including those without a persistent cache, to prevent database errors. The use of the caching functions stores the data in memory for the duration of the request to account for transient data that is used multiple times during installation.

Props dd32, audrasjb, tnolte, antonvlasenko, noisysocks, peterwilsoncc.
Merges [52694] to the 5.9 branch.
Fixes #54849.

Location:
branches/5.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.9

  • branches/5.9/src/wp-includes/option.php

    r52035 r52767  
    785785        do_action( "delete_transient_{$transient}", $transient );
    786786
    787         if ( wp_using_ext_object_cache() ) {
     787        if ( wp_using_ext_object_cache() || wp_installing() ) {
    788788                $result = wp_cache_delete( $transient, 'transient' );
    789789        } else {
     
    847847        }
    848848
    849         if ( wp_using_ext_object_cache() ) {
     849        if ( wp_using_ext_object_cache() || wp_installing() ) {
    850850                $value = wp_cache_get( $transient, 'transient' );
    851851        } else {
     
    931931        $expiration = apply_filters( "expiration_of_transient_{$transient}", $expiration, $value, $transient );
    932932
    933         if ( wp_using_ext_object_cache() ) {
     933        if ( wp_using_ext_object_cache() || wp_installing() ) {
    934934                $result = wp_cache_set( $transient, $value, 'transient', $expiration );
    935935        } else {
     
    18591859        do_action( "delete_site_transient_{$transient}", $transient );
    18601860
    1861         if ( wp_using_ext_object_cache() ) {
     1861        if ( wp_using_ext_object_cache() || wp_installing() ) {
    18621862                $result = wp_cache_delete( $transient, 'site-transient' );
    18631863        } else {
     
    19231923        }
    19241924
    1925         if ( wp_using_ext_object_cache() ) {
     1925        if ( wp_using_ext_object_cache() || wp_installing() ) {
    19261926                $value = wp_cache_get( $transient, 'site-transient' );
    19271927        } else {
     
    20042004        $expiration = apply_filters( "expiration_of_site_transient_{$transient}", $expiration, $value, $transient );
    20052005
    2006         if ( wp_using_ext_object_cache() ) {
     2006        if ( wp_using_ext_object_cache() || wp_installing() ) {
    20072007                $result = wp_cache_set( $transient, $value, 'site-transient', $expiration );
    20082008        } else {
Note: See TracChangeset for help on using the changeset viewer.