Advertisements

get_dirsize

Definition:
function get_dirsize( $directory ) {}

Get the size of a directory.
A helper function that is used primarily to check whether a blog has exceeded its allowed upload space.

Parameters

  • string $directory

Source code

function get_dirsize( $directory ) {

	$dirsize = get_transient( 'dirsize_cache' );

	if ( is_array( $dirsize ) && isset( $dirsize[ $directory ][ 'size' ] ) )

		return $dirsize[ $directory ][ 'size' ];



	if ( false == is_array( $dirsize ) )

		$dirsize = array();



	$dirsize[ $directory ][ 'size' ] = recurse_dirsize( $directory );



	set_transient( 'dirsize_cache', $dirsize, 3600 );

	return $dirsize[ $directory ][ 'size' ];

}

1366

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: