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.
Fixes #54849.

Built from https://develop.svn.wordpress.org/trunk@52694


git-svn-id: http://core.svn.wordpress.org/trunk@52283 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Peter Wilson 2022-02-08 23:30:03 +00:00
parent 22c9355e2d
commit 2fa1d729ba
2 changed files with 7 additions and 7 deletions

View File

@ -784,7 +784,7 @@ function delete_transient( $transient ) {
*/
do_action( "delete_transient_{$transient}", $transient );
if ( wp_using_ext_object_cache() ) {
if ( wp_using_ext_object_cache() || wp_installing() ) {
$result = wp_cache_delete( $transient, 'transient' );
} else {
$option_timeout = '_transient_timeout_' . $transient;
@ -846,7 +846,7 @@ function get_transient( $transient ) {
return $pre;
}
if ( wp_using_ext_object_cache() ) {
if ( wp_using_ext_object_cache() || wp_installing() ) {
$value = wp_cache_get( $transient, 'transient' );
} else {
$transient_option = '_transient_' . $transient;
@ -930,7 +930,7 @@ function set_transient( $transient, $value, $expiration = 0 ) {
*/
$expiration = apply_filters( "expiration_of_transient_{$transient}", $expiration, $value, $transient );
if ( wp_using_ext_object_cache() ) {
if ( wp_using_ext_object_cache() || wp_installing() ) {
$result = wp_cache_set( $transient, $value, 'transient', $expiration );
} else {
$transient_timeout = '_transient_timeout_' . $transient;
@ -1858,7 +1858,7 @@ function delete_site_transient( $transient ) {
*/
do_action( "delete_site_transient_{$transient}", $transient );
if ( wp_using_ext_object_cache() ) {
if ( wp_using_ext_object_cache() || wp_installing() ) {
$result = wp_cache_delete( $transient, 'site-transient' );
} else {
$option_timeout = '_site_transient_timeout_' . $transient;
@ -1922,7 +1922,7 @@ function get_site_transient( $transient ) {
return $pre;
}
if ( wp_using_ext_object_cache() ) {
if ( wp_using_ext_object_cache() || wp_installing() ) {
$value = wp_cache_get( $transient, 'site-transient' );
} else {
// Core transients that do not have a timeout. Listed here so querying timeouts can be avoided.
@ -2003,7 +2003,7 @@ function set_site_transient( $transient, $value, $expiration = 0 ) {
*/
$expiration = apply_filters( "expiration_of_site_transient_{$transient}", $expiration, $value, $transient );
if ( wp_using_ext_object_cache() ) {
if ( wp_using_ext_object_cache() || wp_installing() ) {
$result = wp_cache_set( $transient, $value, 'site-transient', $expiration );
} else {
$transient_timeout = '_site_transient_timeout_' . $transient;

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.0-alpha-52693';
$wp_version = '6.0-alpha-52694';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.