get_dirsize()

最后更新于:2021-11-26 09:06:30

get_dirsize( string$directory, int$max_execution_time=null)

Get the size of a directory.

参数

$directory

(string) (Required) Full path of a directory.

$max_execution_time

(int) (Optional) Maximum time to run before giving up. In seconds. The timeout is global and is measured from the moment GeChiUI started to load.

Default value: null

响应

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

源文件

文件: gc-includes/functions.php

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;
}