Replace array_shift() with reset() where appropriate for performance.

Props SergeyBiryukov.
Fixes #31259.


git-svn-id: https://develop.svn.wordpress.org/trunk@31829 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2015-03-19 03:55:39 +00:00
parent c74d9e6d1c
commit 2f20da29b5
12 changed files with 18 additions and 18 deletions
+2 -2
View File
@@ -804,11 +804,11 @@ function choose_primary_blog() {
</select>
<?php
if ( !$found ) {
$blog = array_shift( $all_blogs );
$blog = reset( $all_blogs );
update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id );
}
} elseif ( count( $all_blogs ) == 1 ) {
$blog = array_shift( $all_blogs );
$blog = reset( $all_blogs );
echo $blog->domain;
if ( $primary_blog != $blog->userblog_id ) // Set the primary blog again if it's out of sync with blog list.
update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id );