From 67b1c27c635826a4946e8766f2fbb1710d55bfe7 Mon Sep 17 00:00:00 2001 From: paul bearne Date: Fri, 19 Apr 2024 17:36:15 -0400 Subject: [PATCH 1/6] Change 'autoload' option values in various files Updated values of 'autoload' option from 'yes' or 'no' to 'on' or 'off' respectively, across several PHP files. This change was implemented in the functions handling options and lock settings, enhancing clarity and consistency of the code. --- 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 +- 5 files changed, 12 insertions(+), 12 deletions(-) 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 4c0071e23d670..f3751b2009a82 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 ); From b38c7885e161479cc373770a9ab2c48c451de5c2 Mon Sep 17 00:00:00 2001 From: paul bearne Date: Tue, 23 Apr 2024 16:57:31 -0400 Subject: [PATCH 2/6] Update script compression settings in ajax-actions The commit modifies the 'can_compress_scripts' options in the ajax-actions.php file. The update_site_option and update_option functions now have a third argument which controls whether the setting is on or off. This enhances flexibility and control over the script compression feature. --- src/wp-admin/includes/ajax-actions.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php index 06b6e90e558db..ca8865a3826c6 100644 --- a/src/wp-admin/includes/ajax-actions.php +++ b/src/wp-admin/includes/ajax-actions.php @@ -190,9 +190,9 @@ function wp_ajax_wp_compression_test() { if ( ini_get( 'zlib.output_compression' ) || 'ob_gzhandler' === ini_get( 'output_handler' ) ) { // Use `update_option()` on single site to mark the option for autoloading. if ( is_multisite() ) { - update_site_option( 'can_compress_scripts', 0 ); + update_site_option( 'can_compress_scripts', 0, 'off' ); } else { - update_option( 'can_compress_scripts', 0, 'yes' ); + update_option( 'can_compress_scripts', 0, 'on' ); } wp_die( 0 ); } @@ -229,17 +229,17 @@ function wp_ajax_wp_compression_test() { check_ajax_referer( 'update_can_compress_scripts' ); // Use `update_option()` on single site to mark the option for autoloading. if ( is_multisite() ) { - update_site_option( 'can_compress_scripts', 0 ); + update_site_option( 'can_compress_scripts', 0, 'off' ); } 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' ); // Use `update_option()` on single site to mark the option for autoloading. if ( is_multisite() ) { - update_site_option( 'can_compress_scripts', 1 ); + update_site_option( 'can_compress_scripts', 1, 'off' ); } else { - update_option( 'can_compress_scripts', 1, 'yes' ); + update_option( 'can_compress_scripts', 1, 'on' ); } } } From 659d0497ec0213382e6fca8ea896334434e5e236 Mon Sep 17 00:00:00 2001 From: paul bearne Date: Thu, 25 Apr 2024 12:56:25 -0400 Subject: [PATCH 3/6] Update autoload parameters in option functions The commit adjusts the parameters for 'update_option' functions in 'featured-content.php' and 'ajax-actions.php'. It changes the 'autoload' parameter where necessary, updating the values for "featured-content" and "can_compress_scripts" options. It's done to ensure the correct use of the autoloading feature in WordPress functionality. --- src/wp-admin/includes/ajax-actions.php | 6 +++--- .../themes/twentyfourteen/inc/featured-content.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php index ca8865a3826c6..b27961ebe50fd 100644 --- a/src/wp-admin/includes/ajax-actions.php +++ b/src/wp-admin/includes/ajax-actions.php @@ -190,7 +190,7 @@ function wp_ajax_wp_compression_test() { if ( ini_get( 'zlib.output_compression' ) || 'ob_gzhandler' === ini_get( 'output_handler' ) ) { // Use `update_option()` on single site to mark the option for autoloading. if ( is_multisite() ) { - update_site_option( 'can_compress_scripts', 0, 'off' ); + update_site_option( 'can_compress_scripts', 0 ); } else { update_option( 'can_compress_scripts', 0, 'on' ); } @@ -229,7 +229,7 @@ function wp_ajax_wp_compression_test() { check_ajax_referer( 'update_can_compress_scripts' ); // Use `update_option()` on single site to mark the option for autoloading. if ( is_multisite() ) { - update_site_option( 'can_compress_scripts', 0, 'off' ); + update_site_option( 'can_compress_scripts', 0 ); } else { update_option( 'can_compress_scripts', 0, 'on' ); } @@ -237,7 +237,7 @@ function wp_ajax_wp_compression_test() { check_ajax_referer( 'update_can_compress_scripts' ); // Use `update_option()` on single site to mark the option for autoloading. if ( is_multisite() ) { - update_site_option( 'can_compress_scripts', 1, 'off' ); + update_site_option( 'can_compress_scripts', 1 ); } else { update_option( 'can_compress_scripts', 1, 'on' ); } diff --git a/src/wp-content/themes/twentyfourteen/inc/featured-content.php b/src/wp-content/themes/twentyfourteen/inc/featured-content.php index 8b36b12c31519..beebbc0c5d67b 100644 --- a/src/wp-content/themes/twentyfourteen/inc/featured-content.php +++ b/src/wp-content/themes/twentyfourteen/inc/featured-content.php @@ -268,7 +268,7 @@ public static function delete_post_tag( $tag_id ) { $settings['tag-id'] = 0; $settings = self::validate_settings( $settings ); - update_option( 'featured-content', $settings ); + update_option( 'featured-content', $settings, 'on' ); } /** From aa2a37aca97094e418d72438eeec20fe1fc52a29 Mon Sep 17 00:00:00 2001 From: paul bearne Date: Mon, 29 Apr 2024 14:08:58 -0400 Subject: [PATCH 4/6] Adjust third argument in update_option() across various scripts This commit adds a third argument to the update_option() function calls across a large number of scripts. This argument toggles whether the option should be loaded from cache (on) or not (off). The changes made help to better manage data caching in WordPress and potentially improve performance by avoiding unnecessary database queries. --- src/wp-admin/admin.php | 2 +- src/wp-admin/includes/ajax-actions.php | 2 +- .../includes/class-plugin-upgrader.php | 4 +- .../includes/class-theme-upgrader.php | 4 +- .../includes/class-wp-automatic-updater.php | 2 +- .../includes/class-wp-plugins-list-table.php | 2 +- .../class-wp-privacy-policy-content.php | 2 +- src/wp-admin/includes/class-wp-upgrader.php | 2 +- src/wp-admin/includes/dashboard.php | 2 +- src/wp-admin/includes/file.php | 2 +- src/wp-admin/includes/misc.php | 2 +- src/wp-admin/includes/nav-menu.php | 2 +- src/wp-admin/includes/plugin.php | 14 ++-- src/wp-admin/includes/schema.php | 2 +- src/wp-admin/includes/update-core.php | 2 +- src/wp-admin/includes/upgrade.php | 64 ++++++++++--------- src/wp-admin/ms-delete-site.php | 2 +- src/wp-admin/network/site-info.php | 4 +- src/wp-admin/network/site-settings.php | 2 +- src/wp-admin/network/site-themes.php | 2 +- src/wp-admin/options-reading.php | 4 +- src/wp-admin/options.php | 4 +- src/wp-admin/plugins.php | 12 ++-- src/wp-admin/widgets-form.php | 2 +- .../class-wp-paused-extensions-storage.php | 6 +- .../class-wp-recovery-mode-key-service.php | 2 +- src/wp-includes/class-wp-theme.php | 4 +- src/wp-includes/class-wp-widget.php | 2 +- src/wp-includes/class-wp-xmlrpc-server.php | 2 +- src/wp-includes/cron.php | 4 +- src/wp-includes/deprecated.php | 2 +- src/wp-includes/functions.php | 2 +- src/wp-includes/ms-deprecated.php | 12 ++-- src/wp-includes/plugin.php | 2 +- src/wp-includes/widgets.php | 2 +- src/wp-login.php | 2 +- 36 files changed, 93 insertions(+), 91 deletions(-) diff --git a/src/wp-admin/admin.php b/src/wp-admin/admin.php index 455620f1c7d21..41b994248ec1c 100644 --- a/src/wp-admin/admin.php +++ b/src/wp-admin/admin.php @@ -38,7 +38,7 @@ if ( get_option( 'db_upgraded' ) ) { flush_rewrite_rules(); - update_option( 'db_upgraded', false ); + update_option( 'db_upgraded', false, 'on' ); /** * Fires on the next page load after a successful DB upgrade. diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php index b27961ebe50fd..2ea91f0290a46 100644 --- a/src/wp-admin/includes/ajax-actions.php +++ b/src/wp-admin/includes/ajax-actions.php @@ -2483,7 +2483,7 @@ function wp_ajax_delete_inactive_widgets() { $id_base = implode( '-', $pieces ); $widget = get_option( 'widget_' . $id_base ); unset( $widget[ $multi_number ] ); - update_option( 'widget_' . $id_base, $widget ); + update_option( 'widget_' . $id_base, $widget, 'off' ); unset( $sidebars_widgets['wp_inactive_widgets'][ $key ] ); } diff --git a/src/wp-admin/includes/class-plugin-upgrader.php b/src/wp-admin/includes/class-plugin-upgrader.php index 091cfebc188ff..a924cd953056b 100644 --- a/src/wp-admin/includes/class-plugin-upgrader.php +++ b/src/wp-admin/includes/class-plugin-upgrader.php @@ -262,7 +262,7 @@ public function upgrade( $plugin, $args = array() ) { if ( isset( $past_failure_emails[ $plugin ] ) ) { unset( $past_failure_emails[ $plugin ] ); - update_option( 'auto_plugin_theme_update_emails', $past_failure_emails ); + update_option( 'auto_plugin_theme_update_emails', $past_failure_emails, 'off' ); } return true; @@ -444,7 +444,7 @@ public function bulk_upgrade( $plugins, $args = array() ) { unset( $past_failure_emails[ $plugin ] ); } - update_option( 'auto_plugin_theme_update_emails', $past_failure_emails ); + update_option( 'auto_plugin_theme_update_emails', $past_failure_emails, 'off' ); return $results; } diff --git a/src/wp-admin/includes/class-theme-upgrader.php b/src/wp-admin/includes/class-theme-upgrader.php index 869bf64220fdf..dd944c9e93289 100644 --- a/src/wp-admin/includes/class-theme-upgrader.php +++ b/src/wp-admin/includes/class-theme-upgrader.php @@ -359,7 +359,7 @@ public function upgrade( $theme, $args = array() ) { if ( isset( $past_failure_emails[ $theme ] ) ) { unset( $past_failure_emails[ $theme ] ); - update_option( 'auto_plugin_theme_update_emails', $past_failure_emails ); + update_option( 'auto_plugin_theme_update_emails', $past_failure_emails. 'off' ); } return true; @@ -545,7 +545,7 @@ public function bulk_upgrade( $themes, $args = array() ) { unset( $past_failure_emails[ $theme ] ); } - update_option( 'auto_plugin_theme_update_emails', $past_failure_emails ); + update_option( 'auto_plugin_theme_update_emails', $past_failure_emails. 'off' ); return $results; } diff --git a/src/wp-admin/includes/class-wp-automatic-updater.php b/src/wp-admin/includes/class-wp-automatic-updater.php index bb8cb402aff54..d34a0a6fec1f1 100644 --- a/src/wp-admin/includes/class-wp-automatic-updater.php +++ b/src/wp-admin/includes/class-wp-automatic-updater.php @@ -1359,7 +1359,7 @@ protected function send_plugin_theme_email( $type, $successful_updates, $failed_ $result = wp_mail( $email['to'], wp_specialchars_decode( $email['subject'] ), $email['body'], $email['headers'] ); if ( $result ) { - update_option( 'auto_plugin_theme_update_emails', $past_failure_emails ); + update_option( 'auto_plugin_theme_update_emails', $past_failure_emails, 'off' ); } } diff --git a/src/wp-admin/includes/class-wp-plugins-list-table.php b/src/wp-admin/includes/class-wp-plugins-list-table.php index 4cc0132b6fa7d..0065dba904834 100644 --- a/src/wp-admin/includes/class-wp-plugins-list-table.php +++ b/src/wp-admin/includes/class-wp-plugins-list-table.php @@ -193,7 +193,7 @@ public function prepare_items() { if ( $screen->in_admin( 'network' ) ) { update_site_option( 'recently_activated', $recently_activated ); } else { - update_option( 'recently_activated', $recently_activated ); + update_option( 'recently_activated', $recently_activated, 'off' ); } $plugin_info = get_site_transient( 'update_plugins' ); diff --git a/src/wp-admin/includes/class-wp-privacy-policy-content.php b/src/wp-admin/includes/class-wp-privacy-policy-content.php index e0775f7bea7b4..d721a4f99d5d7 100644 --- a/src/wp-admin/includes/class-wp-privacy-policy-content.php +++ b/src/wp-admin/includes/class-wp-privacy-policy-content.php @@ -120,7 +120,7 @@ public static function text_change_check() { // Cache the result for use before `admin_init` (see above). if ( $cached !== $state ) { - update_option( '_wp_suggested_policy_text_has_changed', $state ); + update_option( '_wp_suggested_policy_text_has_changed', $state, 'off' ); } return 'changed' === $state; diff --git a/src/wp-admin/includes/class-wp-upgrader.php b/src/wp-admin/includes/class-wp-upgrader.php index 2cbc6bcb033eb..49699c5ea770d 100644 --- a/src/wp-admin/includes/class-wp-upgrader.php +++ b/src/wp-admin/includes/class-wp-upgrader.php @@ -1038,7 +1038,7 @@ public static function create_lock( $lock_name, $release_timeout = null ) { } // Update the lock, as by this point we've definitely got a lock, just need to fire the actions. - update_option( $lock_option, time() ); + update_option( $lock_option, time(), 'off' ); return true; } diff --git a/src/wp-admin/includes/dashboard.php b/src/wp-admin/includes/dashboard.php index 2aeaa24e461b4..7e3cc24ac71bb 100644 --- a/src/wp-admin/includes/dashboard.php +++ b/src/wp-admin/includes/dashboard.php @@ -1287,7 +1287,7 @@ function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) { } } - update_option( 'dashboard_widget_options', $widget_options ); + update_option( 'dashboard_widget_options', $widget_options. 'off' ); $locale = get_user_locale(); $cache_key = 'dash_v2_' . md5( $widget_id . '_' . $locale ); diff --git a/src/wp-admin/includes/file.php b/src/wp-admin/includes/file.php index 75c741541ae4c..1ba777239db4f 100644 --- a/src/wp-admin/includes/file.php +++ b/src/wp-admin/includes/file.php @@ -2496,7 +2496,7 @@ function request_filesystem_credentials( $form_post, $type = '', $error = false, ); if ( ! wp_installing() ) { - update_option( 'ftp_credentials', $stored_credentials ); + update_option( 'ftp_credentials', $stored_credentials, 'off' ); } return $credentials; diff --git a/src/wp-admin/includes/misc.php b/src/wp-admin/includes/misc.php index 7794183d6ed58..8c4eee1f60c93 100644 --- a/src/wp-admin/includes/misc.php +++ b/src/wp-admin/includes/misc.php @@ -352,7 +352,7 @@ function update_recently_edited( $file ) { $oldfiles[] = $file; } - update_option( 'recently_edited', $oldfiles ); + update_option( 'recently_edited', $oldfiles, 'off' ); } /** diff --git a/src/wp-admin/includes/nav-menu.php b/src/wp-admin/includes/nav-menu.php index 8f18057c238f5..a168d98e94a47 100644 --- a/src/wp-admin/includes/nav-menu.php +++ b/src/wp-admin/includes/nav-menu.php @@ -1484,7 +1484,7 @@ function wp_nav_menu_update_menu_items( $nav_menu_selected_id, $nav_menu_selecte wp_get_nav_menus( array( 'fields' => 'ids' ) ) ); - update_option( 'nav_menu_options', $nav_menu_option ); + update_option( 'nav_menu_options', $nav_menu_option, 'off' ); wp_defer_term_counting( false ); diff --git a/src/wp-admin/includes/plugin.php b/src/wp-admin/includes/plugin.php index bcae2733670d2..ec23cfd8e757d 100644 --- a/src/wp-admin/includes/plugin.php +++ b/src/wp-admin/includes/plugin.php @@ -713,7 +713,7 @@ function activate_plugin( $plugin, $redirect = '', $network_wide = false, $silen $current = get_option( 'active_plugins', array() ); $current[] = $plugin; sort( $current ); - update_option( 'active_plugins', $current ); + update_option( 'active_plugins', $current, 'off' ); } if ( ! $silent ) { @@ -844,7 +844,7 @@ function deactivate_plugins( $plugins, $silent = false, $network_wide = null ) { } if ( $do_blog ) { - update_option( 'active_plugins', $current ); + update_option( 'active_plugins', $current, 'off' ); } if ( $do_network ) { update_site_option( 'active_sitewide_plugins', $network_current ); @@ -1072,7 +1072,7 @@ function validate_active_plugins() { $plugins = get_option( 'active_plugins', array() ); // Validate vartype: array. if ( ! is_array( $plugins ) ) { - update_option( 'active_plugins', array() ); + update_option( 'active_plugins', array(), 'off' ); $plugins = array(); } @@ -1306,7 +1306,7 @@ function uninstall_plugin( $plugin ) { if ( file_exists( WP_PLUGIN_DIR . '/' . dirname( $file ) . '/uninstall.php' ) ) { if ( isset( $uninstallable_plugins[ $file ] ) ) { unset( $uninstallable_plugins[ $file ] ); - update_option( 'uninstall_plugins', $uninstallable_plugins ); + update_option( 'uninstall_plugins', $uninstallable_plugins, 'off' ); } unset( $uninstallable_plugins ); @@ -1321,7 +1321,7 @@ function uninstall_plugin( $plugin ) { if ( isset( $uninstallable_plugins[ $file ] ) ) { $callable = $uninstallable_plugins[ $file ]; unset( $uninstallable_plugins[ $file ] ); - update_option( 'uninstall_plugins', $uninstallable_plugins ); + update_option( 'uninstall_plugins', $uninstallable_plugins, 'off' ); unset( $uninstallable_plugins ); wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $file ); @@ -2612,7 +2612,7 @@ function deactivated_plugins_notice() { if ( false === $blog_deactivated_plugins ) { // Option not in database, add an empty array to avoid extra DB queries on subsequent loads. - update_option( 'wp_force_deactivated_plugins', array() ); + update_option( 'wp_force_deactivated_plugins', array(), 'off' ); } if ( is_multisite() ) { @@ -2666,7 +2666,7 @@ function deactivated_plugins_notice() { } // Empty the options. - update_option( 'wp_force_deactivated_plugins', array() ); + update_option( 'wp_force_deactivated_plugins', array(), 'off' ); if ( is_multisite() ) { update_site_option( 'wp_force_deactivated_plugins', array() ); } diff --git a/src/wp-admin/includes/schema.php b/src/wp-admin/includes/schema.php index cd06364caf269..7c0684018b7bc 100644 --- a/src/wp-admin/includes/schema.php +++ b/src/wp-admin/includes/schema.php @@ -614,7 +614,7 @@ function populate_options( array $options = array() ) { // In case it is set, but blank, update "home". if ( ! __get_option( 'home' ) ) { - update_option( 'home', $guessurl ); + update_option( 'home', $guessurl, 'on' ); } // Delete unused options. diff --git a/src/wp-admin/includes/update-core.php b/src/wp-admin/includes/update-core.php index fd0032601fc1c..e7199ff4608b2 100644 --- a/src/wp-admin/includes/update-core.php +++ b/src/wp-admin/includes/update-core.php @@ -1758,7 +1758,7 @@ function _upgrade_core_deactivate_incompatible_plugins() { } else { $deactivated_plugins = get_option( 'wp_force_deactivated_plugins', array() ); $deactivated_plugins = array_merge( $deactivated_plugins, $deactivated_gutenberg ); - update_option( 'wp_force_deactivated_plugins', $deactivated_plugins ); + update_option( 'wp_force_deactivated_plugins', $deactivated_plugins, 'off' ); } deactivate_plugins( array( 'gutenberg/gutenberg.php' ), true ); } diff --git a/src/wp-admin/includes/upgrade.php b/src/wp-admin/includes/upgrade.php index 8e89f936aa9db..68286e406653d 100644 --- a/src/wp-admin/includes/upgrade.php +++ b/src/wp-admin/includes/upgrade.php @@ -55,24 +55,24 @@ function wp_install( $blog_title, $user_name, $user_email, $is_public, $deprecat populate_options(); populate_roles(); - update_option( 'blogname', $blog_title ); - update_option( 'admin_email', $user_email ); - update_option( 'blog_public', $is_public ); + update_option( 'blogname', $blog_title, 'on' ); + update_option( 'admin_email', $user_email, 'off' ); + update_option( 'blog_public', $is_public, 'on' ); // Freshness of site - in the future, this could get more specific about actions taken, perhaps. - update_option( 'fresh_site', 1 ); + update_option( 'fresh_site', 1, 'off' ); if ( $language ) { - update_option( 'WPLANG', $language ); + update_option( 'WPLANG', $language, 'on' ); } $guessurl = wp_guess_url(); - update_option( 'siteurl', $guessurl ); + update_option( 'siteurl', $guessurl, 'on' ); // If not a public site, don't ping. if ( ! $is_public ) { - update_option( 'default_pingback_flag', 0 ); + update_option( 'default_pingback_flag', 0, 'on' ); } /* @@ -390,7 +390,7 @@ function wp_install_defaults( $user_id ) { 'meta_value' => 'default', ) ); - update_option( 'wp_page_for_privacy_policy', 3 ); + update_option( 'wp_page_for_privacy_policy', 3, 'on' ); } // Set up default widgets for default theme. @@ -403,7 +403,8 @@ function wp_install_defaults( $user_id ) { 5 => array( 'content' => '

' . __( 'Archives' ) . '

' ), 6 => array( 'content' => '

' . __( 'Categories' ) . '

' ), '_multiwidget' => 1, - ) + ), + 'on' ); update_option( 'sidebars_widgets', @@ -419,7 +420,8 @@ function wp_install_defaults( $user_id ) { 1 => 'block-6', ), 'array_version' => 3, - ) + ), + 'on' ); if ( ! is_multisite() ) { @@ -851,8 +853,8 @@ function upgrade_all() { maybe_disable_automattic_widgets(); - update_option( 'db_version', $wp_db_version ); - update_option( 'db_upgraded', true ); + update_option( 'db_version', $wp_db_version, 'on' ); + update_option( 'db_upgraded', true, 'on' ); } /** @@ -1064,7 +1066,7 @@ function upgrade_130() { */ if ( ! is_array( $active_plugins ) ) { $active_plugins = explode( "\n", trim( $active_plugins ) ); - update_option( 'active_plugins', $active_plugins ); + update_option( 'active_plugins', $active_plugins, 'off' ); } // Obsolete tables. @@ -1453,7 +1455,7 @@ function upgrade_230() { } // Set default to the last category we grabbed during the upgrade loop. - update_option( 'default_link_category', $default_link_cat ); + update_option( 'default_link_category', $default_link_cat, 'off' ); } else { $links = $wpdb->get_results( "SELECT link_id, category_id FROM $wpdb->link2cat GROUP BY link_id, category_id" ); foreach ( $links as $link ) { @@ -1630,7 +1632,7 @@ function upgrade_280() { $value = stripslashes( $value ); } if ( $value !== $row->option_value ) { - update_option( $row->option_name, $value ); + update_option( $row->option_name, $value, 'on' ); } } $start += 20; @@ -1656,8 +1658,8 @@ function upgrade_290() { * but now 2 is the minimum depth to avoid confusion. */ if ( get_option( 'thread_comments_depth' ) == '1' ) { - update_option( 'thread_comments_depth', 2 ); - update_option( 'thread_comments', 0 ); + update_option( 'thread_comments_depth', 2, 'on' ); + update_option( 'thread_comments', 0, 'on' ); } } } @@ -1792,7 +1794,7 @@ function upgrade_330() { case 2: $sidebars_widgets = retrieve_widgets(); $sidebars_widgets['array_version'] = 3; - update_option( 'sidebars_widgets', $sidebars_widgets ); + update_option( 'sidebars_widgets', $sidebars_widgets, 'on' ); } } @@ -1846,7 +1848,7 @@ function upgrade_350() { global $wp_current_db_version, $wpdb; if ( $wp_current_db_version < 22006 && $wpdb->get_var( "SELECT link_id FROM $wpdb->links LIMIT 1" ) ) { - update_option( 'link_manager_enabled', 1 ); // Previously set to 0 by populate_options(). + update_option( 'link_manager_enabled', 1, 'on' ); // Previously set to 0 by populate_options(). } if ( $wp_current_db_version < 21811 && wp_should_upgrade_global_tables() ) { @@ -1932,9 +1934,9 @@ function upgrade_400() { if ( $wp_current_db_version < 29630 ) { if ( ! is_multisite() && false === get_option( 'WPLANG' ) ) { if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && in_array( WPLANG, get_available_languages(), true ) ) { - update_option( 'WPLANG', WPLANG ); + update_option( 'WPLANG', WPLANG, 'on' ); } else { - update_option( 'WPLANG', '' ); + update_option( 'WPLANG', '', 'on' ); } } } @@ -1966,7 +1968,7 @@ function upgrade_430() { // Shared terms are split in a separate process. if ( $wp_current_db_version < 32814 ) { - update_option( 'finished_splitting_shared_terms', 0 ); + update_option( 'finished_splitting_shared_terms', 0, 'off' ); wp_schedule_single_event( time() + ( 1 * MINUTE_IN_SECONDS ), 'wp_split_shared_term_batch' ); } @@ -2128,7 +2130,7 @@ function upgrade_460() { } } - update_option( 'uninstall_plugins', $uninstall_plugins ); + update_option( 'uninstall_plugins', $uninstall_plugins, 'off' ); } } } @@ -2168,7 +2170,7 @@ function upgrade_530() { * is shown next time an admin logs in. */ if ( function_exists( 'current_user_can' ) && ! current_user_can( 'manage_options' ) ) { - update_option( 'admin_email_lifespan', 0 ); + update_option( 'admin_email_lifespan', 0, 'off' ); } } @@ -2185,7 +2187,7 @@ function upgrade_550() { if ( $wp_current_db_version < 48121 ) { $comment_previously_approved = get_option( 'comment_whitelist', '' ); - update_option( 'comment_previously_approved', $comment_previously_approved ); + update_option( 'comment_previously_approved', $comment_previously_approved, 'on' ); delete_option( 'comment_whitelist' ); } @@ -2201,13 +2203,13 @@ function upgrade_550() { $disallowed_list = get_option( 'blocklist_keys' ); } - update_option( 'disallowed_keys', $disallowed_list ); + update_option( 'disallowed_keys', $disallowed_list, 'on' ); delete_option( 'blacklist_keys' ); delete_option( 'blocklist_keys' ); } if ( $wp_current_db_version < 48748 ) { - update_option( 'finished_updating_comment_type', 0 ); + update_option( 'finished_updating_comment_type', 0, 'off' ); wp_schedule_single_event( time() + ( 1 * MINUTE_IN_SECONDS ), 'wp_update_comment_type_batch' ); } } @@ -2239,7 +2241,7 @@ function upgrade_560() { * This overrides the same option from populate_options() that is intended for new installs. * See https://core.trac.wordpress.org/ticket/51742. */ - update_option( 'auto_update_core_major', 'unset' ); + update_option( 'auto_update_core_major', 'unset', 'off' ); } if ( $wp_current_db_version < 49632 ) { @@ -2343,7 +2345,7 @@ function upgrade_640() { if ( $wp_current_db_version < 56657 ) { // Enable attachment pages. - update_option( 'wp_attachment_pages_enabled', 1 ); + update_option( 'wp_attachment_pages_enabled', 1, 'off' ); // Remove the wp_https_detection cron. Https status is checked directly in an async Site Health check. $scheduled = wp_get_scheduled_event( 'wp_https_detection' ); @@ -3505,8 +3507,8 @@ function make_site_theme() { // Make the new site theme active. $current_template = __get_option( 'template' ); if ( WP_DEFAULT_THEME == $current_template ) { - update_option( 'template', $template ); - update_option( 'stylesheet', $template ); + update_option( 'template', $template, 'on' ); + update_option( 'stylesheet', $template, 'on' ); } return $template; } diff --git a/src/wp-admin/ms-delete-site.php b/src/wp-admin/ms-delete-site.php index be66975f567f0..f164f83eced7b 100644 --- a/src/wp-admin/ms-delete-site.php +++ b/src/wp-admin/ms-delete-site.php @@ -48,7 +48,7 @@ check_admin_referer( 'delete-blog' ); $hash = wp_generate_password( 20, false ); - update_option( 'delete_blog_hash', $hash ); + update_option( 'delete_blog_hash', $hash, 'off' ); $url_delete = esc_url( admin_url( 'ms-delete-site.php?h=' . $hash ) ); diff --git a/src/wp-admin/network/site-info.php b/src/wp-admin/network/site-info.php index defcc26e44060..50c88762b8cc7 100644 --- a/src/wp-admin/network/site-info.php +++ b/src/wp-admin/network/site-info.php @@ -91,7 +91,7 @@ if ( $old_home_parsed['host'] === $existing_details->domain && $old_home_parsed['path'] === $existing_details->path ) { $new_home_url = untrailingslashit( sanitize_url( $blog_data['scheme'] . '://' . $new_details->domain . $new_details->path ) ); - update_option( 'home', $new_home_url ); + update_option( 'home', $new_home_url, 'on' ); } $old_site_url = trailingslashit( esc_url( get_option( 'siteurl' ) ) ); @@ -99,7 +99,7 @@ if ( $old_site_parsed['host'] === $existing_details->domain && $old_site_parsed['path'] === $existing_details->path ) { $new_site_url = untrailingslashit( sanitize_url( $blog_data['scheme'] . '://' . $new_details->domain . $new_details->path ) ); - update_option( 'siteurl', $new_site_url ); + update_option( 'siteurl', $new_site_url, 'on' ); } restore_current_blog(); diff --git a/src/wp-admin/network/site-settings.php b/src/wp-admin/network/site-settings.php index adfc95cfa9d70..0ff7e89397ff4 100644 --- a/src/wp-admin/network/site-settings.php +++ b/src/wp-admin/network/site-settings.php @@ -46,7 +46,7 @@ if ( 0 === $key || is_array( $val ) || in_array( $key, $skip_options, true ) ) { continue; // Avoids "0 is a protected WP option and may not be modified" error when editing blog options. } - update_option( $key, $val ); + update_option( $key, $val, 'on' ); } /** diff --git a/src/wp-admin/network/site-themes.php b/src/wp-admin/network/site-themes.php index 79fe4d5f0576b..f44b3fa5877f8 100644 --- a/src/wp-admin/network/site-themes.php +++ b/src/wp-admin/network/site-themes.php @@ -143,7 +143,7 @@ } } - update_option( 'allowedthemes', $allowed_themes ); + update_option( 'allowedthemes', $allowed_themes, 'off' ); restore_current_blog(); wp_safe_redirect( diff --git a/src/wp-admin/options-reading.php b/src/wp-admin/options-reading.php index 5dd40f37c4e32..e2df7dff20d34 100644 --- a/src/wp-admin/options-reading.php +++ b/src/wp-admin/options-reading.php @@ -74,12 +74,12 @@ diff --git a/src/wp-admin/options.php b/src/wp-admin/options.php index 33779a7492515..bac9bb6860edf 100644 --- a/src/wp-admin/options.php +++ b/src/wp-admin/options.php @@ -62,7 +62,7 @@ && hash_equals( $new_admin_details['hash'], $_GET['adminhash'] ) && ! empty( $new_admin_details['newemail'] ) ) { - update_option( 'admin_email', $new_admin_details['newemail'] ); + update_option( 'admin_email', $new_admin_details['newemail'], 'off' ); delete_option( 'adminhash' ); delete_option( 'new_admin_email' ); $redirect = 'options-general.php?updated=true'; @@ -337,7 +337,7 @@ } $value = wp_unslash( $value ); } - update_option( $option, $value ); + update_option( $option, $value, 'on' ); } /* diff --git a/src/wp-admin/plugins.php b/src/wp-admin/plugins.php index e8f1074a71b2b..1e8ace6c9b72f 100644 --- a/src/wp-admin/plugins.php +++ b/src/wp-admin/plugins.php @@ -71,11 +71,11 @@ if ( ! is_network_admin() ) { $recent = (array) get_option( 'recently_activated' ); unset( $recent[ $plugin ] ); - update_option( 'recently_activated', $recent ); + update_option( 'recently_activated', $recent, 'off' ); } else { $recent = (array) get_site_option( 'recently_activated' ); unset( $recent[ $plugin ] ); - update_site_option( 'recently_activated', $recent ); + update_site_option( 'recently_activated', $recent, 'off' ); } if ( isset( $_GET['from'] ) && 'import' === $_GET['from'] ) { @@ -211,7 +211,7 @@ deactivate_plugins( $plugin, false, is_network_admin() ); if ( ! is_network_admin() ) { - update_option( 'recently_activated', array( $plugin => time() ) + (array) get_option( 'recently_activated' ) ); + update_option( 'recently_activated', array( $plugin => time() ) + (array) get_option( 'recently_activated' ), 'off' ); } else { update_site_option( 'recently_activated', array( $plugin => time() ) + (array) get_site_option( 'recently_activated' ) ); } @@ -258,7 +258,7 @@ } if ( ! is_network_admin() ) { - update_option( 'recently_activated', $deactivated + (array) get_option( 'recently_activated' ) ); + update_option( 'recently_activated', $deactivated + (array) get_option( 'recently_activated' ), 'off' ); } else { update_site_option( 'recently_activated', $deactivated + (array) get_site_option( 'recently_activated' ) ); } @@ -431,12 +431,12 @@ // Store the result in an option rather than a URL param due to object type & length. // Cannot use transient/cache, as that could get flushed if any plugin flushes data on uninstall/delete. - update_option( 'plugins_delete_result_' . $user_ID, $delete_result, false ); + update_option( 'plugins_delete_result_' . $user_ID, $delete_result, 'off' ); wp_redirect( self_admin_url( "plugins.php?deleted=$plugins_to_delete&plugin_status=$status&paged=$page&s=$s" ) ); exit; case 'clear-recent-list': if ( ! is_network_admin() ) { - update_option( 'recently_activated', array() ); + update_option( 'recently_activated', array(), 'off' ); } else { update_site_option( 'recently_activated', array() ); } diff --git a/src/wp-admin/widgets-form.php b/src/wp-admin/widgets-form.php index 461f8d6fb4089..5b40a6daf6574 100644 --- a/src/wp-admin/widgets-form.php +++ b/src/wp-admin/widgets-form.php @@ -211,7 +211,7 @@ $id_base = implode( '-', $pieces ); $widget = get_option( 'widget_' . $id_base ); unset( $widget[ $multi_number ] ); - update_option( 'widget_' . $id_base, $widget ); + update_option( 'widget_' . $id_base, $widget, 'off' ); unset( $sidebars_widgets['wp_inactive_widgets'][ $key ] ); } diff --git a/src/wp-includes/class-wp-paused-extensions-storage.php b/src/wp-includes/class-wp-paused-extensions-storage.php index a1b2b6d5ae85d..fa3f7ce5c553b 100644 --- a/src/wp-includes/class-wp-paused-extensions-storage.php +++ b/src/wp-includes/class-wp-paused-extensions-storage.php @@ -72,7 +72,7 @@ public function set( $extension, $error ) { $paused_extensions[ $this->type ][ $extension ] = $error; - return update_option( $option_name, $paused_extensions ); + return update_option( $option_name, $paused_extensions, 'off' ); } /** @@ -112,7 +112,7 @@ public function delete( $extension ) { return delete_option( $option_name ); } - return update_option( $option_name, $paused_extensions ); + return update_option( $option_name, $paused_extensions, 'off' ); } /** @@ -190,7 +190,7 @@ public function delete_all() { return delete_option( $option_name ); } - return update_option( $option_name, $paused_extensions ); + return update_option( $option_name, $paused_extensions, 'off' ); } /** diff --git a/src/wp-includes/class-wp-recovery-mode-key-service.php b/src/wp-includes/class-wp-recovery-mode-key-service.php index c9a6a24368391..9db8ecc55b5de 100644 --- a/src/wp-includes/class-wp-recovery-mode-key-service.php +++ b/src/wp-includes/class-wp-recovery-mode-key-service.php @@ -187,6 +187,6 @@ private function get_keys() { * @return bool True on success, false on failure. */ private function update_keys( array $keys ) { - return update_option( $this->option_name, $keys ); + return update_option( $this->option_name, $keys, 'off' ); } } diff --git a/src/wp-includes/class-wp-theme.php b/src/wp-includes/class-wp-theme.php index 6db75e4058eef..697ca2865e350 100644 --- a/src/wp-includes/class-wp-theme.php +++ b/src/wp-includes/class-wp-theme.php @@ -1757,11 +1757,11 @@ public static function get_allowed_on_site( $blog_id = null ) { // Set the option so we never have to go through this pain again. if ( is_admin() && $allowed_themes[ $blog_id ] ) { if ( $current ) { - update_option( 'allowedthemes', $allowed_themes[ $blog_id ] ); + update_option( 'allowedthemes', $allowed_themes[ $blog_id ], 'off' ); delete_option( 'allowed_themes' ); } else { switch_to_blog( $blog_id ); - update_option( 'allowedthemes', $allowed_themes[ $blog_id ] ); + update_option( 'allowedthemes', $allowed_themes[ $blog_id ], 'off' ); delete_option( 'allowed_themes' ); restore_current_blog(); } diff --git a/src/wp-includes/class-wp-widget.php b/src/wp-includes/class-wp-widget.php index f7557a0e3bb44..837444d21d354 100644 --- a/src/wp-includes/class-wp-widget.php +++ b/src/wp-includes/class-wp-widget.php @@ -598,7 +598,7 @@ public function _register_one( $number = -1 ) { */ public function save_settings( $settings ) { $settings['_multiwidget'] = 1; - update_option( $this->option_name, $settings ); + update_option( $this->option_name, $settings, 'on' ); } /** diff --git a/src/wp-includes/class-wp-xmlrpc-server.php b/src/wp-includes/class-wp-xmlrpc-server.php index 2141f21e59662..6868159b7ab36 100644 --- a/src/wp-includes/class-wp-xmlrpc-server.php +++ b/src/wp-includes/class-wp-xmlrpc-server.php @@ -4330,7 +4330,7 @@ public function wp_setOptions( $args ) { continue; } - update_option( $this->blog_options[ $o_name ]['option'], wp_unslash( $o_value ) ); + update_option( $this->blog_options[ $o_name ]['option'], wp_unslash( $o_value ), 'on' ); } // Now return the updated values. diff --git a/src/wp-includes/cron.php b/src/wp-includes/cron.php index aadc22b7eb17d..702e59ce41ce3 100644 --- a/src/wp-includes/cron.php +++ b/src/wp-includes/cron.php @@ -1239,7 +1239,7 @@ function _set_cron_array( $cron, $wp_error = false ) { $cron['version'] = 2; - $result = update_option( 'cron', $cron ); + $result = update_option( 'cron', $cron, 'on' ); if ( $wp_error && ! $result ) { return new WP_Error( @@ -1279,7 +1279,7 @@ function _upgrade_cron_array( $cron ) { $new_cron['version'] = 2; - update_option( 'cron', $new_cron ); + update_option( 'cron', $new_cron, 'on' ); return $new_cron; } diff --git a/src/wp-includes/deprecated.php b/src/wp-includes/deprecated.php index 155ce0fef0aed..5f504fa6b6d2c 100644 --- a/src/wp-includes/deprecated.php +++ b/src/wp-includes/deprecated.php @@ -6002,7 +6002,7 @@ function wp_update_https_detection_errors() { */ $support_errors = apply_filters( 'pre_wp_update_https_detection_errors', null ); if ( is_wp_error( $support_errors ) ) { - update_option( 'https_detection_errors', $support_errors->errors ); + update_option( 'https_detection_errors', $support_errors->errors, 'off' ); return; } diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index d7cc00672bce3..059c9811ea025 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -4690,7 +4690,7 @@ function _config_wp_siteurl( $url = '' ) { * @access private */ function _delete_option_fresh_site() { - update_option( 'fresh_site', '0' ); + update_option( 'fresh_site', '0', 'off' ); } /** diff --git a/src/wp-includes/ms-deprecated.php b/src/wp-includes/ms-deprecated.php index 5a6b4415edf74..8e976628d0bd3 100644 --- a/src/wp-includes/ms-deprecated.php +++ b/src/wp-includes/ms-deprecated.php @@ -642,17 +642,17 @@ function install_blog( $blog_id, $blog_title = '' ) { } } - update_option( 'siteurl', $siteurl ); - update_option( 'home', $home ); + update_option( 'siteurl', $siteurl, 'on' ); + update_option( 'home', $home, 'on' ); if ( get_site_option( 'ms_files_rewriting' ) ) { - update_option( 'upload_path', UPLOADBLOGSDIR . "/$blog_id/files" ); + update_option( 'upload_path', UPLOADBLOGSDIR . "/$blog_id/files", 'off' ); } else { - update_option( 'upload_path', get_blog_option( get_network()->site_id, 'upload_path' ) ); + update_option( 'upload_path', get_blog_option( get_network()->site_id, 'upload_path' ), 'off' ); } - update_option( 'blogname', wp_unslash( $blog_title ) ); - update_option( 'admin_email', '' ); + update_option( 'blogname', wp_unslash( $blog_title ), 'on' ); + update_option( 'admin_email', '', 'off' ); // Remove all permissions. $table_prefix = $wpdb->get_blog_prefix(); diff --git a/src/wp-includes/plugin.php b/src/wp-includes/plugin.php index 77c1eb4ef669b..b2c88181112b1 100644 --- a/src/wp-includes/plugin.php +++ b/src/wp-includes/plugin.php @@ -936,7 +936,7 @@ function register_uninstall_hook( $file, $callback ) { if ( ! isset( $uninstallable_plugins[ $plugin_basename ] ) || $uninstallable_plugins[ $plugin_basename ] !== $callback ) { $uninstallable_plugins[ $plugin_basename ] = $callback; - update_option( 'uninstall_plugins', $uninstallable_plugins ); + update_option( 'uninstall_plugins', $uninstallable_plugins, 'off' ); } } diff --git a/src/wp-includes/widgets.php b/src/wp-includes/widgets.php index ff48419f1ae39..3b36c3e2214c6 100644 --- a/src/wp-includes/widgets.php +++ b/src/wp-includes/widgets.php @@ -1091,7 +1091,7 @@ function wp_set_sidebars_widgets( $sidebars_widgets ) { $sidebars_widgets['array_version'] = 3; } - update_option( 'sidebars_widgets', $sidebars_widgets ); + update_option( 'sidebars_widgets', $sidebars_widgets, 'on' ); } /** diff --git a/src/wp-login.php b/src/wp-login.php index bd4568a4690b5..67e8fe6076bfc 100644 --- a/src/wp-login.php +++ b/src/wp-login.php @@ -511,7 +511,7 @@ function wp_login_viewport_meta() { $url = dirname( set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] ) ); if ( get_option( 'siteurl' ) !== $url ) { - update_option( 'siteurl', $url ); + update_option( 'siteurl', $url, 'on' ); } } From 9d68d7713264a8572986623298347e95577f29b1 Mon Sep 17 00:00:00 2001 From: paul bearne Date: Mon, 29 Apr 2024 15:09:41 -0400 Subject: [PATCH 5/6] Adjust third argument in update_option() across various scripts This commit adds a third argument to the update_option() function calls across a large number of scripts. This argument toggles whether the option should be loaded from cache (on) or not (off). The changes made help to better manage data caching in WordPress and potentially improve performance by avoiding unnecessary database queries. --- src/wp-admin/includes/class-theme-upgrader.php | 4 ++-- src/wp-admin/includes/dashboard.php | 2 +- src/wp-includes/class-wp-xmlrpc-server.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wp-admin/includes/class-theme-upgrader.php b/src/wp-admin/includes/class-theme-upgrader.php index dd944c9e93289..d8098f028b331 100644 --- a/src/wp-admin/includes/class-theme-upgrader.php +++ b/src/wp-admin/includes/class-theme-upgrader.php @@ -359,7 +359,7 @@ public function upgrade( $theme, $args = array() ) { if ( isset( $past_failure_emails[ $theme ] ) ) { unset( $past_failure_emails[ $theme ] ); - update_option( 'auto_plugin_theme_update_emails', $past_failure_emails. 'off' ); + update_option( 'auto_plugin_theme_update_emails', $past_failure_emails, 'off' ); } return true; @@ -545,7 +545,7 @@ public function bulk_upgrade( $themes, $args = array() ) { unset( $past_failure_emails[ $theme ] ); } - update_option( 'auto_plugin_theme_update_emails', $past_failure_emails. 'off' ); + update_option( 'auto_plugin_theme_update_emails', $past_failure_emails, 'off' ); return $results; } diff --git a/src/wp-admin/includes/dashboard.php b/src/wp-admin/includes/dashboard.php index 7e3cc24ac71bb..d844536fde7d1 100644 --- a/src/wp-admin/includes/dashboard.php +++ b/src/wp-admin/includes/dashboard.php @@ -1287,7 +1287,7 @@ function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) { } } - update_option( 'dashboard_widget_options', $widget_options. 'off' ); + update_option( 'dashboard_widget_options', $widget_options, 'off' ); $locale = get_user_locale(); $cache_key = 'dash_v2_' . md5( $widget_id . '_' . $locale ); diff --git a/src/wp-includes/class-wp-xmlrpc-server.php b/src/wp-includes/class-wp-xmlrpc-server.php index 6868159b7ab36..d3d661c3bf560 100644 --- a/src/wp-includes/class-wp-xmlrpc-server.php +++ b/src/wp-includes/class-wp-xmlrpc-server.php @@ -4330,7 +4330,7 @@ public function wp_setOptions( $args ) { continue; } - update_option( $this->blog_options[ $o_name ]['option'], wp_unslash( $o_value ), 'on' ); + update_option( $this->blog_options[ $o_name ]['option'], wp_unslash( $o_value ), 'on' ); } // Now return the updated values. From 757760839f27ca5383a5901a5f42a24086fec469 Mon Sep 17 00:00:00 2001 From: paul bearne Date: Tue, 30 Apr 2024 13:14:25 -0400 Subject: [PATCH 6/6] revert of block autoload settings --- src/wp-admin/admin.php | 2 +- src/wp-admin/includes/ajax-actions.php | 2 +- .../includes/class-plugin-upgrader.php | 4 +- .../includes/class-theme-upgrader.php | 4 +- .../includes/class-wp-automatic-updater.php | 2 +- .../includes/class-wp-plugins-list-table.php | 2 +- .../class-wp-privacy-policy-content.php | 2 +- src/wp-admin/includes/class-wp-upgrader.php | 2 +- src/wp-admin/includes/dashboard.php | 2 +- src/wp-admin/includes/file.php | 2 +- src/wp-admin/includes/misc.php | 2 +- src/wp-admin/includes/nav-menu.php | 2 +- src/wp-admin/includes/plugin.php | 14 ++-- src/wp-admin/includes/schema.php | 2 +- src/wp-admin/includes/update-core.php | 2 +- src/wp-admin/includes/upgrade.php | 64 +++++++++---------- src/wp-admin/ms-delete-site.php | 2 +- src/wp-admin/network/site-info.php | 4 +- src/wp-admin/network/site-settings.php | 2 +- src/wp-admin/network/site-themes.php | 2 +- src/wp-admin/options-reading.php | 4 +- src/wp-admin/options.php | 4 +- src/wp-admin/plugins.php | 12 ++-- src/wp-admin/widgets-form.php | 2 +- .../twentyfourteen/inc/featured-content.php | 2 +- .../class-wp-paused-extensions-storage.php | 6 +- .../class-wp-recovery-mode-key-service.php | 2 +- src/wp-includes/class-wp-theme.php | 4 +- src/wp-includes/class-wp-widget.php | 2 +- src/wp-includes/class-wp-xmlrpc-server.php | 2 +- src/wp-includes/cron.php | 4 +- src/wp-includes/deprecated.php | 2 +- src/wp-includes/functions.php | 2 +- src/wp-includes/ms-deprecated.php | 12 ++-- src/wp-includes/plugin.php | 2 +- src/wp-includes/widgets.php | 2 +- src/wp-login.php | 2 +- 37 files changed, 92 insertions(+), 94 deletions(-) diff --git a/src/wp-admin/admin.php b/src/wp-admin/admin.php index 41b994248ec1c..455620f1c7d21 100644 --- a/src/wp-admin/admin.php +++ b/src/wp-admin/admin.php @@ -38,7 +38,7 @@ if ( get_option( 'db_upgraded' ) ) { flush_rewrite_rules(); - update_option( 'db_upgraded', false, 'on' ); + update_option( 'db_upgraded', false ); /** * Fires on the next page load after a successful DB upgrade. diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php index 2ea91f0290a46..b27961ebe50fd 100644 --- a/src/wp-admin/includes/ajax-actions.php +++ b/src/wp-admin/includes/ajax-actions.php @@ -2483,7 +2483,7 @@ function wp_ajax_delete_inactive_widgets() { $id_base = implode( '-', $pieces ); $widget = get_option( 'widget_' . $id_base ); unset( $widget[ $multi_number ] ); - update_option( 'widget_' . $id_base, $widget, 'off' ); + update_option( 'widget_' . $id_base, $widget ); unset( $sidebars_widgets['wp_inactive_widgets'][ $key ] ); } diff --git a/src/wp-admin/includes/class-plugin-upgrader.php b/src/wp-admin/includes/class-plugin-upgrader.php index a924cd953056b..091cfebc188ff 100644 --- a/src/wp-admin/includes/class-plugin-upgrader.php +++ b/src/wp-admin/includes/class-plugin-upgrader.php @@ -262,7 +262,7 @@ public function upgrade( $plugin, $args = array() ) { if ( isset( $past_failure_emails[ $plugin ] ) ) { unset( $past_failure_emails[ $plugin ] ); - update_option( 'auto_plugin_theme_update_emails', $past_failure_emails, 'off' ); + update_option( 'auto_plugin_theme_update_emails', $past_failure_emails ); } return true; @@ -444,7 +444,7 @@ public function bulk_upgrade( $plugins, $args = array() ) { unset( $past_failure_emails[ $plugin ] ); } - update_option( 'auto_plugin_theme_update_emails', $past_failure_emails, 'off' ); + update_option( 'auto_plugin_theme_update_emails', $past_failure_emails ); return $results; } diff --git a/src/wp-admin/includes/class-theme-upgrader.php b/src/wp-admin/includes/class-theme-upgrader.php index d8098f028b331..869bf64220fdf 100644 --- a/src/wp-admin/includes/class-theme-upgrader.php +++ b/src/wp-admin/includes/class-theme-upgrader.php @@ -359,7 +359,7 @@ public function upgrade( $theme, $args = array() ) { if ( isset( $past_failure_emails[ $theme ] ) ) { unset( $past_failure_emails[ $theme ] ); - update_option( 'auto_plugin_theme_update_emails', $past_failure_emails, 'off' ); + update_option( 'auto_plugin_theme_update_emails', $past_failure_emails ); } return true; @@ -545,7 +545,7 @@ public function bulk_upgrade( $themes, $args = array() ) { unset( $past_failure_emails[ $theme ] ); } - update_option( 'auto_plugin_theme_update_emails', $past_failure_emails, 'off' ); + update_option( 'auto_plugin_theme_update_emails', $past_failure_emails ); return $results; } diff --git a/src/wp-admin/includes/class-wp-automatic-updater.php b/src/wp-admin/includes/class-wp-automatic-updater.php index d34a0a6fec1f1..bb8cb402aff54 100644 --- a/src/wp-admin/includes/class-wp-automatic-updater.php +++ b/src/wp-admin/includes/class-wp-automatic-updater.php @@ -1359,7 +1359,7 @@ protected function send_plugin_theme_email( $type, $successful_updates, $failed_ $result = wp_mail( $email['to'], wp_specialchars_decode( $email['subject'] ), $email['body'], $email['headers'] ); if ( $result ) { - update_option( 'auto_plugin_theme_update_emails', $past_failure_emails, 'off' ); + update_option( 'auto_plugin_theme_update_emails', $past_failure_emails ); } } diff --git a/src/wp-admin/includes/class-wp-plugins-list-table.php b/src/wp-admin/includes/class-wp-plugins-list-table.php index 0065dba904834..4cc0132b6fa7d 100644 --- a/src/wp-admin/includes/class-wp-plugins-list-table.php +++ b/src/wp-admin/includes/class-wp-plugins-list-table.php @@ -193,7 +193,7 @@ public function prepare_items() { if ( $screen->in_admin( 'network' ) ) { update_site_option( 'recently_activated', $recently_activated ); } else { - update_option( 'recently_activated', $recently_activated, 'off' ); + update_option( 'recently_activated', $recently_activated ); } $plugin_info = get_site_transient( 'update_plugins' ); diff --git a/src/wp-admin/includes/class-wp-privacy-policy-content.php b/src/wp-admin/includes/class-wp-privacy-policy-content.php index d721a4f99d5d7..e0775f7bea7b4 100644 --- a/src/wp-admin/includes/class-wp-privacy-policy-content.php +++ b/src/wp-admin/includes/class-wp-privacy-policy-content.php @@ -120,7 +120,7 @@ public static function text_change_check() { // Cache the result for use before `admin_init` (see above). if ( $cached !== $state ) { - update_option( '_wp_suggested_policy_text_has_changed', $state, 'off' ); + update_option( '_wp_suggested_policy_text_has_changed', $state ); } return 'changed' === $state; diff --git a/src/wp-admin/includes/class-wp-upgrader.php b/src/wp-admin/includes/class-wp-upgrader.php index 49699c5ea770d..2cbc6bcb033eb 100644 --- a/src/wp-admin/includes/class-wp-upgrader.php +++ b/src/wp-admin/includes/class-wp-upgrader.php @@ -1038,7 +1038,7 @@ public static function create_lock( $lock_name, $release_timeout = null ) { } // Update the lock, as by this point we've definitely got a lock, just need to fire the actions. - update_option( $lock_option, time(), 'off' ); + update_option( $lock_option, time() ); return true; } diff --git a/src/wp-admin/includes/dashboard.php b/src/wp-admin/includes/dashboard.php index d844536fde7d1..2aeaa24e461b4 100644 --- a/src/wp-admin/includes/dashboard.php +++ b/src/wp-admin/includes/dashboard.php @@ -1287,7 +1287,7 @@ function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) { } } - update_option( 'dashboard_widget_options', $widget_options, 'off' ); + update_option( 'dashboard_widget_options', $widget_options ); $locale = get_user_locale(); $cache_key = 'dash_v2_' . md5( $widget_id . '_' . $locale ); diff --git a/src/wp-admin/includes/file.php b/src/wp-admin/includes/file.php index 1ba777239db4f..75c741541ae4c 100644 --- a/src/wp-admin/includes/file.php +++ b/src/wp-admin/includes/file.php @@ -2496,7 +2496,7 @@ function request_filesystem_credentials( $form_post, $type = '', $error = false, ); if ( ! wp_installing() ) { - update_option( 'ftp_credentials', $stored_credentials, 'off' ); + update_option( 'ftp_credentials', $stored_credentials ); } return $credentials; diff --git a/src/wp-admin/includes/misc.php b/src/wp-admin/includes/misc.php index 8c4eee1f60c93..7794183d6ed58 100644 --- a/src/wp-admin/includes/misc.php +++ b/src/wp-admin/includes/misc.php @@ -352,7 +352,7 @@ function update_recently_edited( $file ) { $oldfiles[] = $file; } - update_option( 'recently_edited', $oldfiles, 'off' ); + update_option( 'recently_edited', $oldfiles ); } /** diff --git a/src/wp-admin/includes/nav-menu.php b/src/wp-admin/includes/nav-menu.php index a168d98e94a47..8f18057c238f5 100644 --- a/src/wp-admin/includes/nav-menu.php +++ b/src/wp-admin/includes/nav-menu.php @@ -1484,7 +1484,7 @@ function wp_nav_menu_update_menu_items( $nav_menu_selected_id, $nav_menu_selecte wp_get_nav_menus( array( 'fields' => 'ids' ) ) ); - update_option( 'nav_menu_options', $nav_menu_option, 'off' ); + update_option( 'nav_menu_options', $nav_menu_option ); wp_defer_term_counting( false ); diff --git a/src/wp-admin/includes/plugin.php b/src/wp-admin/includes/plugin.php index ec23cfd8e757d..bcae2733670d2 100644 --- a/src/wp-admin/includes/plugin.php +++ b/src/wp-admin/includes/plugin.php @@ -713,7 +713,7 @@ function activate_plugin( $plugin, $redirect = '', $network_wide = false, $silen $current = get_option( 'active_plugins', array() ); $current[] = $plugin; sort( $current ); - update_option( 'active_plugins', $current, 'off' ); + update_option( 'active_plugins', $current ); } if ( ! $silent ) { @@ -844,7 +844,7 @@ function deactivate_plugins( $plugins, $silent = false, $network_wide = null ) { } if ( $do_blog ) { - update_option( 'active_plugins', $current, 'off' ); + update_option( 'active_plugins', $current ); } if ( $do_network ) { update_site_option( 'active_sitewide_plugins', $network_current ); @@ -1072,7 +1072,7 @@ function validate_active_plugins() { $plugins = get_option( 'active_plugins', array() ); // Validate vartype: array. if ( ! is_array( $plugins ) ) { - update_option( 'active_plugins', array(), 'off' ); + update_option( 'active_plugins', array() ); $plugins = array(); } @@ -1306,7 +1306,7 @@ function uninstall_plugin( $plugin ) { if ( file_exists( WP_PLUGIN_DIR . '/' . dirname( $file ) . '/uninstall.php' ) ) { if ( isset( $uninstallable_plugins[ $file ] ) ) { unset( $uninstallable_plugins[ $file ] ); - update_option( 'uninstall_plugins', $uninstallable_plugins, 'off' ); + update_option( 'uninstall_plugins', $uninstallable_plugins ); } unset( $uninstallable_plugins ); @@ -1321,7 +1321,7 @@ function uninstall_plugin( $plugin ) { if ( isset( $uninstallable_plugins[ $file ] ) ) { $callable = $uninstallable_plugins[ $file ]; unset( $uninstallable_plugins[ $file ] ); - update_option( 'uninstall_plugins', $uninstallable_plugins, 'off' ); + update_option( 'uninstall_plugins', $uninstallable_plugins ); unset( $uninstallable_plugins ); wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $file ); @@ -2612,7 +2612,7 @@ function deactivated_plugins_notice() { if ( false === $blog_deactivated_plugins ) { // Option not in database, add an empty array to avoid extra DB queries on subsequent loads. - update_option( 'wp_force_deactivated_plugins', array(), 'off' ); + update_option( 'wp_force_deactivated_plugins', array() ); } if ( is_multisite() ) { @@ -2666,7 +2666,7 @@ function deactivated_plugins_notice() { } // Empty the options. - update_option( 'wp_force_deactivated_plugins', array(), 'off' ); + update_option( 'wp_force_deactivated_plugins', array() ); if ( is_multisite() ) { update_site_option( 'wp_force_deactivated_plugins', array() ); } diff --git a/src/wp-admin/includes/schema.php b/src/wp-admin/includes/schema.php index 7c0684018b7bc..cd06364caf269 100644 --- a/src/wp-admin/includes/schema.php +++ b/src/wp-admin/includes/schema.php @@ -614,7 +614,7 @@ function populate_options( array $options = array() ) { // In case it is set, but blank, update "home". if ( ! __get_option( 'home' ) ) { - update_option( 'home', $guessurl, 'on' ); + update_option( 'home', $guessurl ); } // Delete unused options. diff --git a/src/wp-admin/includes/update-core.php b/src/wp-admin/includes/update-core.php index e7199ff4608b2..fd0032601fc1c 100644 --- a/src/wp-admin/includes/update-core.php +++ b/src/wp-admin/includes/update-core.php @@ -1758,7 +1758,7 @@ function _upgrade_core_deactivate_incompatible_plugins() { } else { $deactivated_plugins = get_option( 'wp_force_deactivated_plugins', array() ); $deactivated_plugins = array_merge( $deactivated_plugins, $deactivated_gutenberg ); - update_option( 'wp_force_deactivated_plugins', $deactivated_plugins, 'off' ); + update_option( 'wp_force_deactivated_plugins', $deactivated_plugins ); } deactivate_plugins( array( 'gutenberg/gutenberg.php' ), true ); } diff --git a/src/wp-admin/includes/upgrade.php b/src/wp-admin/includes/upgrade.php index 68286e406653d..8e89f936aa9db 100644 --- a/src/wp-admin/includes/upgrade.php +++ b/src/wp-admin/includes/upgrade.php @@ -55,24 +55,24 @@ function wp_install( $blog_title, $user_name, $user_email, $is_public, $deprecat populate_options(); populate_roles(); - update_option( 'blogname', $blog_title, 'on' ); - update_option( 'admin_email', $user_email, 'off' ); - update_option( 'blog_public', $is_public, 'on' ); + update_option( 'blogname', $blog_title ); + update_option( 'admin_email', $user_email ); + update_option( 'blog_public', $is_public ); // Freshness of site - in the future, this could get more specific about actions taken, perhaps. - update_option( 'fresh_site', 1, 'off' ); + update_option( 'fresh_site', 1 ); if ( $language ) { - update_option( 'WPLANG', $language, 'on' ); + update_option( 'WPLANG', $language ); } $guessurl = wp_guess_url(); - update_option( 'siteurl', $guessurl, 'on' ); + update_option( 'siteurl', $guessurl ); // If not a public site, don't ping. if ( ! $is_public ) { - update_option( 'default_pingback_flag', 0, 'on' ); + update_option( 'default_pingback_flag', 0 ); } /* @@ -390,7 +390,7 @@ function wp_install_defaults( $user_id ) { 'meta_value' => 'default', ) ); - update_option( 'wp_page_for_privacy_policy', 3, 'on' ); + update_option( 'wp_page_for_privacy_policy', 3 ); } // Set up default widgets for default theme. @@ -403,8 +403,7 @@ function wp_install_defaults( $user_id ) { 5 => array( 'content' => '

' . __( 'Archives' ) . '

' ), 6 => array( 'content' => '

' . __( 'Categories' ) . '

' ), '_multiwidget' => 1, - ), - 'on' + ) ); update_option( 'sidebars_widgets', @@ -420,8 +419,7 @@ function wp_install_defaults( $user_id ) { 1 => 'block-6', ), 'array_version' => 3, - ), - 'on' + ) ); if ( ! is_multisite() ) { @@ -853,8 +851,8 @@ function upgrade_all() { maybe_disable_automattic_widgets(); - update_option( 'db_version', $wp_db_version, 'on' ); - update_option( 'db_upgraded', true, 'on' ); + update_option( 'db_version', $wp_db_version ); + update_option( 'db_upgraded', true ); } /** @@ -1066,7 +1064,7 @@ function upgrade_130() { */ if ( ! is_array( $active_plugins ) ) { $active_plugins = explode( "\n", trim( $active_plugins ) ); - update_option( 'active_plugins', $active_plugins, 'off' ); + update_option( 'active_plugins', $active_plugins ); } // Obsolete tables. @@ -1455,7 +1453,7 @@ function upgrade_230() { } // Set default to the last category we grabbed during the upgrade loop. - update_option( 'default_link_category', $default_link_cat, 'off' ); + update_option( 'default_link_category', $default_link_cat ); } else { $links = $wpdb->get_results( "SELECT link_id, category_id FROM $wpdb->link2cat GROUP BY link_id, category_id" ); foreach ( $links as $link ) { @@ -1632,7 +1630,7 @@ function upgrade_280() { $value = stripslashes( $value ); } if ( $value !== $row->option_value ) { - update_option( $row->option_name, $value, 'on' ); + update_option( $row->option_name, $value ); } } $start += 20; @@ -1658,8 +1656,8 @@ function upgrade_290() { * but now 2 is the minimum depth to avoid confusion. */ if ( get_option( 'thread_comments_depth' ) == '1' ) { - update_option( 'thread_comments_depth', 2, 'on' ); - update_option( 'thread_comments', 0, 'on' ); + update_option( 'thread_comments_depth', 2 ); + update_option( 'thread_comments', 0 ); } } } @@ -1794,7 +1792,7 @@ function upgrade_330() { case 2: $sidebars_widgets = retrieve_widgets(); $sidebars_widgets['array_version'] = 3; - update_option( 'sidebars_widgets', $sidebars_widgets, 'on' ); + update_option( 'sidebars_widgets', $sidebars_widgets ); } } @@ -1848,7 +1846,7 @@ function upgrade_350() { global $wp_current_db_version, $wpdb; if ( $wp_current_db_version < 22006 && $wpdb->get_var( "SELECT link_id FROM $wpdb->links LIMIT 1" ) ) { - update_option( 'link_manager_enabled', 1, 'on' ); // Previously set to 0 by populate_options(). + update_option( 'link_manager_enabled', 1 ); // Previously set to 0 by populate_options(). } if ( $wp_current_db_version < 21811 && wp_should_upgrade_global_tables() ) { @@ -1934,9 +1932,9 @@ function upgrade_400() { if ( $wp_current_db_version < 29630 ) { if ( ! is_multisite() && false === get_option( 'WPLANG' ) ) { if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && in_array( WPLANG, get_available_languages(), true ) ) { - update_option( 'WPLANG', WPLANG, 'on' ); + update_option( 'WPLANG', WPLANG ); } else { - update_option( 'WPLANG', '', 'on' ); + update_option( 'WPLANG', '' ); } } } @@ -1968,7 +1966,7 @@ function upgrade_430() { // Shared terms are split in a separate process. if ( $wp_current_db_version < 32814 ) { - update_option( 'finished_splitting_shared_terms', 0, 'off' ); + update_option( 'finished_splitting_shared_terms', 0 ); wp_schedule_single_event( time() + ( 1 * MINUTE_IN_SECONDS ), 'wp_split_shared_term_batch' ); } @@ -2130,7 +2128,7 @@ function upgrade_460() { } } - update_option( 'uninstall_plugins', $uninstall_plugins, 'off' ); + update_option( 'uninstall_plugins', $uninstall_plugins ); } } } @@ -2170,7 +2168,7 @@ function upgrade_530() { * is shown next time an admin logs in. */ if ( function_exists( 'current_user_can' ) && ! current_user_can( 'manage_options' ) ) { - update_option( 'admin_email_lifespan', 0, 'off' ); + update_option( 'admin_email_lifespan', 0 ); } } @@ -2187,7 +2185,7 @@ function upgrade_550() { if ( $wp_current_db_version < 48121 ) { $comment_previously_approved = get_option( 'comment_whitelist', '' ); - update_option( 'comment_previously_approved', $comment_previously_approved, 'on' ); + update_option( 'comment_previously_approved', $comment_previously_approved ); delete_option( 'comment_whitelist' ); } @@ -2203,13 +2201,13 @@ function upgrade_550() { $disallowed_list = get_option( 'blocklist_keys' ); } - update_option( 'disallowed_keys', $disallowed_list, 'on' ); + update_option( 'disallowed_keys', $disallowed_list ); delete_option( 'blacklist_keys' ); delete_option( 'blocklist_keys' ); } if ( $wp_current_db_version < 48748 ) { - update_option( 'finished_updating_comment_type', 0, 'off' ); + update_option( 'finished_updating_comment_type', 0 ); wp_schedule_single_event( time() + ( 1 * MINUTE_IN_SECONDS ), 'wp_update_comment_type_batch' ); } } @@ -2241,7 +2239,7 @@ function upgrade_560() { * This overrides the same option from populate_options() that is intended for new installs. * See https://core.trac.wordpress.org/ticket/51742. */ - update_option( 'auto_update_core_major', 'unset', 'off' ); + update_option( 'auto_update_core_major', 'unset' ); } if ( $wp_current_db_version < 49632 ) { @@ -2345,7 +2343,7 @@ function upgrade_640() { if ( $wp_current_db_version < 56657 ) { // Enable attachment pages. - update_option( 'wp_attachment_pages_enabled', 1, 'off' ); + update_option( 'wp_attachment_pages_enabled', 1 ); // Remove the wp_https_detection cron. Https status is checked directly in an async Site Health check. $scheduled = wp_get_scheduled_event( 'wp_https_detection' ); @@ -3507,8 +3505,8 @@ function make_site_theme() { // Make the new site theme active. $current_template = __get_option( 'template' ); if ( WP_DEFAULT_THEME == $current_template ) { - update_option( 'template', $template, 'on' ); - update_option( 'stylesheet', $template, 'on' ); + update_option( 'template', $template ); + update_option( 'stylesheet', $template ); } return $template; } diff --git a/src/wp-admin/ms-delete-site.php b/src/wp-admin/ms-delete-site.php index f164f83eced7b..be66975f567f0 100644 --- a/src/wp-admin/ms-delete-site.php +++ b/src/wp-admin/ms-delete-site.php @@ -48,7 +48,7 @@ check_admin_referer( 'delete-blog' ); $hash = wp_generate_password( 20, false ); - update_option( 'delete_blog_hash', $hash, 'off' ); + update_option( 'delete_blog_hash', $hash ); $url_delete = esc_url( admin_url( 'ms-delete-site.php?h=' . $hash ) ); diff --git a/src/wp-admin/network/site-info.php b/src/wp-admin/network/site-info.php index 50c88762b8cc7..defcc26e44060 100644 --- a/src/wp-admin/network/site-info.php +++ b/src/wp-admin/network/site-info.php @@ -91,7 +91,7 @@ if ( $old_home_parsed['host'] === $existing_details->domain && $old_home_parsed['path'] === $existing_details->path ) { $new_home_url = untrailingslashit( sanitize_url( $blog_data['scheme'] . '://' . $new_details->domain . $new_details->path ) ); - update_option( 'home', $new_home_url, 'on' ); + update_option( 'home', $new_home_url ); } $old_site_url = trailingslashit( esc_url( get_option( 'siteurl' ) ) ); @@ -99,7 +99,7 @@ if ( $old_site_parsed['host'] === $existing_details->domain && $old_site_parsed['path'] === $existing_details->path ) { $new_site_url = untrailingslashit( sanitize_url( $blog_data['scheme'] . '://' . $new_details->domain . $new_details->path ) ); - update_option( 'siteurl', $new_site_url, 'on' ); + update_option( 'siteurl', $new_site_url ); } restore_current_blog(); diff --git a/src/wp-admin/network/site-settings.php b/src/wp-admin/network/site-settings.php index 0ff7e89397ff4..adfc95cfa9d70 100644 --- a/src/wp-admin/network/site-settings.php +++ b/src/wp-admin/network/site-settings.php @@ -46,7 +46,7 @@ if ( 0 === $key || is_array( $val ) || in_array( $key, $skip_options, true ) ) { continue; // Avoids "0 is a protected WP option and may not be modified" error when editing blog options. } - update_option( $key, $val, 'on' ); + update_option( $key, $val ); } /** diff --git a/src/wp-admin/network/site-themes.php b/src/wp-admin/network/site-themes.php index f44b3fa5877f8..79fe4d5f0576b 100644 --- a/src/wp-admin/network/site-themes.php +++ b/src/wp-admin/network/site-themes.php @@ -143,7 +143,7 @@ } } - update_option( 'allowedthemes', $allowed_themes, 'off' ); + update_option( 'allowedthemes', $allowed_themes ); restore_current_blog(); wp_safe_redirect( diff --git a/src/wp-admin/options-reading.php b/src/wp-admin/options-reading.php index e2df7dff20d34..5dd40f37c4e32 100644 --- a/src/wp-admin/options-reading.php +++ b/src/wp-admin/options-reading.php @@ -74,12 +74,12 @@
diff --git a/src/wp-admin/options.php b/src/wp-admin/options.php index bac9bb6860edf..33779a7492515 100644 --- a/src/wp-admin/options.php +++ b/src/wp-admin/options.php @@ -62,7 +62,7 @@ && hash_equals( $new_admin_details['hash'], $_GET['adminhash'] ) && ! empty( $new_admin_details['newemail'] ) ) { - update_option( 'admin_email', $new_admin_details['newemail'], 'off' ); + update_option( 'admin_email', $new_admin_details['newemail'] ); delete_option( 'adminhash' ); delete_option( 'new_admin_email' ); $redirect = 'options-general.php?updated=true'; @@ -337,7 +337,7 @@ } $value = wp_unslash( $value ); } - update_option( $option, $value, 'on' ); + update_option( $option, $value ); } /* diff --git a/src/wp-admin/plugins.php b/src/wp-admin/plugins.php index 1e8ace6c9b72f..e8f1074a71b2b 100644 --- a/src/wp-admin/plugins.php +++ b/src/wp-admin/plugins.php @@ -71,11 +71,11 @@ if ( ! is_network_admin() ) { $recent = (array) get_option( 'recently_activated' ); unset( $recent[ $plugin ] ); - update_option( 'recently_activated', $recent, 'off' ); + update_option( 'recently_activated', $recent ); } else { $recent = (array) get_site_option( 'recently_activated' ); unset( $recent[ $plugin ] ); - update_site_option( 'recently_activated', $recent, 'off' ); + update_site_option( 'recently_activated', $recent ); } if ( isset( $_GET['from'] ) && 'import' === $_GET['from'] ) { @@ -211,7 +211,7 @@ deactivate_plugins( $plugin, false, is_network_admin() ); if ( ! is_network_admin() ) { - update_option( 'recently_activated', array( $plugin => time() ) + (array) get_option( 'recently_activated' ), 'off' ); + update_option( 'recently_activated', array( $plugin => time() ) + (array) get_option( 'recently_activated' ) ); } else { update_site_option( 'recently_activated', array( $plugin => time() ) + (array) get_site_option( 'recently_activated' ) ); } @@ -258,7 +258,7 @@ } if ( ! is_network_admin() ) { - update_option( 'recently_activated', $deactivated + (array) get_option( 'recently_activated' ), 'off' ); + update_option( 'recently_activated', $deactivated + (array) get_option( 'recently_activated' ) ); } else { update_site_option( 'recently_activated', $deactivated + (array) get_site_option( 'recently_activated' ) ); } @@ -431,12 +431,12 @@ // Store the result in an option rather than a URL param due to object type & length. // Cannot use transient/cache, as that could get flushed if any plugin flushes data on uninstall/delete. - update_option( 'plugins_delete_result_' . $user_ID, $delete_result, 'off' ); + update_option( 'plugins_delete_result_' . $user_ID, $delete_result, false ); wp_redirect( self_admin_url( "plugins.php?deleted=$plugins_to_delete&plugin_status=$status&paged=$page&s=$s" ) ); exit; case 'clear-recent-list': if ( ! is_network_admin() ) { - update_option( 'recently_activated', array(), 'off' ); + update_option( 'recently_activated', array() ); } else { update_site_option( 'recently_activated', array() ); } diff --git a/src/wp-admin/widgets-form.php b/src/wp-admin/widgets-form.php index 5b40a6daf6574..461f8d6fb4089 100644 --- a/src/wp-admin/widgets-form.php +++ b/src/wp-admin/widgets-form.php @@ -211,7 +211,7 @@ $id_base = implode( '-', $pieces ); $widget = get_option( 'widget_' . $id_base ); unset( $widget[ $multi_number ] ); - update_option( 'widget_' . $id_base, $widget, 'off' ); + update_option( 'widget_' . $id_base, $widget ); unset( $sidebars_widgets['wp_inactive_widgets'][ $key ] ); } diff --git a/src/wp-content/themes/twentyfourteen/inc/featured-content.php b/src/wp-content/themes/twentyfourteen/inc/featured-content.php index beebbc0c5d67b..8b36b12c31519 100644 --- a/src/wp-content/themes/twentyfourteen/inc/featured-content.php +++ b/src/wp-content/themes/twentyfourteen/inc/featured-content.php @@ -268,7 +268,7 @@ public static function delete_post_tag( $tag_id ) { $settings['tag-id'] = 0; $settings = self::validate_settings( $settings ); - update_option( 'featured-content', $settings, 'on' ); + update_option( 'featured-content', $settings ); } /** diff --git a/src/wp-includes/class-wp-paused-extensions-storage.php b/src/wp-includes/class-wp-paused-extensions-storage.php index fa3f7ce5c553b..a1b2b6d5ae85d 100644 --- a/src/wp-includes/class-wp-paused-extensions-storage.php +++ b/src/wp-includes/class-wp-paused-extensions-storage.php @@ -72,7 +72,7 @@ public function set( $extension, $error ) { $paused_extensions[ $this->type ][ $extension ] = $error; - return update_option( $option_name, $paused_extensions, 'off' ); + return update_option( $option_name, $paused_extensions ); } /** @@ -112,7 +112,7 @@ public function delete( $extension ) { return delete_option( $option_name ); } - return update_option( $option_name, $paused_extensions, 'off' ); + return update_option( $option_name, $paused_extensions ); } /** @@ -190,7 +190,7 @@ public function delete_all() { return delete_option( $option_name ); } - return update_option( $option_name, $paused_extensions, 'off' ); + return update_option( $option_name, $paused_extensions ); } /** diff --git a/src/wp-includes/class-wp-recovery-mode-key-service.php b/src/wp-includes/class-wp-recovery-mode-key-service.php index 9db8ecc55b5de..c9a6a24368391 100644 --- a/src/wp-includes/class-wp-recovery-mode-key-service.php +++ b/src/wp-includes/class-wp-recovery-mode-key-service.php @@ -187,6 +187,6 @@ private function get_keys() { * @return bool True on success, false on failure. */ private function update_keys( array $keys ) { - return update_option( $this->option_name, $keys, 'off' ); + return update_option( $this->option_name, $keys ); } } diff --git a/src/wp-includes/class-wp-theme.php b/src/wp-includes/class-wp-theme.php index 697ca2865e350..6db75e4058eef 100644 --- a/src/wp-includes/class-wp-theme.php +++ b/src/wp-includes/class-wp-theme.php @@ -1757,11 +1757,11 @@ public static function get_allowed_on_site( $blog_id = null ) { // Set the option so we never have to go through this pain again. if ( is_admin() && $allowed_themes[ $blog_id ] ) { if ( $current ) { - update_option( 'allowedthemes', $allowed_themes[ $blog_id ], 'off' ); + update_option( 'allowedthemes', $allowed_themes[ $blog_id ] ); delete_option( 'allowed_themes' ); } else { switch_to_blog( $blog_id ); - update_option( 'allowedthemes', $allowed_themes[ $blog_id ], 'off' ); + update_option( 'allowedthemes', $allowed_themes[ $blog_id ] ); delete_option( 'allowed_themes' ); restore_current_blog(); } diff --git a/src/wp-includes/class-wp-widget.php b/src/wp-includes/class-wp-widget.php index 837444d21d354..f7557a0e3bb44 100644 --- a/src/wp-includes/class-wp-widget.php +++ b/src/wp-includes/class-wp-widget.php @@ -598,7 +598,7 @@ public function _register_one( $number = -1 ) { */ public function save_settings( $settings ) { $settings['_multiwidget'] = 1; - update_option( $this->option_name, $settings, 'on' ); + update_option( $this->option_name, $settings ); } /** diff --git a/src/wp-includes/class-wp-xmlrpc-server.php b/src/wp-includes/class-wp-xmlrpc-server.php index d3d661c3bf560..2141f21e59662 100644 --- a/src/wp-includes/class-wp-xmlrpc-server.php +++ b/src/wp-includes/class-wp-xmlrpc-server.php @@ -4330,7 +4330,7 @@ public function wp_setOptions( $args ) { continue; } - update_option( $this->blog_options[ $o_name ]['option'], wp_unslash( $o_value ), 'on' ); + update_option( $this->blog_options[ $o_name ]['option'], wp_unslash( $o_value ) ); } // Now return the updated values. diff --git a/src/wp-includes/cron.php b/src/wp-includes/cron.php index 702e59ce41ce3..aadc22b7eb17d 100644 --- a/src/wp-includes/cron.php +++ b/src/wp-includes/cron.php @@ -1239,7 +1239,7 @@ function _set_cron_array( $cron, $wp_error = false ) { $cron['version'] = 2; - $result = update_option( 'cron', $cron, 'on' ); + $result = update_option( 'cron', $cron ); if ( $wp_error && ! $result ) { return new WP_Error( @@ -1279,7 +1279,7 @@ function _upgrade_cron_array( $cron ) { $new_cron['version'] = 2; - update_option( 'cron', $new_cron, 'on' ); + update_option( 'cron', $new_cron ); return $new_cron; } diff --git a/src/wp-includes/deprecated.php b/src/wp-includes/deprecated.php index 5f504fa6b6d2c..155ce0fef0aed 100644 --- a/src/wp-includes/deprecated.php +++ b/src/wp-includes/deprecated.php @@ -6002,7 +6002,7 @@ function wp_update_https_detection_errors() { */ $support_errors = apply_filters( 'pre_wp_update_https_detection_errors', null ); if ( is_wp_error( $support_errors ) ) { - update_option( 'https_detection_errors', $support_errors->errors, 'off' ); + update_option( 'https_detection_errors', $support_errors->errors ); return; } diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index 059c9811ea025..d7cc00672bce3 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -4690,7 +4690,7 @@ function _config_wp_siteurl( $url = '' ) { * @access private */ function _delete_option_fresh_site() { - update_option( 'fresh_site', '0', 'off' ); + update_option( 'fresh_site', '0' ); } /** diff --git a/src/wp-includes/ms-deprecated.php b/src/wp-includes/ms-deprecated.php index 8e976628d0bd3..5a6b4415edf74 100644 --- a/src/wp-includes/ms-deprecated.php +++ b/src/wp-includes/ms-deprecated.php @@ -642,17 +642,17 @@ function install_blog( $blog_id, $blog_title = '' ) { } } - update_option( 'siteurl', $siteurl, 'on' ); - update_option( 'home', $home, 'on' ); + update_option( 'siteurl', $siteurl ); + update_option( 'home', $home ); if ( get_site_option( 'ms_files_rewriting' ) ) { - update_option( 'upload_path', UPLOADBLOGSDIR . "/$blog_id/files", 'off' ); + update_option( 'upload_path', UPLOADBLOGSDIR . "/$blog_id/files" ); } else { - update_option( 'upload_path', get_blog_option( get_network()->site_id, 'upload_path' ), 'off' ); + update_option( 'upload_path', get_blog_option( get_network()->site_id, 'upload_path' ) ); } - update_option( 'blogname', wp_unslash( $blog_title ), 'on' ); - update_option( 'admin_email', '', 'off' ); + update_option( 'blogname', wp_unslash( $blog_title ) ); + update_option( 'admin_email', '' ); // Remove all permissions. $table_prefix = $wpdb->get_blog_prefix(); diff --git a/src/wp-includes/plugin.php b/src/wp-includes/plugin.php index b2c88181112b1..77c1eb4ef669b 100644 --- a/src/wp-includes/plugin.php +++ b/src/wp-includes/plugin.php @@ -936,7 +936,7 @@ function register_uninstall_hook( $file, $callback ) { if ( ! isset( $uninstallable_plugins[ $plugin_basename ] ) || $uninstallable_plugins[ $plugin_basename ] !== $callback ) { $uninstallable_plugins[ $plugin_basename ] = $callback; - update_option( 'uninstall_plugins', $uninstallable_plugins, 'off' ); + update_option( 'uninstall_plugins', $uninstallable_plugins ); } } diff --git a/src/wp-includes/widgets.php b/src/wp-includes/widgets.php index 3b36c3e2214c6..ff48419f1ae39 100644 --- a/src/wp-includes/widgets.php +++ b/src/wp-includes/widgets.php @@ -1091,7 +1091,7 @@ function wp_set_sidebars_widgets( $sidebars_widgets ) { $sidebars_widgets['array_version'] = 3; } - update_option( 'sidebars_widgets', $sidebars_widgets, 'on' ); + update_option( 'sidebars_widgets', $sidebars_widgets ); } /** diff --git a/src/wp-login.php b/src/wp-login.php index 67e8fe6076bfc..bd4568a4690b5 100644 --- a/src/wp-login.php +++ b/src/wp-login.php @@ -511,7 +511,7 @@ function wp_login_viewport_meta() { $url = dirname( set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] ) ); if ( get_option( 'siteurl' ) !== $url ) { - update_option( 'siteurl', $url, 'on' ); + update_option( 'siteurl', $url ); } }