Add a safe migration mode to the wiki migrator.

The safe migrate mode can be invoked by setting the
safe_migrate environment variable to 'true' on the command
line when running the task.

`RAILS_ENV=production rake gitlab:wiki:migrate safe_migrate=true`

This branch was created off of the 5-0-stable branch. I am targeting that branch in this pull request as well.

This should fix issue #3312