Filesystem: Introduce constants to allow for easier expression of file sizes and other data amounts.

Adds:
* `KB_IN_BYTES` (kilobytes)
* `MB_IN_BYTES` (megabytes)
* `GB_IN_BYTES` (gigabytes)
* `TB_IN_BYTES` (terabytes)

Props nbachiyski, sudar.
See #22405.


git-svn-id: https://develop.svn.wordpress.org/trunk@35286 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Drew Jaynes 2015-10-20 06:54:41 +00:00
parent 1a999bce25
commit 2bd3c9a832
1 changed files with 11 additions and 0 deletions

View File

@ -107,6 +107,17 @@ function wp_initial_constants() {
define( 'MONTH_IN_SECONDS', 30 * DAY_IN_SECONDS );
define( 'YEAR_IN_SECONDS', 365 * DAY_IN_SECONDS );
/**#@-*/
/**#@+
* Constants for expressing human-readable data sizes in their respective number of bytes.
*
* @since 4.4.0
*/
define( 'KB_IN_BYTES', 1024 );
define( 'MB_IN_BYTES', 1024 * KB_IN_BYTES );
define( 'GB_IN_BYTES', 1024 * MB_IN_BYTES );
define( 'TB_IN_BYTES', 1024 * GB_IN_BYTES );
/**#@-*/
}
/**