Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize file size units #1480

Closed
jawira opened this issue Dec 16, 2020 · 1 comment · Fixed by #1482
Closed

Standardize file size units #1480

jawira opened this issue Dec 16, 2020 · 1 comment · Fixed by #1482
Assignees
Milestone

Comments

@jawira
Copy link
Contributor

jawira commented Dec 16, 2020

Many tasks transforms Bytes to another unit, and from any unit to Bytes.

  • TrucateTask: k, m,
  • size selector: k, m, g, t and many variations.
  • hasfreespace condition: K, M, G, T, P
  • FileSizeTask: B, K, M, G, T, P.

I have already mentioned this in #1420

Every mentioned Task handles the unit conversion by itself (except TrucateTask which uses \Phing::convertShorthand), so I want to create SizeHelper class, the idea is to put all the conversion logic in a single place (the same way StringHelper is used to parse strings).

1024 is used as multiplier almost everywhere, except in size selector (which also supports 1000 as multiplier). Therefore -in order to apply KISS philosophy- I think the best is to only multiply bytes by 1024 and unsupport 1000. I know this is a breaking change, but that why major releases exist right?

What do you think? Should I continue with this idea and create a PR?

@siad007
Copy link
Member

siad007 commented Dec 18, 2020

Sounds like a plan - very much appreciated!

@siad007 siad007 added this to the 3.0.0-rc1 milestone Dec 18, 2020
@jawira jawira mentioned this issue Dec 20, 2020
6 tasks
@jawira jawira closed this as completed Dec 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants