Make WordPress Core


Ignore:
Timestamp:
10/20/2015 06:54:41 AM (9 years ago)
Author:
DrewAPicture
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/default-constants.php

    r34961 r35286  
    108108    define( 'YEAR_IN_SECONDS',  365 * DAY_IN_SECONDS    );
    109109    /**#@-*/
     110
     111    /**#@+
     112     * Constants for expressing human-readable data sizes in their respective number of bytes.
     113     *
     114     * @since 4.4.0
     115     */
     116    define( 'KB_IN_BYTES', 1024 );
     117    define( 'MB_IN_BYTES', 1024 * KB_IN_BYTES );
     118    define( 'GB_IN_BYTES', 1024 * MB_IN_BYTES );
     119    define( 'TB_IN_BYTES', 1024 * GB_IN_BYTES );
     120    /**#@-*/
    110121}
    111122
Note: See TracChangeset for help on using the changeset viewer.