Extending XF\Util\File is difficult


Well-known member
Affected version
Is some scenarios I'd need temp files to be created in a different directory than the default and cleaned up automatically.

XF\Util\File provides almost everything needed to achieve that - except it doesn't allow to override the directory.

It would be relatively easy to override getTempDir in a child class and use that instead of the original, but unfortunately all methods seem to use self - so the overriding method would not get called.

So the only options (that I can see) would be to tinker with the config (which seems hacky) - or literally copy a whole buch of methods from the base class so overriding method getTempDir does get called.

Unless there is a compelling reason not to do so, could all those self be changed to static?

That would make things a lot easier (in my usecase).