wppaste
WordPress

get_dirsize( string $directory, int $max_execution_time = null ): int|false|null

Since
MU (3.0.0), 5.2.0
Source
wp-includes/functions.php:8901
Gets the size of a directory.

Description

A helper function that is used primarily to check whether a blog has exceeded its allowed upload space.

Parameters

$directorystring
Full path of a directory.
$max_execution_timeintoptional
Maximum time to run before giving up. In seconds. The timeout is global and is measured from the moment WordPress started to load.Default: null

Return

int|false|null
Size in bytes if a valid directory. False if not. Null if timeout.

Uses · 3

Used by · 1

Source

function get_dirsize( $directory, $max_execution_time = null ) { 	/*	 * Exclude individual site directories from the total when checking the main site of a network,	 * as they are subdirectories and should not be counted.	 */	if ( is_multisite() && is_main_site() ) {		$size = recurse_dirsize( $directory, $directory . '/sites', $max_execution_time );	} else {		$size = recurse_dirsize( $directory, null, $max_execution_time );	} 	return $size;}

History

Introduced in 5.2.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

5.2.0
$max_execution_time parameter added.from the docblock
MU (3.0.0)
MU (3.0.0)from the docblock

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/functions.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.