[5.0] DRYs up some 'file_put_contents'

I know this does not improve anything, so, feel free to close if you want. :wink: