flush_rewrite_rules() completely overwrites .htaccess
|Reported by:||rulatir||Owned by:|
A call to flush_rewrite_rules(true) does a very unexpected and potentially destructive thing: it completely overwrites .htaccess.
While this probably isn't stated outright anywhere in the docs, the presence of the BEGIN/END delimiters yields a strong impression that it is safe to add directives to .htaccess outside the delimited Wordpress section.
If overwriting the whole .htaccess is by design and not a bug, then the format of generated .htaccess should be changed. Instead of the BEGIN/END comments misleading the developer into thinking that directives outside of that section will be preserved, it should contain an EXPLICIT STERN WARNING that the file is auto-generated and all changes made to it will be lost.