Wedge

Public area => Bug reports => The Pub => Archived fixes => Topic started by: Arantor on March 1st, 2012, 10:18 AM

Title: SMF bug 4913 (convert fopen/fwrite to file_put_contents)
Post by: Arantor 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.
Title: Re: SMF bug 4913 (convert fopen/fwrite to file_put_contents)
Post by: Arantor 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)
Title: Re: SMF bug 4913 (convert fopen/fwrite to file_put_contents)
Post by: Nao 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.
Title: Re: SMF bug 4913 (convert fopen/fwrite to file_put_contents)
Post by: Arantor on April 9th, 2012, 02:57 PM
Well, I did a cursory search and most of the places that might possibly be candidates fall into my other case anyway...
Title: Re: SMF bug 4913 (convert fopen/fwrite to file_put_contents)
Post by: Arantor 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.
Title: Re: SMF bug 4913 (convert fopen/fwrite to file_put_contents)
Post by: Arantor on September 24th, 2012, 01:22 PM
I've done a few more, most of the remaining fwrites are socket related, there's a few interesting uses I can't be bothered at this stage to fix, though.
Title: Re: SMF bug 4913 (convert fopen/fwrite to file_put_contents)
Post by: Nao on September 24th, 2012, 02:41 PM
Hey, a good opportunity to try that Topic Solved plugin... :lol:
Title: Re: SMF bug 4913 (convert fopen/fwrite to file_put_contents)
Post by: live627 on September 25th, 2012, 12:43 AM
Should the green topic solved indicator obey permissions as well? I can see it but not the button...
Title: Re: SMF bug 4913 (convert fopen/fwrite to file_put_contents)
Post by: Arantor on September 25th, 2012, 01:06 AM
No, the indicator is deliberately designed to be shown regardless - to let people know it's solved even if they can't mark it solved themselves.

(It's in the plugins repo... :whistle:)
Title: Re: SMF bug 4913 (convert fopen/fwrite to file_put_contents)
Post by: live627 on September 25th, 2012, 01:56 AM
Quote
(It's in the plugins repo... :whistle:)
I saw it there, will have to check it out :)
Title: Re: SMF bug 4913 (convert fopen/fwrite to file_put_contents)
Post by: Arantor 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)