Fixed 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).
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.2.12).

Change log:
Use late static binding in utility classes to make them easier to extend
There may be a delay before changes are rolled out to the XenForo Community.
Top Bottom