#22405 closed enhancement (fixed)
Easier expression of file sizes and other data amounts
Reported by: | nbachiyski | Owned by: | DrewAPicture |
---|---|---|---|
Milestone: | 4.4 | Priority: | normal |
Severity: | normal | Version: | 3.5 |
Component: | General | Keywords: | has-patch |
Focuses: | Cc: |
Description
In the spirit of #20987 writing 64 * 1024 * 1024 * 1024 * 1024
isn't very readable and cool.
Here is a patch, which adds a couple of constants like KB_IN_BYTES
, MB_IN_BYTES
, etc.
Attachments (5)
Change History (28)
#5
@
9 years ago
- Keywords 3.6-early removed
- Owner set to chriscct7
- Status changed from new to assigned
#6
@
9 years ago
- Keywords commit added
- Milestone changed from Future Release to 4.4
- Status changed from assigned to accepted
Refreshed patch
#7
@
9 years ago
- Keywords needs-docs added; commit removed
If we're going to go the "pluggable" route on existing and new constants, we'll need to add constant DocBlocks to each definition (previously there was a multi-definition DocBlock wrapping the time constants.
#9
in reply to:
↑ 8
;
follow-up:
↓ 10
@
9 years ago
Replying to SergeyBiryukov:
I don't think the "pluggable" route is necessary here.
In that case, we should probably add a multi-definition DocBlock for the new constants. And do we really need to go above a terabyte? Seems like there wouldn't be a great deal of need for anything higher than that.
#10
in reply to:
↑ 9
@
9 years ago
Replying to DrewAPicture:
And do we really need to go above a terabyte? Seems like there wouldn't be a great deal of need for anything higher than that.
Agreed.
#12
@
9 years ago
- Keywords has-patch added; needs-docs needs-patch removed
I have removed constants above terabyte and have also added multi-definition DocBlock enclosing the new constants.
#13
@
9 years ago
I don't like the if ( ! defined( 'PIZZA_IN_SLICES' ) )
stuff, otherwise, seems somewhat useful.
#14
@
9 years ago
@wonderboymusic
Do you want to remove the if ( ! defined( 'KB_IN_BYTES' ) )
checks and just add the definition of the constants alone?
#19
@
9 years ago
- Keywords needs-patch added; has-patch removed
OK we've got the constants. Let's use them. Needs a patch.
#20
follow-up:
↓ 21
@
9 years ago
- Keywords has-patch added; needs-patch removed
In addition to the ones that I changed in the above patch I also found a couple of instances inside wp-includes/ID3/*.php
and wp-admin/includes/class-pclzip.php
.
Since these were external libraries I didn't change them to use the *_IN_BYTES constants. Let me know If the hard coded numbers should be replaced with the constants even in these external libraries.
#21
in reply to:
↑ 20
@
9 years ago
Replying to sudar:
In addition to the ones that I changed in the above patch I also found a couple of instances inside
wp-includes/ID3/*.php
andwp-admin/includes/class-pclzip.php
.
Since these were external libraries I didn't change them to use the *_IN_BYTES constants. Let me know If the hard coded numbers should be replaced with the constants even in these external libraries.
Nope, you did right to leave them alone I think. If others disagree, we can always come back and do those replacements later. Thanks for the patch.
On second thought, this ticket is a continuation of #20987, so 3.5 is the earliest affected version here.