Backup the .env during update

This commit is contained in:
Hillel Coren 2017-03-29 18:19:51 +03:00
parent 5ee474035a
commit 7e28e0f77e

View File

@ -191,7 +191,9 @@ class AppController extends BaseController
$config .= "{$key}={$val}\n"; $config .= "{$key}={$val}\n";
} }
$fp = fopen(base_path().'/.env', 'w'); $filePath = base_path().'/.env';
copy($filePath, $filePath . '.backup.' . time());
$fp = fopen($filePath, 'w');
fwrite($fp, $config); fwrite($fp, $config);
fclose($fp); fclose($fp);