Options: Fix some default autoload values used in core.

This fixes some autoload values that were updated in [58105] that used the database values of `"on"` and `"off"` instead of the boolean values `true` and `false` when being passed to `add|update_option()`.

Props joemcgill, desrosj, rajinsharwar.
Fixes #61045. See #42441.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57865 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Joe McGill 2024-06-14 15:21:10 +00:00
parent b1a46c8708
commit 3f8fb3f8c1
3 changed files with 11 additions and 11 deletions

View File

@ -192,7 +192,7 @@ function wp_ajax_wp_compression_test() {
if ( is_multisite() ) { if ( is_multisite() ) {
update_site_option( 'can_compress_scripts', 0 ); update_site_option( 'can_compress_scripts', 0 );
} else { } else {
update_option( 'can_compress_scripts', 0, 'on' ); update_option( 'can_compress_scripts', 0, true );
} }
wp_die( 0 ); wp_die( 0 );
} }
@ -231,7 +231,7 @@ function wp_ajax_wp_compression_test() {
if ( is_multisite() ) { if ( is_multisite() ) {
update_site_option( 'can_compress_scripts', 0 ); update_site_option( 'can_compress_scripts', 0 );
} else { } else {
update_option( 'can_compress_scripts', 0, 'on' ); update_option( 'can_compress_scripts', 0, true );
} }
} elseif ( 'yes' === $_GET['test'] ) { } elseif ( 'yes' === $_GET['test'] ) {
check_ajax_referer( 'update_can_compress_scripts' ); check_ajax_referer( 'update_can_compress_scripts' );
@ -239,7 +239,7 @@ function wp_ajax_wp_compression_test() {
if ( is_multisite() ) { if ( is_multisite() ) {
update_site_option( 'can_compress_scripts', 1 ); update_site_option( 'can_compress_scripts', 1 );
} else { } else {
update_option( 'can_compress_scripts', 1, 'on' ); update_option( 'can_compress_scripts', 1, true );
} }
} }
} }

View File

@ -1514,10 +1514,10 @@ function set_transient( $transient, $value, $expiration = 0 ) {
wp_prime_option_caches( array( $transient_option, $transient_timeout ) ); wp_prime_option_caches( array( $transient_option, $transient_timeout ) );
if ( false === get_option( $transient_option ) ) { if ( false === get_option( $transient_option ) ) {
$autoload = 'on'; $autoload = true;
if ( $expiration ) { if ( $expiration ) {
$autoload = 'off'; $autoload = false;
add_option( $transient_timeout, time() + $expiration, '', 'off' ); add_option( $transient_timeout, time() + $expiration, '', false );
} }
$result = add_option( $transient_option, $value, '', $autoload ); $result = add_option( $transient_option, $value, '', $autoload );
} else { } else {
@ -1530,8 +1530,8 @@ function set_transient( $transient, $value, $expiration = 0 ) {
if ( $expiration ) { if ( $expiration ) {
if ( false === get_option( $transient_timeout ) ) { if ( false === get_option( $transient_timeout ) ) {
delete_option( $transient_option ); delete_option( $transient_option );
add_option( $transient_timeout, time() + $expiration, '', 'off' ); add_option( $transient_timeout, time() + $expiration, '', false );
$result = add_option( $transient_option, $value, '', 'off' ); $result = add_option( $transient_option, $value, '', false );
$update = false; $update = false;
} else { } else {
update_option( $transient_timeout, time() + $expiration ); update_option( $transient_timeout, time() + $expiration );
@ -2119,7 +2119,7 @@ function add_network_option( $network_id, $option, $value ) {
$notoptions_key = "$network_id:notoptions"; $notoptions_key = "$network_id:notoptions";
if ( ! is_multisite() ) { if ( ! is_multisite() ) {
$result = add_option( $option, $value, '', 'off' ); $result = add_option( $option, $value, '', false );
} else { } else {
$cache_key = "$network_id:$option"; $cache_key = "$network_id:$option";
@ -2365,7 +2365,7 @@ function update_network_option( $network_id, $option, $value ) {
} }
if ( ! is_multisite() ) { if ( ! is_multisite() ) {
$result = update_option( $option, $value, 'off' ); $result = update_option( $option, $value, false );
} else { } else {
$value = sanitize_option( $option, $value ); $value = sanitize_option( $option, $value );

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.6-beta2-58415'; $wp_version = '6.6-beta2-58416';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.