Review main Merged Breaking

40291[!!!][FEATURE] Support IEC/SI units in file size formatting

Pierrick Caillon CR +2 V +2 Normal +76 −37 updated 06/17/15, 16:51

Commit message

The new labels "iec" and "si" are added to GeneralUtility::formatSize,
where "iec" is the new default label.

A new parameter "base" has been added for specifying the base unit
multiplier expecting 1000 and 1024 as value and defaulting to 1024
when using the old labels.

Review

  • Code review CR +2
    • Christian Kuhn +2
    • Alexander Opitz +1
  • Verified V +2
    • Christian Kuhn +2
    • Alexander Opitz +1

Issues 1

Files 4

Review log 33

Show 8 earlier messages
  1. Pierrick Caillon uploaded patch set 1 06/16/15, 11:44

  2. Pierrick Caillon updated the commit message in patch set 2 06/16/15, 11:46

  3. Mathias Brodala uploaded patch set 3 06/16/15, 13:14

  4. Mathias Brodala commented on patch set 3 06/16/15, 13:15

    Reworded commit message, removed debug function call and scared away all the bees.
  5. Wouter Wolters commented on patch set 3 CR -1 06/16/15, 15:31

    GeneralUtility.php:926

    (int)

    GeneralUtility.php:927

    do a normal if (bla || bla2) check here. No in_array please

    Feature-22175-SupportSpecifyingIecOrSiUnitsWhenFormattingFileSize.rst:2

    [!!!][FEATURE] should be removed
  6. Christian Kuhn commented on patch set 3 06/16/15, 15:55

    general +1 from me when the small issues by wouter are fixed.
  7. Christian Kuhn commented on patch set 3 06/16/15, 15:57

    [!!!] is not needed if this is not breaking ... or, if breaking: it should be stated more clearly (especially in the .rst file) what exactly is different (maybe with example at best).
  8. Pierrick Caillon uploaded patch set 4 06/16/15, 17:04

  1. Wouter Wolters commented on patch set 4 06/16/15, 17:07

    GeneralUtility.php:927

    we know $base is an integer so we should use !== for the check. Strict comparison is quicker.

    Feature-22175-SupportIecSiUnitsInFileSizeFormatting.rst:2

    Remove this please [!!!][FEATURE]
  2. Pierrick Caillon commented on patch set 4 06/16/15, 17:28

    Feature-22175-SupportIecSiUnitsInFileSizeFormatting.rst:2 Reply

    The default output is different from before. Shouldn't it be breaking ? Or what do you expect?
  3. Alexander Opitz commented on patch set 4 CR -1 06/17/15, 06:40

    GeneralUtility.php:915

    put the labels in an array, we do not need to split them every time.

    GeneralUtility.php:947

    Can we replace this for loop by one out of the examples on http://stackoverflow.com/questions/2510434/format-bytes-to-kilobytes-megabytes-gigabytes ?
  4. Mathias Brodala commented on patch set 4 06/17/15, 07:55

    Feature-22175-SupportIecSiUnitsInFileSizeFormatting.rst:2 Reply

    I think he means that this part should be removed from the subject line of this .rst file, not from the commit message. Please see https://forger.typo3.org/standard/rst
  5. Pierrick Caillon uploaded patch set 5 06/17/15, 09:18

  6. Pierrick Caillon uploaded patch set 6 06/17/15, 09:22

  7. Andreas Kienast commented on patch set 6 06/17/15, 09:39

    Feature-22175-SupportIecSiUnitsInFileSizeFormatting.rst:2

    Please drop this
  8. Pierrick Caillon uploaded patch set 7 06/17/15, 10:03

  9. Christian Kuhn commented on patch set 7 CR -1 06/17/15, 10:05

    on it. let's finish this now.
  10. Christian Kuhn uploaded patch set 8 06/17/15, 10:22

  11. Christian Kuhn uploaded patch set 9 06/17/15, 10:25

  12. Christian Kuhn voted on patch set 9 CR +1 V +1 06/17/15, 10:31

  13. Alexander Opitz commented on patch set 9 CR -1 06/17/15, 10:34

    GeneralUtility.php:914

    Maybe I would also remove the space char, so we can later decide to use "1kB" or "1 kB"

    GeneralUtility.php:915

    The Si Präfix for kilo is "k" not "K".

    GeneralUtility.php:941

    $labels is an array if "isset($defaultFormats[$labels])" is TRUE so move this in the else part?

    GeneralUtility.php:942

    Can $sizeInBytes be lower then 0? No, so I think this isn't needed.
  14. Andreas Kienast commented on patch set 9 CR -1 06/17/15, 10:43

    We need a breaking rest document
  15. Christian Kuhn commented on patch set 9 06/17/15, 10:49

    ok, i'm out. andreas / alex: could you push something to incorporate your thought, please?
  16. Pierrick Caillon commented on patch set 9 06/17/15, 11:00

    I'll push an update to fix the wrong 'k' for SI units.

    GeneralUtility.php:914 Reply

    Point #15 of http://physics.nist.gov/cuu/Units/checklist.html says it is mandatory.

    GeneralUtility.php:915 Reply

    That's true, I'll fix it.

    GeneralUtility.php:942 Reply

    The logarithm of negative integer is not supported (NaN). Safety check.
  17. Pierrick Caillon uploaded patch set 10 06/17/15, 11:08

  18. Christian Kuhn commented on patch set 10 CR +1 V +1 06/17/15, 11:11

    i don't think we need a breaking .rst here - the feature file explains this pretty well and the breaking file would probably only duplicate that. andreas, to you see urgent need for that?
  19. Andreas Kienast commented on patch set 10 06/17/15, 11:34

    Fine with me, go ahead
  20. Alexander Opitz commented on patch set 10 V +2 CR -1 06/17/15, 14:17

    GeneralUtility.php:941

    Please move the is_array line as written in Patchset 9.
  21. Pierrick Caillon uploaded patch set 11 06/17/15, 15:27

  22. Alexander Opitz commented on patch set 9 06/17/15, 16:09

    GeneralUtility.php:914 Reply

    Yes, but the space can also be added later. But I understand that the old $labels string have the space inside and we would need a trim_explode which would be more expensive. So Ok, let it as it is.

    GeneralUtility.php:942 Reply

    abs($sizeInBytes) ? ;-) But NaN would be an expectable result for negative numbers. But, is ok.
  23. Alexander Opitz voted on patch set 11 V +1 CR +1 06/17/15, 16:10

  24. Christian Kuhn voted on patch set 11 CR +2 V +2 06/17/15, 16:51

  25. Christian Kuhn merged patch set 11 06/17/15, 16:51