wp-cli/wp-cli — pull request #1023 by francescolaffi (2014-02-17 18:28:01+00:00)
Title: fix wp rewrite flush --hard doesn't generate .htaccess

I stumbled in a server using apache and experienced #790 bug, this should fix it.

The problem is that `get_home_path()` uses `$_SERVER['SCRIPT_FILENAME']` that is not available and so the resulting location would be `/.htaccess`

This PR only fills the global variable when its actually needed for the .htaccess, however the same fix could be needed in other functionalities that use `get_home_path()` and it might be appropriate to apply it in wp-cli bootstrap (faking an actual file), but I'll leave this consideration to wp-cli maintainers.

It also looks like that `get_home_path()` doesn't need `$_SERVER['SCRIPT_FILENAME']` at all and it could just use `ABSPATH` to be more cli friendly, I'll make a note to report it upstream on the trac.