do not write htaccess file if disk space is too low#41544
Conversation
|
/backport to stable27 |
|
Why? |
Because the file got truncated on @tobiasKaminsky's instance due to low disk space... |
| } | ||
| } | ||
| //suppress errors in case we don't have permissions for it | ||
| return (bool)@file_put_contents($setupHelper->pathToHtaccess(), $htaccessContent . $content . "\n"); |
There was a problem hiding this comment.
You can also check if all bytes have been written. Should be something like this:
| return (bool)@file_put_contents($setupHelper->pathToHtaccess(), $htaccessContent . $content . "\n"); | |
| $fullContent = $htaccessContent . $content . "\n"; | |
| return @file_put_contents($setupHelper->pathToHtaccess(), $$fullContent) === strlen($fullContent); |
There was a problem hiding this comment.
This is not going to help here. The prpblem is that file_pu_content truncates the file if there is not enough space which should never happen as the file is very important to work...
There was a problem hiding this comment.
We had the same prpblem with config.php before and fixed in in the same way.
There was a problem hiding this comment.
It's another security in case something happen during the copy.
The file will already be erased, but at least you'll have the info
Signed-off-by: Simon L <[email protected]>
Signed-off-by: Simon L <[email protected]>
99a3dc6 to
3f6caa4
Compare
I copied the logic from
server/lib/private/Config.php
Lines 288 to 295 in 1b18b97