Feature #22175

Filelist should use IEC prefixes and appropriate units for filesize.

Added by Sigfried Arnold over 10 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Should have
Category:
File Abstraction Layer (FAL)
Target version:
Start date:
2010-02-24
Due date:
% Done:

100%

PHP Version:
Tags:
Complexity:
medium
Sprint Focus:

Description

The filelist shows filesizes a bit weird using an inappropriate SI prefix - it don't even uses a unit.

Examples:
124 Byte (now "124") should be "123 B"
1.428.278 Byte (now "1.4 M") should be "1.36 MiB (1.42 MB)"
1.150 Byte (now "1.1 K") should be "1.12 KiB (1.15 KB)"

http://physics.nist.gov/cuu/Units/binary.html
(issue imported from #M13645)

13645.diff View (2.63 KB) Administrator Admin, 2010-02-24 21:31

13645_v2.diff View (2.63 KB) Administrator Admin, 2010-02-24 21:42


Related issues

Related to TYPO3 Core - Bug #69380: Set "si" as the default for cObj fileSizes Rejected 2015-08-28
Precedes TYPO3 Core - Task #67572: Update calls to formatSize to adjust to new units Closed 2015-06-17

Associated revisions

Revision 20fa7514 (diff)
Added by Pierrick Caillon almost 5 years ago

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

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.

Resolves: #22175
Releases: master
Change-Id: Iaa255f639b0421e508f561557a6c6b2e2b226bc9
Reviewed-on: http://review.typo3.org/40291
Reviewed-by: Alexander Opitz <>
Tested-by: Alexander Opitz <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>

History

#1 Updated by Sigfried Arnold over 10 years ago

I refactored the code, made it more flexible and added the corrections.

The code is fully backwards compatible but is more scaleable (till inifinity) - but i just wanted to respect the dry-principle ;)

I tested the code with TYPO3 4.2, 4.3 and 4.4 alpha - everything seems to be fine.

The essential part ist now shorter, the function itself is only a few bytes larger - excluding the comments < 100 byte.

Possibly todo (additional feature): the make the default lables and calculation base configurable via localconf.

Ready to bring it into the trunk.

#2 Updated by Sigfried Arnold over 10 years ago

Well, i just figured out, i did the patch in the wrong direction - 13645_v2.diff is now correct :D

#3 Updated by Alexander Opitz over 6 years ago

  • Status changed from New to Needs Feedback
  • Target version deleted (0)
  • TYPO3 Version set to 4.3

Hi,

as this issue is very old. Is this feature missing in newer versions of TYPO3 CMS (6.1.7)?
If yes, can you provide a newer patch against master by using Gerrit? http://wiki.typo3.org/CWT

#4 Updated by Sigfried Arnold over 6 years ago

This feature is still missing - i'll make a patch against the current version if it is going to be implemented

#5 Updated by Alexander Opitz over 6 years ago

  • Category set to Backend User Interface
  • Status changed from Needs Feedback to New

Ok, will help you with the review process.

#6 Updated by Mathias Schreiber over 5 years ago

  • Category changed from Backend User Interface to File Abstraction Layer (FAL)
  • Target version set to 7.4 (Backend)
  • Sprint Focus set to On Location Sprint

#7 Updated by Ingo Schmitt over 5 years ago

  • PHP Version deleted (4.3)
  • Complexity set to medium

#8 Updated by Pierrick Caillon almost 5 years ago

  • Status changed from New to In Progress
  • Assignee set to Pierrick Caillon

#9 Updated by Gerrit Code Review almost 5 years ago

  • Status changed from In Progress to Under Review

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/40291

#10 Updated by Gerrit Code Review almost 5 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/40291

#11 Updated by Gerrit Code Review almost 5 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/40291

#12 Updated by Gerrit Code Review almost 5 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/40291

#13 Updated by Gerrit Code Review almost 5 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/40291

#14 Updated by Sigfried Arnold almost 5 years ago

Looks good - but the unit symbol is missing - this is required

the units are not k/Ki M/Mi - they are kB/KiB, MB/MiB - and note, the k for Kilo is a small k since K is reserved for Kelvin in SI: KB would be Kelvin*Byte

and thanks for your effort

#15 Updated by Gerrit Code Review almost 5 years ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/40291

#16 Updated by Gerrit Code Review almost 5 years ago

Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/40291

#17 Updated by Gerrit Code Review almost 5 years ago

Patch set 9 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/40291

#18 Updated by Pierrick Caillon almost 5 years ago

The formatting rules in http://physics.nist.gov/cuu/Units/checklist.html are used. Especially the number 15 applying to spacing.

#19 Updated by Gerrit Code Review almost 5 years ago

Patch set 10 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/40291

#20 Updated by Gerrit Code Review almost 5 years ago

Patch set 11 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/40291

#21 Updated by Pierrick Caillon almost 5 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#22 Updated by Sigfried Arnold almost 5 years ago

Pierrick Caillon wrote:

The formatting rules in http://physics.nist.gov/cuu/Units/checklist.html are used. Especially the number 15 applying to spacing.

I was not talking about the spacing or the formatting, i was talking about the missing unit symbol :) currently there is just a prefix with no unit

It should be 100 MiB or 200 kB - not just 100 Mi or 200 k - the unit symbol is mandatory, else it could be "anything" - it is pretty obvious that those are Bytes, but it does not say so.

To fix this: "B" needs to be appended to each Prefix since it cannot stand there alone.

#23 Updated by Mathias Schreiber almost 5 years ago

  • Sprint Focus deleted (On Location Sprint)

#24 Updated by Riccardo De Contardi over 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF