mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-03 20:24:26 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@47198 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -139,7 +139,7 @@ function wp_check_php_mysql_versions() {
|
||||
}
|
||||
|
||||
if ( ! extension_loaded( 'mysql' ) && ! extension_loaded( 'mysqli' ) && ! extension_loaded( 'mysqlnd' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) {
|
||||
require_once( ABSPATH . WPINC . '/functions.php' );
|
||||
require_once ABSPATH . WPINC . '/functions.php';
|
||||
wp_load_translations_early();
|
||||
$args = array(
|
||||
'exit' => false,
|
||||
@@ -192,7 +192,7 @@ function wp_maintenance() {
|
||||
|
||||
global $upgrading;
|
||||
|
||||
include( ABSPATH . '.maintenance' );
|
||||
require ABSPATH . '.maintenance';
|
||||
// If the $upgrading timestamp is older than 10 minutes, don't die.
|
||||
if ( ( time() - $upgrading ) >= 600 ) {
|
||||
return;
|
||||
@@ -216,11 +216,11 @@ function wp_maintenance() {
|
||||
}
|
||||
|
||||
if ( file_exists( WP_CONTENT_DIR . '/maintenance.php' ) ) {
|
||||
require_once( WP_CONTENT_DIR . '/maintenance.php' );
|
||||
require_once WP_CONTENT_DIR . '/maintenance.php';
|
||||
die();
|
||||
}
|
||||
|
||||
require_once( ABSPATH . WPINC . '/functions.php' );
|
||||
require_once ABSPATH . WPINC . '/functions.php';
|
||||
wp_load_translations_early();
|
||||
|
||||
header( 'Retry-After: 600' );
|
||||
@@ -409,9 +409,9 @@ function wp_set_lang_dir() {
|
||||
function require_wp_db() {
|
||||
global $wpdb;
|
||||
|
||||
require_once( ABSPATH . WPINC . '/wp-db.php' );
|
||||
require_once ABSPATH . WPINC . '/wp-db.php';
|
||||
if ( file_exists( WP_CONTENT_DIR . '/db.php' ) ) {
|
||||
require_once( WP_CONTENT_DIR . '/db.php' );
|
||||
require_once WP_CONTENT_DIR . '/db.php';
|
||||
}
|
||||
|
||||
if ( isset( $wpdb ) ) {
|
||||
@@ -544,7 +544,7 @@ function wp_start_object_cache() {
|
||||
* that an external object cache is being used.
|
||||
*/
|
||||
if ( file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) {
|
||||
require_once( WP_CONTENT_DIR . '/object-cache.php' );
|
||||
require_once WP_CONTENT_DIR . '/object-cache.php';
|
||||
if ( function_exists( 'wp_cache_init' ) ) {
|
||||
wp_using_ext_object_cache( true );
|
||||
}
|
||||
@@ -566,7 +566,7 @@ function wp_start_object_cache() {
|
||||
}
|
||||
|
||||
if ( ! wp_using_ext_object_cache() ) {
|
||||
require_once( ABSPATH . WPINC . '/cache.php' );
|
||||
require_once ABSPATH . WPINC . '/cache.php';
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -606,8 +606,8 @@ function wp_not_installed() {
|
||||
} elseif ( ! is_blog_installed() && ! wp_installing() ) {
|
||||
nocache_headers();
|
||||
|
||||
require( ABSPATH . WPINC . '/kses.php' );
|
||||
require( ABSPATH . WPINC . '/pluggable.php' );
|
||||
require ABSPATH . WPINC . '/kses.php';
|
||||
require ABSPATH . WPINC . '/pluggable.php';
|
||||
|
||||
$link = wp_guess_url() . '/wp-admin/install.php';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user