Options: Update default autoload values used in core.

This updates the values used for the `$autoload` parameter in various functions to replace 'yes' and 'no' with 'on' and 'off', respectively.

Follow-up to [57920].

Props pbearne, mukesh27, joemcgill.
Fixes #61045. See #42441.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57570 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Joe McGill 2024-05-06 16:35:19 +00:00
parent 70ba8a1e2c
commit ae2ce86cf4
7 changed files with 16 additions and 16 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, 'yes' ); update_option( 'can_compress_scripts', 0, 'on' );
} }
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, 'yes' ); update_option( 'can_compress_scripts', 0, 'on' );
} }
} 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, 'yes' ); update_option( 'can_compress_scripts', 1, 'on' );
} }
} }
} }

View File

@ -1016,7 +1016,7 @@ class WP_Upgrader {
$lock_option = $lock_name . '.lock'; $lock_option = $lock_name . '.lock';
// Try to lock. // Try to lock.
$lock_result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` ( `option_name`, `option_value`, `autoload` ) VALUES (%s, %s, 'no') /* LOCK */", $lock_option, time() ) ); $lock_result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` ( `option_name`, `option_value`, `autoload` ) VALUES (%s, %s, 'off') /* LOCK */", $lock_option, time() ) );
if ( ! $lock_result ) { if ( ! $lock_result ) {
$lock_result = get_option( $lock_option ); $lock_result = get_option( $lock_option );

View File

@ -594,9 +594,9 @@ function populate_options( array $options = array() ) {
} }
if ( in_array( $option, $fat_options, true ) ) { if ( in_array( $option, $fat_options, true ) ) {
$autoload = 'no'; $autoload = 'off';
} else { } else {
$autoload = 'yes'; $autoload = 'on';
} }
if ( ! empty( $insert ) ) { if ( ! empty( $insert ) ) {

View File

@ -1412,10 +1412,10 @@ function set_transient( $transient, $value, $expiration = 0 ) {
$transient_option = '_transient_' . $transient; $transient_option = '_transient_' . $transient;
if ( false === get_option( $transient_option ) ) { if ( false === get_option( $transient_option ) ) {
$autoload = 'yes'; $autoload = 'on';
if ( $expiration ) { if ( $expiration ) {
$autoload = 'no'; $autoload = 'off';
add_option( $transient_timeout, time() + $expiration, '', 'no' ); add_option( $transient_timeout, time() + $expiration, '', 'off' );
} }
$result = add_option( $transient_option, $value, '', $autoload ); $result = add_option( $transient_option, $value, '', $autoload );
} else { } else {
@ -1428,8 +1428,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, '', 'no' ); add_option( $transient_timeout, time() + $expiration, '', 'off' );
$result = add_option( $transient_option, $value, '', 'no' ); $result = add_option( $transient_option, $value, '', 'off' );
$update = false; $update = false;
} else { } else {
update_option( $transient_timeout, time() + $expiration ); update_option( $transient_timeout, time() + $expiration );
@ -2017,7 +2017,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, '', 'no' ); $result = add_option( $option, $value, '', 'off' );
} else { } else {
$cache_key = "$network_id:$option"; $cache_key = "$network_id:$option";
@ -2263,7 +2263,7 @@ function update_network_option( $network_id, $option, $value ) {
} }
if ( ! is_multisite() ) { if ( ! is_multisite() ) {
$result = update_option( $option, $value, 'no' ); $result = update_option( $option, $value, 'off' );
} else { } else {
$value = sanitize_option( $option, $value ); $value = sanitize_option( $option, $value );

View File

@ -1012,7 +1012,7 @@ function _wp_upgrade_revisions_of_post( $post, $revisions ) {
// Add post option exclusively. // Add post option exclusively.
$lock = "revision-upgrade-{$post->ID}"; $lock = "revision-upgrade-{$post->ID}";
$now = time(); $now = time();
$result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, 'no') /* LOCK */", $lock, $now ) ); $result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, 'off') /* LOCK */", $lock, $now ) );
if ( ! $result ) { if ( ! $result ) {
// If we couldn't get a lock, see how old the previous lock is. // If we couldn't get a lock, see how old the previous lock is.

View File

@ -4365,7 +4365,7 @@ function _wp_batch_split_terms() {
$lock_name = 'term_split.lock'; $lock_name = 'term_split.lock';
// Try to lock. // Try to lock.
$lock_result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` ( `option_name`, `option_value`, `autoload` ) VALUES (%s, %s, 'no') /* LOCK */", $lock_name, time() ) ); $lock_result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` ( `option_name`, `option_value`, `autoload` ) VALUES (%s, %s, 'off') /* LOCK */", $lock_name, time() ) );
if ( ! $lock_result ) { if ( ! $lock_result ) {
$lock_result = get_option( $lock_name ); $lock_result = get_option( $lock_name );

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.6-alpha-58104'; $wp_version = '6.6-alpha-58105';
/** /**
* 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.