[ZendTo] Feature request: optional units on some preferences

Jules Jules at Zend.To
Thu Dec 10 16:42:14 GMT 2020


John and others,

I didn't ignore this, I just mentally added it to the list without 
remembering to reply to you about it! :-/

I should be able to do hours and days and stuff like that too.
So that it matches with what happens in the code already, can we agree 
to use 1024, 1024^2, 1024^3 etc as the K, M and G multiples?
For times I could allow s, h, d, w.

So the multipliers would be (ignoring case):
k = 1024
m = 1024*1024
g = 1024*1024*1024
s = 1
h = 60*60
d = 60*60*24
w = 60*60*24*7

Are there any I have missed (I'm avoiding minutes in favour of megs).

The syntax would have to change in the preferences.php file where you 
chose to use a suffix, as
     'maxBytesForDropoff' => *24G*,
is not valid PHP, it would need to be
     'maxBytesForDropoff' => *'24G'*,
but you would only need the quotes round ones where you chose to use a 
suffix.

Sound okay to everyone?

Cheers,
Jules.

On Tue 17/11/20 19:13, John Thurston via ZendTo wrote:
> Computers are good at doing math. Can we have the option of including 
> units on some preferences?
>
> I'm thinking, particularly, about:
>   maxBytesForDropoff
>   maxBytesForFile
>   maxBytesForChecksum
>   maxBytesForEncryption
>
> These are currently specified in bytes. This is generally a long 
> number which is hard to read and easy to stumble over. May we have the 
> default continue to be "number of bytes" but have it accept an 
> optional unit-suffix? For example:
>   'maxBytesForDropoff'   => 25769790582,
> could be specified as:
>   'maxBytesForDropoff'   => 24G,
>
> Old preferences would continue to work, and new preferences would be 
> easier to read.
>

Jules

-- 
Julian Field MEng CEng CITP MBCS MIEEE MACM

'Solutions nearly always come from the direction you least expect, which
  means there's no point trying to look in that direction because it won't
  be coming from there.' - Douglas Adams

www.Zend.To
Twitter: @JulesFM

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jul.es/pipermail/zendto/attachments/20201210/3e44cb64/attachment.html>


More information about the ZendTo mailing list