This topic was marked solved by Nao, on September 24th, 2012, 02:40 PM
SMF bug 4913 (convert fopen/fwrite to file_put_contents)

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
SMF bug 4913 (convert fopen/fwrite to file_put_contents)
« on March 1st, 2012, 10:18 AM »
I'm not 100% sure why this is being suggested, but it is certainly shorter and cleaner, though I can't see it being any faster or more efficient in the long run. I'm also not sure if there aren't permissions related issues to deal with.
Posted: February 29th, 2012, 02:27 PM

Note that we wouldn't convert all the cases (only where it's atomic, such that we do fopen/fwrite/fclose in quick succession), because that's faster than doing file_put_contents with appending.
Re: SMF bug 4913 (convert fopen/fwrite to file_put_contents)
« Reply #1, on April 9th, 2012, 01:57 PM »
I'm thinking about this one again.

The grand plan is that attachments, avatars and media, these places all have write access anyway. Plugins, smileys, etc. won't have that access but will do it via the FTP passthrough (as discussed elsewhere) which means there won't be permissions issues, but also where we won't be using native file operations anyway.

Result is that there's very few places this can actually be done meaningfully, except perhaps as a change to the file cache (since the same flock processing should still be possible)
When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: SMF bug 4913 (convert fopen/fwrite to file_put_contents)
« Reply #2, on April 9th, 2012, 02:51 PM »
I wouldn't bother. We already converted most opendir to scandir for instance -- it only makes the code cooler. This is probably a case of simply adopting better functions when writing new code.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: SMF bug 4913 (convert fopen/fwrite to file_put_contents)
« Reply #4, on April 27th, 2012, 10:14 PM »
I did switch over the file cache today while I thought about it because it will solve the problems attached to using fwrite, making it more robust. The rest... *shrug* They're typically not cases for conversion, but I'll leave this open for now in case I can be bothered to go look.

Nao

  • Dadman with a boy
  • Posts: 16,082

live627

  • Should five per cent appear too small / Be thankful I don't take it all / 'Cause I'm the taxman, yeah I'm the taxman
  • Posts: 1,670
A confident man keeps quiet.whereas a frightened man keeps talking, hiding his fear.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278

live627

  • Should five per cent appear too small / Be thankful I don't take it all / 'Cause I'm the taxman, yeah I'm the taxman
  • Posts: 1,670

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: SMF bug 4913 (convert fopen/fwrite to file_put_contents)
« Reply #10, on September 25th, 2012, 02:03 AM »
Quick moderation and, really, the permissions in general haven't been tested out thoroughly, oops. But I'm pretty happy with it (I will, at some point also add a log of unsolved topics in the selected boards, but not today)