From 75fe71a13f874cb7527a44a4a75c80e15317d30c Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 14 Apr 2016 17:52:02 +0000 Subject: [PATCH] Bootstrap/Load: Allow for `ABSPATH` to be defined outside of `wp-load.php`, e.g. in a script loaded via `auto_prepend_file`. Props barry. Fixes #26592. git-svn-id: https://develop.svn.wordpress.org/trunk@37207 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/load-scripts.php | 5 ++++- src/wp-admin/load-styles.php | 5 ++++- src/wp-admin/setup-config.php | 4 +++- src/wp-load.php | 4 +++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/wp-admin/load-scripts.php b/src/wp-admin/load-scripts.php index 011ae3c890..d536c1925a 100644 --- a/src/wp-admin/load-scripts.php +++ b/src/wp-admin/load-scripts.php @@ -8,7 +8,10 @@ error_reporting(0); /** Set ABSPATH for execution */ -define( 'ABSPATH', dirname(dirname(__FILE__)) . '/' ); +if ( ! defined( 'ABSPATH' ) ) { + define( 'ABSPATH', dirname( dirname( __FILE__ ) ) . '/' ); +} + define( 'WPINC', 'wp-includes' ); $load = $_GET['load']; diff --git a/src/wp-admin/load-styles.php b/src/wp-admin/load-styles.php index a461ae268d..de20881418 100644 --- a/src/wp-admin/load-styles.php +++ b/src/wp-admin/load-styles.php @@ -8,7 +8,10 @@ error_reporting(0); /** Set ABSPATH for execution */ -define( 'ABSPATH', dirname(dirname(__FILE__)) . '/' ); +if ( ! defined( 'ABSPATH' ) ) { + define( 'ABSPATH', dirname( dirname( __FILE__ ) ) . '/' ); +} + define( 'WPINC', 'wp-includes' ); require( ABSPATH . 'wp-admin/includes/noop.php' ); diff --git a/src/wp-admin/setup-config.php b/src/wp-admin/setup-config.php index befa6937ed..32c173df50 100644 --- a/src/wp-admin/setup-config.php +++ b/src/wp-admin/setup-config.php @@ -28,7 +28,9 @@ define('WP_SETUP_CONFIG', true); */ error_reporting(0); -define( 'ABSPATH', dirname( dirname( __FILE__ ) ) . '/' ); +if ( ! defined( 'ABSPATH' ) ) { + define( 'ABSPATH', dirname( dirname( __FILE__ ) ) . '/' ); +} require( ABSPATH . 'wp-settings.php' ); diff --git a/src/wp-load.php b/src/wp-load.php index 94a8b541e7..76dda74b76 100644 --- a/src/wp-load.php +++ b/src/wp-load.php @@ -19,7 +19,9 @@ */ /** Define ABSPATH as this file's directory */ -define( 'ABSPATH', dirname(__FILE__) . '/' ); +if ( ! defined( 'ABSPATH' ) ) { + define( 'ABSPATH', dirname( __FILE__ ) . '/' ); +} error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );