Update ImportCities command, check for corrupt or invalid checksum

This commit is contained in:
Daniel Supernault 2019-08-15 21:54:50 -06:00
parent 450602cbeb
commit ea023fcf17
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -60,6 +60,15 @@ class ImportCities extends Command
public function handle()
{
$path = storage_path('app/cities.json');
if(hash_file('sha512', $path) !== 'e203c0247538788b2a91166c7cf4b95f58291d998f514e9306d315aa72b09e48bfd3ddf310bf737afc4eefadca9083b8ff796c67796c6bd8e882a3d268bd16af') {
$this->error('Invalid or corrupt storage/app/cities.json data.');
$this->line('');
$this->info('Run the following command to fix:');
$this->info('git checkout storage/app/cities.json');
return;
}
if (!is_file($path)) {
$this->error('Missing storage/app/cities.json file!');
return;