Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: pre_recurse_dirsize

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
7667       * Filters the amount of storage space used by one directory and all its children, in megabytes.
7668       *
7669       * Return the actual used space to short-circuit the recursive PHP file size calculation
7670       * and use something else, like a CDN API or native operating system tools for better performance.
7671       *
7672       * @since 5.6.0
7673       *
7674       * @param int|false $space_used The amount of used space, in bytes. Default false.
7675       */
7676      $size = apply_filters( 'pre_recurse_dirsize', false, $directory, $exclude, $max_execution_time, $directory_cache );
7677
7678      if ( false === $size ) {
7679           $size = 0;
7680
7681           $handle = opendir( $directory );
7682           if ( $handle ) {
7683                while ( ( $file = readdir( $handle ) ) !== false ) {
7684                     $path = $directory . '/' . $file;
7685                     if ( '.' !== $file && '..' !== $file ) {