wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.
get_dirsize › WordPress Function
Od3.0.0
Przestarzałyn/a
› get_dirsize ( $directory )
Parametry: |
|
Powrót: |
|
Zdefiniowane na: |
|
Codex: | |
Dziennik zmian: |
|
Get the size of a directory.
A helper function that is used primarily to check whether a blog has exceeded its allowed upload space.
Źródło
function get_dirsize( $directory ) { $dirsize = get_transient( 'dirsize_cache' ); if ( is_array( $dirsize ) && isset( $dirsize[ $directory ]['size'] ) ) { return $dirsize[ $directory ]['size']; } if ( ! is_array( $dirsize ) ) { $dirsize = array(); } // Exclude individual site directories from the total when checking the main site, // as they are subdirectories and should not be counted. if ( is_main_site() ) { $dirsize[ $directory ]['size'] = recurse_dirsize( $directory, $directory . '/sites' ); } else { $dirsize[ $directory ]['size'] = recurse_dirsize( $directory ); } set_transient( 'dirsize_cache', $dirsize, HOUR_IN_SECONDS ); return $dirsize[ $directory ]['size']; }