I noticed that the site status report always contains an entry from this module saying "Htaccess seems to be altered", even though it hasn't.
I tracked this down to the fact that the generated copy in the database contains CRLF line endings, whereas the deployed file contains standard Linux LF endings. The routine that checks if the file is altered (in htaccess.install) simply does a direct string comparison of the entire text, so the two are always unequal.
I presume the author originally wrote this for a Windows server, as the template file is shipped with CRLF line endings. Issue 2477759 - Carriage returns (^M) in deployed file attempted to deal with this, but in my view applied the fix in the wrong place. It converts CRLF to PHP_EOL (as well as removing any UTF8 BOM) when deploying the generated file, hence generated and deployed will be different.
It would be better if the EOL conversion were done during generation, then the generated text can be deployed unaltered.
I have fudged it temporarily on my sites by converting the template file to LF endings and re-generating htaccess, but it would be better in code.
I will try some code tweaks and posts a patch soon.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | htaccess-status-altered-2874432-3.patch | 5.91 KB | rickj |
Comments
Comment #2
rickj commentedHere's a patch that implements my suggestion. It applies all the munging before saving the generated copy, then deploys an exact copy of the database record.
I've also included a tweak to the admin page to identify the active profile, and remove the "delete" link from it.
Comment #3
rickj commentedOops, just realised the patch file I uploaded was malformed. Here's the corrected one.
Comment #4
wavesailor commentedWill this patch ever be added to the DEV release?