[TYPO3-core] RFC #13645: Bug and Cleanup: t3lib_div::formatSize should use IEC prefixes and appropriate units
Sigfried Arnold
s.arnold at rebell.at
Wed Feb 24 23:57:26 CET 2010
This is an SVN patch request.
Type: Code cleanup, logical fix (nomenclature)
Bugtracker references:
http://bugs.typo3.org/bug_view_page.php?bug_id=13645
Branches:
TYPO3_4-2, TYPO3_4-3 & trunk
Problem:
t3lib_div::formatSize:
- filesizes lack of a unit in default configuration
- filesizes use SI prefixes (not allways correct) instead of IEC prefixes
Since TYPO3 is usualy Linux/Unix-based and Linux kernel uses IEC binary
prefixes, TYPO3 should use them too.
Also the current function/defaults are not scaleable, they just end at G
(gigabyte) - i'm aware terabytes are quite uncommon in web context, but
the function could be less redundant and should be free of DRY-problems.
So calulations should be done with powers in a loop instead of manual
multiplications.
Solution:
Add a unit (Byte or simply B)
Change SI prefixes to IEC prefixes
Refactor code.
Notes:
The attached patch was done to the latest file out of 4.4alpha.
It's also possible to make the new feature configurable via
localconf.php, the function is prepared for it - if requested, it can be
patched too.
Greetings form Austria,
Sigfried Arnold
PS: this is my first patch for the core, i hope it's done correctly ;)
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 13645_v2.diff
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20100224/5a8b37e4/attachment.txt>
More information about the TYPO3-team-core
mailing list