Advertisements

upload_is_user_over_quota

Definition:
function upload_is_user_over_quota( $echo = true ) {}

Check whether a blog has used its allotted upload space.
Used by get_dirsize() to get a directory’s size when it contains other directories.

Parameters

  • bool $echo: Optional. If $echo is set and the quota is exceeded, a warning message is echoed. Default is true.

Source code

function upload_is_user_over_quota( $echo = true ) {

	if ( get_site_option( 'upload_space_check_disabled' ) )

		return false;



	$spaceAllowed = get_space_allowed();

	if ( empty( $spaceAllowed ) || !is_numeric( $spaceAllowed ) )

		$spaceAllowed = 10;	// Default space allowed is 10 MB



	$size = get_dirsize( BLOGUPLOADDIR ) / 1024 / 1024;



	if ( ($spaceAllowed-$size) < 0 ) {

		if ( $echo )

			_e( 'Sorry, you have used your space allocation. Please delete some files to upload more files.' ); // No space left

		return true;

	} else {

		return false;

	}

}

3259

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: