From d1d0f68bb9d967c9d28b31b9c9cb6af0f30e3ac3 Mon Sep 17 00:00:00 2001 From: Joe McGill Date: Mon, 6 May 2024 16:33:27 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@58105 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/ajax-actions.php | 6 +++--- src/wp-admin/includes/class-wp-upgrader.php | 2 +- src/wp-admin/includes/schema.php | 4 ++-- src/wp-includes/option.php | 14 +++++++------- src/wp-includes/revision.php | 2 +- src/wp-includes/taxonomy.php | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php index 06b6e90e558db..b27961ebe50fd 100644 --- a/src/wp-admin/includes/ajax-actions.php +++ b/src/wp-admin/includes/ajax-actions.php @@ -192,7 +192,7 @@ function wp_ajax_wp_compression_test() { if ( is_multisite() ) { update_site_option( 'can_compress_scripts', 0 ); } else { - update_option( 'can_compress_scripts', 0, 'yes' ); + update_option( 'can_compress_scripts', 0, 'on' ); } wp_die( 0 ); } @@ -231,7 +231,7 @@ function wp_ajax_wp_compression_test() { if ( is_multisite() ) { update_site_option( 'can_compress_scripts', 0 ); } else { - update_option( 'can_compress_scripts', 0, 'yes' ); + update_option( 'can_compress_scripts', 0, 'on' ); } } elseif ( 'yes' === $_GET['test'] ) { check_ajax_referer( 'update_can_compress_scripts' ); @@ -239,7 +239,7 @@ function wp_ajax_wp_compression_test() { if ( is_multisite() ) { update_site_option( 'can_compress_scripts', 1 ); } else { - update_option( 'can_compress_scripts', 1, 'yes' ); + update_option( 'can_compress_scripts', 1, 'on' ); } } } diff --git a/src/wp-admin/includes/class-wp-upgrader.php b/src/wp-admin/includes/class-wp-upgrader.php index c54384e742d39..2cbc6bcb033eb 100644 --- a/src/wp-admin/includes/class-wp-upgrader.php +++ b/src/wp-admin/includes/class-wp-upgrader.php @@ -1016,7 +1016,7 @@ public static function create_lock( $lock_name, $release_timeout = null ) { $lock_option = $lock_name . '.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 ) { $lock_result = get_option( $lock_option ); diff --git a/src/wp-admin/includes/schema.php b/src/wp-admin/includes/schema.php index 63655ccf174ca..cd06364caf269 100644 --- a/src/wp-admin/includes/schema.php +++ b/src/wp-admin/includes/schema.php @@ -594,9 +594,9 @@ function populate_options( array $options = array() ) { } if ( in_array( $option, $fat_options, true ) ) { - $autoload = 'no'; + $autoload = 'off'; } else { - $autoload = 'yes'; + $autoload = 'on'; } if ( ! empty( $insert ) ) { diff --git a/src/wp-includes/option.php b/src/wp-includes/option.php index 0c5247f1a54f1..66b22e9fc4984 100644 --- a/src/wp-includes/option.php +++ b/src/wp-includes/option.php @@ -1412,10 +1412,10 @@ function set_transient( $transient, $value, $expiration = 0 ) { $transient_option = '_transient_' . $transient; if ( false === get_option( $transient_option ) ) { - $autoload = 'yes'; + $autoload = 'on'; if ( $expiration ) { - $autoload = 'no'; - add_option( $transient_timeout, time() + $expiration, '', 'no' ); + $autoload = 'off'; + add_option( $transient_timeout, time() + $expiration, '', 'off' ); } $result = add_option( $transient_option, $value, '', $autoload ); } else { @@ -1428,8 +1428,8 @@ function set_transient( $transient, $value, $expiration = 0 ) { if ( $expiration ) { if ( false === get_option( $transient_timeout ) ) { delete_option( $transient_option ); - add_option( $transient_timeout, time() + $expiration, '', 'no' ); - $result = add_option( $transient_option, $value, '', 'no' ); + add_option( $transient_timeout, time() + $expiration, '', 'off' ); + $result = add_option( $transient_option, $value, '', 'off' ); $update = false; } else { update_option( $transient_timeout, time() + $expiration ); @@ -2017,7 +2017,7 @@ function add_network_option( $network_id, $option, $value ) { $notoptions_key = "$network_id:notoptions"; if ( ! is_multisite() ) { - $result = add_option( $option, $value, '', 'no' ); + $result = add_option( $option, $value, '', 'off' ); } else { $cache_key = "$network_id:$option"; @@ -2263,7 +2263,7 @@ function update_network_option( $network_id, $option, $value ) { } if ( ! is_multisite() ) { - $result = update_option( $option, $value, 'no' ); + $result = update_option( $option, $value, 'off' ); } else { $value = sanitize_option( $option, $value ); diff --git a/src/wp-includes/revision.php b/src/wp-includes/revision.php index 681d11736c0d1..065278b5f8319 100644 --- a/src/wp-includes/revision.php +++ b/src/wp-includes/revision.php @@ -1012,7 +1012,7 @@ function _wp_upgrade_revisions_of_post( $post, $revisions ) { // Add post option exclusively. $lock = "revision-upgrade-{$post->ID}"; $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 we couldn't get a lock, see how old the previous lock is. diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php index 85ca5c30daf45..5f5f9bf0893be 100644 --- a/src/wp-includes/taxonomy.php +++ b/src/wp-includes/taxonomy.php @@ -4365,7 +4365,7 @@ function _wp_batch_split_terms() { $lock_name = 'term_split.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 ) { $lock_result = get_option( $lock_name );