File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -113,11 +113,14 @@ private function updateEnvFile()
113113 # Get the env file.
114114 $ envFile = ROOTPATH . '.env ' ;
115115
116+ # For backup.
117+ $ backupFile = '-BACKUP- ' . time ();
118+
116119 # Does exist? if not, generate it =)
117120 if (is_file ($ envFile ))
118121 {
119122 # But first, let's take a backup.
120- copy ($ envFile , $ envFile . ' BACKUP- ' . time () );
123+ copy ($ envFile , $ envFile . $ backupFile );
121124
122125 # Get .env.default content
123126 $ content = file_get_contents ($ this ->path . 'Config/env.default ' );
@@ -131,6 +134,11 @@ private function updateEnvFile()
131134 copy ($ this ->path . 'Config/env.default ' , ROOTPATH . '.env ' );
132135 }
133136
137+ # set the backup file.
138+ $ envContent = file_get_contents (ROOTPATH . '.env ' );
139+ $ backupUpdate = str_replace ('VITE_BACKUP_FILE= ' , "VITE_BACKUP_FILE=' $ backupFile' " , $ envContent );
140+ file_put_contents ($ envFile , $ backupUpdate );
141+
134142 # Define framework.
135143 if ($ this ->framework !== 'none ' )
136144 {
Original file line number Diff line number Diff line change @@ -9,3 +9,4 @@ VITE_BUILD_DIR= 'build'
99VITE_ENTRY_FILE='main.js'
1010VITE_RESOURCES_DIR='resources'
1111VITE_FRAMEWORK='none'
12+ VITE_BACKUP_FILE=
You can’t perform that action at this time.
0 commit comments