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
7754       * Filters the amount of storage space used by one directory and all its children, in megabytes.
7755       *
7756       * Return the actual used space to short-circuit the recursive PHP file size calculation
7757       * and use something else, like a CDN API or native operating system tools for better performance.
7758       *
7759       * @since 5.6.0
7760       *
7761       * @param int|false $space_used The amount of used space, in bytes. Default false.
7762       */
7763      $size = apply_filters( 'pre_recurse_dirsize', false, $directory, $exclude, $max_execution_time, $directory_cache );
7764
7765      if ( false === $size ) {
7766           $size = 0;
7767
7768           $handle = opendir( $directory );
7769           if ( $handle ) {
7770                while ( ( $file = readdir( $handle ) ) !== false ) {
7771                     $path = $directory . '/' . $file;
7772                     if ( '.' !== $file && '..' !== $file ) {