From a0ca5afd8977b5a3857084d9cb1bd345166e2f21 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 3 Apr 2019 11:19:53 +0000 Subject: [PATCH] Site Health: Use `wp_get_upload_dir()` instead of `wp_upload_dir()`, remove duplicate call. Props m_uysl. Fixes #46729. git-svn-id: https://develop.svn.wordpress.org/trunk@45108 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/class-wp-debug-data.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/wp-admin/includes/class-wp-debug-data.php b/src/wp-admin/includes/class-wp-debug-data.php index 01a78c5f02..fefd67c9e4 100644 --- a/src/wp-admin/includes/class-wp-debug-data.php +++ b/src/wp-admin/includes/class-wp-debug-data.php @@ -40,7 +40,8 @@ class WP_Debug_Data { } } - $upload_dir = wp_upload_dir(); + $upload_dir = wp_get_upload_dir(); + if ( file_exists( ABSPATH . 'wp-config.php' ) ) { $wp_config_path = ABSPATH . 'wp-config.php'; // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged @@ -313,9 +314,6 @@ class WP_Debug_Data { $size_db = WP_Debug_Data::get_database_size(); - // Go through the various installation directories and calculate their sizes. - $uploads_dir = wp_upload_dir(); - /* * We will be using the PHP max execution time to prevent the size calculations * from causing a timeout. The default value is 30 seconds, and some @@ -338,6 +336,7 @@ class WP_Debug_Data { $max_execution_time -= 1; } + // Go through the various installation directories and calculate their sizes. $size_directories = array( 'wordpress' => array( 'path' => ABSPATH, @@ -352,7 +351,7 @@ class WP_Debug_Data { 'size' => 0, ), 'uploads' => array( - 'path' => $uploads_dir['basedir'], + 'path' => $upload_dir['basedir'], 'size' => 0, ), );