WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/19/2015 03:55:39 AM (6 years ago)
Author:
wonderboymusic
Message:

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

Props SergeyBiryukov.
Fixes #31259.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/plugin-install.php

    r31363 r31829  
    305305            } else {
    306306                $key = array_keys( $installed_plugin );
    307                 $key = array_shift( $key ); //Use the first plugin regardless of the name, Could have issues for multiple-plugins in one directory if they share different version numbers
     307                $key = reset( $key ); //Use the first plugin regardless of the name, Could have issues for multiple-plugins in one directory if they share different version numbers
    308308                $update_file = $api->slug . '/' . $key;
    309309                if ( version_compare($api->version, $installed_plugin[ $key ]['Version'], '=') ){
     
    392392    if ( empty( $section ) || ! isset( $api->sections[ $section ] ) ) {
    393393        $section_titles = array_keys( (array) $api->sections );
    394         $section = array_shift( $section_titles );
     394        $section = reset( $section_titles );
    395395    }
    396396
Note: See TracChangeset for help on using the changeset viewer.