User tests: Successful: Unsuccessful:
This PR is in succession with #11026.
With this patch the developers will be able to make use of IEC Binary prefixes for bytes calculation.
To be able to read 1 KB as 1000 bytes, you'd need to pass true as the last/4th argument to JHtmlNumber::bytes which will make the call IEC aware. Otherwise the function should behave same as previously without any B/C break, and stick to real world standard only.
This patch also makes you able to parse values which are already in IEC format like 1.5 GiB, earlier this would return 0 as IEC prefixes were not supported.
To allow return value with automatic unit selection auto unit was already being used, and its still the same. To use automatic unit selection with IEC binary prefixed units the value binary should be used.
Newly supported units are: KiB, MiB, GiB, TiB, PiB, EiB, ZiB, YiB
echo JHtml::_('number.bytes', '1024 KB', '', 2, true). "\n";
echo JHtml::_('number.bytes', '1024 KiB', '', 2, true). "\n";
echo JHtml::_('number.bytes', 1000 * 1000, 'auto', 2, true). "\n";
echo JHtml::_('number.bytes', 1024 * 1024, 'binary', 2, true). "\n";
echo JHtml::_('number.bytes', 1024 * 1024, 'binary', 2, false). "\n";
echo JHtml::_('number.bytes', '1024 KB', 'KiB', 2, true). "\n";
echo JHtml::_('number.bytes', '1024 KiB', 'kB', 2, true). "\n";This should return
1024000
1048576
1 MB
1 MiB
1 MiB
1000 KiB
1048.58 kB
When testing keep in mind the following:
The above note should be added to the documentation. I too can do that myself with appropriate guidance.
| Status | New | ⇒ | Pending |
| Category | ⇒ | Libraries Unit Tests |
| Labels |
Added:
?
?
|
||
I have tested this item
I would give a successfull test but I'm unable to open this ticket on https://issues.joomla.org/tracker/joomla-cms/11803 ...
I have tested this item
| Status | Pending | ⇒ | Ready to Commit |
| Labels | |||
| Labels |
Added:
?
|
||
| Status | Ready to Commit | ⇒ | Fixed in Code Base |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-08-27 18:35:09 |
| Closed_By | ⇒ | rdeutz |
Thanks
| Labels |
Removed:
?
|
||
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11803.