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
7982       * Filters the amount of storage space used by one directory and all its children, in megabytes.
7983       *
7984       * Return the actual used space to short-circuit the recursive PHP file size calculation
7985       * and use something else, like a CDN API or native operating system tools for better performance.
7986       *
7987       * @since 5.6.0
7988       *
7989       * @param int|false $space_used The amount of used space, in bytes. Default false.
7990       */
7991      $size = apply_filters( 'pre_recurse_dirsize', false, $directory, $exclude, $max_execution_time, $directory_cache );
7992
7993      if ( false === $size ) {
7994           $size = 0;
7995
7996           $handle = opendir( $directory );
7997           if ( $handle ) {
7998                while ( ( $file = readdir( $handle ) ) !== false ) {
7999                     $path = $directory . '/' . $file;
8000                     if ( '.' !== $file && '..' !== $file ) {