Upload: Move an assignment in `wp-admin/upload.php` into a conditional branch.

This is a micro-optimization to reduce unnecessary memory allocation.

Follow-up to [28682].

Props mujuonly, swissspidy, mukesh27.
Fixes #60683.
Built from https://develop.svn.wordpress.org/trunk@57796


git-svn-id: http://core.svn.wordpress.org/trunk@57297 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2024-03-09 18:07:15 +00:00
parent 1c0a2b300c
commit b47a138372
2 changed files with 3 additions and 2 deletions

View File

@ -128,12 +128,13 @@ if ( ! empty( $_GET['message'] ) && isset( $messages[ $_GET['message'] ] ) ) {
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'message' ), $_SERVER['REQUEST_URI'] ); $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'message' ), $_SERVER['REQUEST_URI'] );
} }
$mode = get_user_option( 'media_library_mode', get_current_user_id() ) ? get_user_option( 'media_library_mode', get_current_user_id() ) : 'grid';
$modes = array( 'grid', 'list' ); $modes = array( 'grid', 'list' );
if ( isset( $_GET['mode'] ) && in_array( $_GET['mode'], $modes, true ) ) { if ( isset( $_GET['mode'] ) && in_array( $_GET['mode'], $modes, true ) ) {
$mode = $_GET['mode']; $mode = $_GET['mode'];
update_user_option( get_current_user_id(), 'media_library_mode', $mode ); update_user_option( get_current_user_id(), 'media_library_mode', $mode );
} else {
$mode = get_user_option( 'media_library_mode', get_current_user_id() ) ? get_user_option( 'media_library_mode', get_current_user_id() ) : 'grid';
} }
if ( 'grid' === $mode ) { if ( 'grid' === $mode ) {

View File

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