Improve permission handling when using self-update

I replace the `file_get_content` by a `@copy + file_exists` to avoid to download the file twice.
I replace the rename by a `file_put_content` in case we have permission on the file and not on the directory
I detect common permission errors before starting the download

Fixes #5
`$tempDirectory` instead of `sys_get_temp_dir`