[wp-trac] [WordPress Trac] #48082: Replace `dirname(__FILE__)` with `__DIR__` (Performance improvement, massive patch)
WordPress Trac
noreply at wordpress.org
Thu Feb 6 06:31:35 UTC 2020
#48082: Replace `dirname(__FILE__)` with `__DIR__` (Performance improvement,
massive patch)
------------------------------+--------------------------------------------
Reporter: ayeshrajans | Owner: SergeyBiryukov
Type: enhancement | Status: closed
Priority: normal | Milestone: 5.4
Component: General | Version:
Severity: minor | Resolution: fixed
Keywords: has-patch needs- | Focuses: performance, coding-standards
testing |
------------------------------+--------------------------------------------
Changes (by SergeyBiryukov):
* status: reviewing => closed
* resolution: => fixed
Comment:
In [changeset:"47198" 47198]:
{{{
#!CommitTicketReference repository="" revision="47198"
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.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/48082#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list