Make WordPress Core


Ignore:
Timestamp:
04/16/2019 11:01:45 PM (5 years ago)
Author:
azaozz
Message:

Site health, info tab:

  • Change recurse_dirsize() to accept an array of excluded paths.
  • Change so we don't calculate the sizes of dirs in wp-content twice.
  • Add the size in bytes to the "debug" into.
  • Add a custom DOM event after the dir sizes request is done. Can be used by plugins to "daisy chain" more requests.
  • Move "WordPress directory location" and "WordPress directory size" to the top in the "Directories and Sizes" section.
  • Move "Theme directory location" to the "Active Theme" section.
  • Fix labels capitalization.

Props xkon, afercia, Clorith, azaozz.
Fixes #46707.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r45206 r45220  
    70727072 * @since 5.2.0 $max_execution_time parameter added.
    70737073 *
    7074  * @param string $directory Full path of a directory.
    7075  * @param string $exclude   Optional. Full path of a subdirectory to exclude from the total.
    7076  * @param int    $max_execution_time Maximum time to run before giving up. In seconds.
    7077  *                                   The timeout is global and is measured from the moment WordPress started to load.
    7078  * @return int|false|null Size in MB if a valid directory. False if not. Null if timeout.
     7074 * @param string $directory       Full path of a directory.
     7075 * @param string|array $exclude   Optional. Full path of a subdirectory to exclude from the total, or array of paths.
     7076 *                                Expected without trailing slash(es).
     7077 * @param int $max_execution_time Maximum time to run before giving up. In seconds.
     7078 *                                The timeout is global and is measured from the moment WordPress started to load.
     7079 * @return int|false|null Size in bytes if a valid directory. False if not. Null if timeout.
    70797080 */
    70807081function recurse_dirsize( $directory, $exclude = null, $max_execution_time = null ) {
     
    70837084    $directory = untrailingslashit( $directory );
    70847085
    7085     if ( ! file_exists( $directory ) || ! is_dir( $directory ) || ! is_readable( $directory ) || $directory === $exclude ) {
     7086    if ( ! file_exists( $directory ) || ! is_dir( $directory ) || ! is_readable( $directory ) ) {
     7087        return false;
     7088    }
     7089
     7090    if (
     7091        ( is_string( $exclude ) && $directory === $exclude ) ||
     7092        ( is_array( $exclude ) && in_array( $directory, $exclude, true ) )
     7093    ) {
    70867094        return false;
    70877095    }
Note: See TracChangeset for help on using the changeset viewer.