The Scottish government has announced a moratorium on all planning consents for unconventional oil and gas extraction, including fracking.