PHP Class HM\BackUpWordPress\Site_Size

Use to calculate the total or partial size of the sites database and files.
Afficher le fichier Open project: humanmade/backupwordpress

Méthodes publiques

Méthode Description
__construct ( string $type = 'complete', Excludes $excludes = null ) Constructor
directory_filesize ( SplFileInfo $file )
filesize ( SplFileInfo $file ) : integer Get the total filesize for a given file or directory. Aware of exclusions.
get_cached_filesizes ( $max_age = WEEK_IN_SECONDS )
get_formatted_site_size ( ) : string Get the site size formatted
get_site_size ( ) : string Calculate the size total size of the database + files.
is_site_size_being_calculated ( ) : boolean Whether the total filesize is being calculated
is_site_size_cached ( ) : boolean Whether the total filesize is cached
rebuild_directory_filesizes ( )
recursive_filesize_scanner ( ) : array Recursively scans a directory to calculate the total filesize

Method Details

__construct() public méthode

Set up some initial conditions including whether we want to calculate the size of the database, files or both and whether to exclude any files from the file size calculation.
public __construct ( string $type = 'complete', Excludes $excludes = null )
$type string Whether to calculate the size of the database, files or both. Should be one of 'file', 'database' or 'complete'
$excludes Excludes An array of exclude rules

directory_filesize() public méthode

public directory_filesize ( SplFileInfo $file )
$file SplFileInfo

filesize() public méthode

If $file is a file then return the result of filesize() or 0 if it's excluded. If $file is a directory then recursively calculate the size without the size of excluded files/directories.
public filesize ( SplFileInfo $file ) : integer
$file SplFileInfo The file or directory you want to know the size of.
Résultat integer The total filesize of the file or directory without the size of excluded files/directories.

get_cached_filesizes() public méthode

public get_cached_filesizes ( $max_age = WEEK_IN_SECONDS )

get_formatted_site_size() public méthode

Get the site size formatted
See also: size_format
public get_formatted_site_size ( ) : string
Résultat string

get_site_size() public méthode

Doesn't account for any compression that would be gained by zipping.
public get_site_size ( ) : string
Résultat string

is_site_size_being_calculated() public static méthode

Whether the total filesize is being calculated
public static is_site_size_being_calculated ( ) : boolean
Résultat boolean

is_site_size_cached() public méthode

Whether the total filesize is cached
public is_site_size_cached ( ) : boolean
Résultat boolean

rebuild_directory_filesizes() public méthode

recursive_filesize_scanner() public méthode

Locks should be set by the caller with set_transient( 'hmbkp_directory_filesizes_running', true, HOUR_IN_SECONDS );
public recursive_filesize_scanner ( ) : array
Résultat array $directory_sizes An array of directory paths => filesize sum of all files in directory