Coding Standards: Check for deprecated options before `wp_installing()`.

This is a micro-optimization that makes the conditional several times faster for non-deprecated options by avoiding an unnecessary function call.

Functions affected:
* `get_option()`
* `update_option()`
* `add_option()`

Follow-up to [48575].

See #55647.
Built from https://develop.svn.wordpress.org/trunk@53914


git-svn-id: http://core.svn.wordpress.org/trunk@53473 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2022-08-20 00:27:12 +00:00
parent 806336ce27
commit 6ceef39b2d
2 changed files with 4 additions and 4 deletions

View File

@ -95,7 +95,7 @@ function get_option( $option, $default = false ) {
'comment_whitelist' => 'comment_previously_approved', 'comment_whitelist' => 'comment_previously_approved',
); );
if ( ! wp_installing() && isset( $deprecated_keys[ $option ] ) ) { if ( isset( $deprecated_keys[ $option ] ) && ! wp_installing() ) {
_deprecated_argument( _deprecated_argument(
__FUNCTION__, __FUNCTION__,
'5.5.0', '5.5.0',
@ -401,7 +401,7 @@ function update_option( $option, $value, $autoload = null ) {
'comment_whitelist' => 'comment_previously_approved', 'comment_whitelist' => 'comment_previously_approved',
); );
if ( ! wp_installing() && isset( $deprecated_keys[ $option ] ) ) { if ( isset( $deprecated_keys[ $option ] ) && ! wp_installing() ) {
_deprecated_argument( _deprecated_argument(
__FUNCTION__, __FUNCTION__,
'5.5.0', '5.5.0',
@ -591,7 +591,7 @@ function add_option( $option, $value = '', $deprecated = '', $autoload = 'yes' )
'comment_whitelist' => 'comment_previously_approved', 'comment_whitelist' => 'comment_previously_approved',
); );
if ( ! wp_installing() && isset( $deprecated_keys[ $option ] ) ) { if ( isset( $deprecated_keys[ $option ] ) && ! wp_installing() ) {
_deprecated_argument( _deprecated_argument(
__FUNCTION__, __FUNCTION__,
'5.5.0', '5.5.0',

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.1-alpha-53913'; $wp_version = '6.1-alpha-53914';
/** /**
* 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.