WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/06/2020 06:31:22 AM (15 months ago)
Author:
SergeyBiryukov
Message:

Code Modernization: Replace dirname( __FILE__ ) calls with __DIR__ magic constant.

This avoids the performance overhead of the function call every time dirname( __FILE__ ) was used instead of __DIR__.

This commit also includes:

  • Removing unnecessary parentheses from include/require statements. These are language constructs, not function calls.
  • Replacing include statements for several files with require_once, for consistency:
    • wp-admin/admin-header.php
    • wp-admin/admin-footer.php
    • wp-includes/version.php

Props ayeshrajans, desrosj, valentinbora, jrf, joostdevalk, netweb.
Fixes #48082.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-site-health-auto-updates.php

    r47122 r47198  
    1414     */
    1515    public function __construct() {
    16         include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
     16        require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
    1717    }
    1818
     
    167167    public function test_wp_automatic_updates_disabled() {
    168168        if ( ! class_exists( 'WP_Automatic_Updater' ) ) {
    169             require_once( ABSPATH . 'wp-admin/includes/class-wp-automatic-updates.php' );
     169            require_once ABSPATH . 'wp-admin/includes/class-wp-automatic-updates.php';
    170170        }
    171171
     
    337337        global $wp_filesystem;
    338338
    339         include ABSPATH . WPINC . '/version.php'; // $wp_version; // x.y.z
     339        require ABSPATH . WPINC . '/version.php'; // $wp_version; // x.y.z
    340340
    341341        $skin    = new Automatic_Upgrader_Skin;
     
    415415     */
    416416    function test_accepts_dev_updates() {
    417         include ABSPATH . WPINC . '/version.php'; // $wp_version; // x.y.z
     417        require ABSPATH . WPINC . '/version.php'; // $wp_version; // x.y.z
    418418        // Only for dev versions.
    419419        if ( false === strpos( $wp_version, '-' ) ) {
Note: See TracChangeset for help on using the changeset viewer.