Smarter logic for dealing with the writeability of settings.php