rework getFileSize

I have been rewriting getFileSize with the purpose of avoiding opening the encrypted file as an encrypted stream. I will need this to avoid recursion when I rework #8390 (to make the encrypted stream seekable the unencrypted filesize is required upon opening the stream).
I used the opportunity to make the procedure more robust for a number of exotic situation, such as local streams that are non-seekable or streams that return less than 8192 bytes upon fread. That should all be covered now.
I didn't do much testing yet. It seems to work on my installation. Any feedback appreciated.
What I do is first initialise $cipher with Helper::getCipher() (at line 388). I assume that handles legacy cases well (didn't test it). Then in the case where there is a header the value of $cipher is updated (and all along the stream pointer is moved; the code is optimised to pass only once through the file; also the encrypted file $size is updated to reflect the pointer move). Note that $data only contains the first encrypted block at this stage. The alternative would be to initialise $data as an empty string, update it if there's a header, and then run parseHeader() and getCipher() on $data (even when it is en empty string). Would that be preferred?