Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

getReadableSize binary system calculation support #4283

Closed
wants to merge 1 commit into from
Closed

getReadableSize binary system calculation support #4283

wants to merge 1 commit into from

Conversation

tristanlins
Copy link
Contributor

Make possible to use binary system to calculate the data size.
The behavior can changed in the settings or by passing a third parameter to getReadableSize().

According to #4276

@leofeyer
Copy link
Member

leofeyer commented May 6, 2012

I don't think we need this option. It will only lead to a lot of "why is the incorrect file size shown in the Contao file manager" questions. I therefore close the pull request.

@leofeyer leofeyer closed this May 6, 2012
@tristanlins
Copy link
Contributor Author

This changes does not change anythink of the current logic.
I don't see why it may lead to a lot of "why is the incorrect file size shown in the Contao file manager" questions?
It's just the answer to the current "why is the incorrect file size shown in the Contao file manager" questions.

@leofeyer
Copy link
Member

leofeyer commented May 6, 2012

E.g. the admin changes it to "binary", because he knows what he is doing, and a user opens the file manager. Then the file size in Contao differs from the one on his computer.

@tristanlins
Copy link
Contributor Author

That's different from OS to OS :-)
I don't know the factor Mac OS use, but Windows use the factor 1024 with the SI unit (they do it wrong all the way ^^).

In fact of your argumentation the CURRENT behavior is wrong!
Contao will display 3.1 MB, but Windows shows 2.9 MB!

Just have a look at this (made on Windows 7!):
windows file size

But under Linux, especially dolphin it looks like this:
dolphin file size

I don't know about Mac OS X, but I thinks its not needed to make a screenshot because you are using Mac by yourself, so you can look at it.

With this argument you never can win in this situation ;-)

If you have a look at my changes, I not only change the factor.
I also use the correct binary unit prefix if you switch to binary calculation. :-)

@leofeyer leofeyer reopened this May 12, 2012
@aschempp
Copy link
Member

Why would anyone ever not use 1024 for file size calculation? I would consider this a bug?

@aschempp
Copy link
Member

We just discussed that in the Core call and finally came to a solution.

  1. We should keep in mind that the current implementation is mathematically correct.
  2. Making the factor configurable is totally useless, as 99.9% will not use that "feature".
  3. We compared several systems, and all of them except Mac OS X do calculate the 1024 factor.
  4. We wanted to use factor 1024, but show MB because that is common. However, that would be technically incorrect.

The final solution is the following:

  • We should use factor 1024, because that is IT-technically correct and common. No one will require to set a factor of 1000.
  • We will show MiB etc., because it is technically correct.
  • If someone is confused by MiB, they can change the label using langconfig.php etc.

@tristanlins
Copy link
Contributor Author

+1

I don't think anyone will be confused about MiB because more and more systems use this unit instead of MB :-)

@rumpelsepp
Copy link

+1

1 similar comment
@Toflar
Copy link
Member

Toflar commented Dec 19, 2012

+1

@leofeyer
Copy link
Member

Changed in 91b39f8.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants