Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#31341 closed enhancement (wontfix)

Works faster about update_user_option()

Reported by: kmvan's profile kmvan Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.1
Component: Users Keywords:
Focuses: performance Cc:

Description

/wp-includes/user.php in line 406

global $wpdb;

May move to the line 409 below. Becomes:

function update_user_option( $user_id, $option_name, $newvalue, $global = false ) {

	if ( !$global ){
		global $wpdb;
		$option_name = $wpdb->get_blog_prefix() . $option_name;
	}

	return update_user_meta( $user_id, $option_name, $newvalue );
}

And delete_user_option() in line 432:

function delete_user_option( $user_id, $option_name, $global = false ) {

	if ( !$global ){
		global $wpdb;
		$option_name = $wpdb->get_blog_prefix() . $option_name;
	}
	return delete_user_meta( $user_id, $option_name );
}

Change History (2)

#1 @SergeyBiryukov
10 years ago

This would be inconsistent with other functions (we generally declare globals at the beginning).

Do you have any performance benchmarks for this change? Please see https://make.wordpress.org/core/2011/03/23/code-refactoring/.

#2 @SergeyBiryukov
10 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.