-
-
Notifications
You must be signed in to change notification settings - Fork 439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improvements to file storage. #127
Improvements to file storage. #127
Conversation
…esource. Updated get.php to not overwrite, but rather wait for shared lock before reading to avoid file-writing stampede or incomplete reads.
Thanks for the review guys, I have pushed a new commit to address issues you raised. I agree about the return value so reverted it back but also made some new changes. I believe this keeps 100% compatibility but the improvements to get.php should improve stability a lot. Explanation:
Also just spotted a completely pointless block of code which should have simply been "readfile()". Reading files line by line just to echo each line is frankly retarded; imagine an XML sitemap with 100k lines. Leaving proper buffering up to the php devs is definitely the way to go. |
Before you mention the use of the error suppression operator let me explain. :) Magento registers an error handler so if an error is raised Magento throws an exception or logs an error. Varien_Io_File also uses this operator so I was trying to remain consistent with it. Also, I did not want to modify the use of translated strings to add details to exception messages. Lastly, sometimes an error is expected or at least inconsequential so there is no need to litter logs with unimportant warnings. |
besides the true/false Iam ok with it now |
+1 |
@colinmollenhour shouldn't it be also merged to 1.9.3.x ? |
* saveFileToFilesystem returns void instead of bool in some cases. * fileExists loads entire file from database just to return a bool. * Use of Varien_Io_File seems pointless; deleting file before saving is also pointless. * fix multi-process concurrency issues in get.php. * use more efficient readfile() method to send files * avoid file-writing stampede or incomplete reads in get.php. * remove pointless use of fgets.
* saveFileToFilesystem returns void instead of bool in some cases. * fileExists loads entire file from database just to return a bool. * Use of Varien_Io_File seems pointless; deleting file before saving is also pointless. * fix multi-process concurrency issues in get.php. * use more efficient readfile() method to send files * avoid file-writing stampede or incomplete reads in get.php. * remove pointless use of fgets.
* saveFileToFilesystem returns void instead of bool in some cases. * fileExists loads entire file from database just to return a bool. * Use of Varien_Io_File seems pointless; deleting file before saving is also pointless. * fix multi-process concurrency issues in get.php. * use more efficient readfile() method to send files * avoid file-writing stampede or incomplete reads in get.php. * remove pointless use of fgets.
* saveFileToFilesystem returns void instead of bool in some cases. * fileExists loads entire file from database just to return a bool. * Use of Varien_Io_File seems pointless; deleting file before saving is also pointless. * fix multi-process concurrency issues in get.php. * use more efficient readfile() method to send files * avoid file-writing stampede or incomplete reads in get.php. * remove pointless use of fgets.
* saveFileToFilesystem returns void instead of bool in some cases. * fileExists loads entire file from database just to return a bool. * Use of Varien_Io_File seems pointless; deleting file before saving is also pointless. * fix multi-process concurrency issues in get.php. * use more efficient readfile() method to send files * avoid file-writing stampede or incomplete reads in get.php. * remove pointless use of fgets.
* saveFileToFilesystem returns void instead of bool in some cases. * fileExists loads entire file from database just to return a bool. * Use of Varien_Io_File seems pointless; deleting file before saving is also pointless. * fix multi-process concurrency issues in get.php. * use more efficient readfile() method to send files * avoid file-writing stampede or incomplete reads in get.php. * remove pointless use of fgets.
* saveFileToFilesystem returns void instead of bool in some cases. * fileExists loads entire file from database just to return a bool. * Use of Varien_Io_File seems pointless; deleting file before saving is also pointless. * fix multi-process concurrency issues in get.php. * use more efficient readfile() method to send files * avoid file-writing stampede or incomplete reads in get.php. * remove pointless use of fgets.
* saveFileToFilesystem returns void instead of bool in some cases. * fileExists loads entire file from database just to return a bool. * Use of Varien_Io_File seems pointless; deleting file before saving is also pointless. * fix multi-process concurrency issues in get.php. * use more efficient readfile() method to send files * avoid file-writing stampede or incomplete reads in get.php. * remove pointless use of fgets.
* saveFileToFilesystem returns void instead of bool in some cases. * fileExists loads entire file from database just to return a bool. * Use of Varien_Io_File seems pointless; deleting file before saving is also pointless. * fix multi-process concurrency issues in get.php. * use more efficient readfile() method to send files * avoid file-writing stampede or incomplete reads in get.php. * remove pointless use of fgets.
* saveFileToFilesystem returns void instead of bool in some cases. * fileExists loads entire file from database just to return a bool. * Use of Varien_Io_File seems pointless; deleting file before saving is also pointless. * fix multi-process concurrency issues in get.php. * use more efficient readfile() method to send files * avoid file-writing stampede or incomplete reads in get.php. * remove pointless use of fgets.
* saveFileToFilesystem returns void instead of bool in some cases. * fileExists loads entire file from database just to return a bool. * Use of Varien_Io_File seems pointless; deleting file before saving is also pointless. * fix multi-process concurrency issues in get.php. * use more efficient readfile() method to send files * avoid file-writing stampede or incomplete reads in get.php. * remove pointless use of fgets.
readfile()
method to send files