PHP Класс HM\BackUpWordPress\Site_Size

Use to calculate the total or partial size of the sites database and files.
Показать файл Открыть проект

Открытые методы

Метод Описание
__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

Описание методов

__construct() публичный Метод

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 directory_filesize ( SplFileInfo $file )
$file SplFileInfo

filesize() публичный Метод

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.
Результат integer The total filesize of the file or directory without the size of excluded files/directories.

get_cached_filesizes() публичный Метод

public get_cached_filesizes ( $max_age = WEEK_IN_SECONDS )

get_formatted_site_size() публичный Метод

Get the site size formatted
См. также: size_format
public get_formatted_site_size ( ) : string
Результат string

get_site_size() публичный Метод

Doesn't account for any compression that would be gained by zipping.
public get_site_size ( ) : string
Результат string

is_site_size_being_calculated() публичный статический Метод

Whether the total filesize is being calculated
public static is_site_size_being_calculated ( ) : boolean
Результат boolean

is_site_size_cached() публичный Метод

Whether the total filesize is cached
public is_site_size_cached ( ) : boolean
Результат boolean

rebuild_directory_filesizes() публичный Метод

recursive_filesize_scanner() публичный Метод

Locks should be set by the caller with set_transient( 'hmbkp_directory_filesizes_running', true, HOUR_IN_SECONDS );
public recursive_filesize_scanner ( ) : array
Результат array $directory_sizes An array of directory paths => filesize sum of all files in directory