[wp-trac] [WordPress Trac] #19067: Duplicate functionality in core: size_format() and wp_convert_bytes_to_hr()

WordPress Trac noreply at wordpress.org
Sat Feb 16 03:11:55 UTC 2013


#19067: Duplicate functionality in core: size_format() and wp_convert_bytes_to_hr()
----------------------------------------+-----------------------------
 Reporter:  l3rady                      |       Owner:  SergeyBiryukov
     Type:  enhancement                 |      Status:  reopened
 Priority:  normal                      |   Milestone:  3.6
Component:  General                     |     Version:  3.2.1
 Severity:  trivial                     |  Resolution:
 Keywords:  has-patch 3.6-early commit  |
----------------------------------------+-----------------------------
Changes (by nacin):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 Replying to [comment:13 scribu]:
 > The output from size_format() is preferred, since it's meant to be read
 by users.
 >
 > If we want to be super-cautious, we could deprecate
 wp_convert_bytes_to_hr(), but keep it's current code, instead of making it
 a wrapper for size_format().

 Because of the output change, I think this is a good idea. A unit test
 asserting the outputs of these functions would additionally be a good
 idea.

 I like the simpleness of size_format(), but it is kind of lame to
 deprecate wp_convert_bytes_to_hr() when we have a sanely named inverse:
 wp_convert_hr_to_bytes(). That's part of the reason why they were both
 moved to wp-includes/media.php, because it would be weird for one to be
 accessible in one context, but not the other. Deprecating only one is a
 bit goofy too. I do understand the reason, though — size_format() is a
 better output.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19067#comment:26>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list