@@ 149-161 (lines=13) @@ | ||
146 | $bar = $this->output->createProgressBar(count($variables)); |
|
147 | ||
148 | $this->line('Writing new email environment configuration to file.'); |
|
149 | foreach ($variables as $key => $value) { |
|
150 | if (str_contains($value, ' ') && ! str_contains($value, '"')) { |
|
151 | $value = '"' . $value . '"'; |
|
152 | } |
|
153 | $newValue = $key . '=' . $value . ' # DO NOT EDIT! set using pterodactyl:mail'; |
|
154 | ||
155 | if (preg_match_all('/^' . $key . '=(.*)$/m', $envContents) < 1) { |
|
156 | $envContents = $envContents . "\n" . $newValue; |
|
157 | } else { |
|
158 | $envContents = preg_replace('/^' . $key . '=(.*)$/m', $newValue, $envContents); |
|
159 | } |
|
160 | $bar->advance(); |
|
161 | } |
|
162 | ||
163 | file_put_contents($file, $envContents); |
|
164 | $bar->finish(); |
@@ 188-200 (lines=13) @@ | ||
185 | ||
186 | $bar = $this->output->createProgressBar(count($variables)); |
|
187 | ||
188 | foreach ($variables as $key => $value) { |
|
189 | if (str_contains($value, ' ') && ! str_contains($value, '"')) { |
|
190 | $value = '"' . $value . '"'; |
|
191 | } |
|
192 | $newValue = $key . '=' . $value . ' # DO NOT EDIT! set using pterodactyl:env'; |
|
193 | ||
194 | if (preg_match_all('/^' . $key . '=(.*)$/m', $envContents) < 1) { |
|
195 | $envContents = $envContents . "\n" . $newValue; |
|
196 | } else { |
|
197 | $envContents = preg_replace('/^' . $key . '=(.*)$/m', $newValue, $envContents); |
|
198 | } |
|
199 | $bar->advance(); |
|
200 | } |
|
201 | ||
202 | file_put_contents($file, $envContents); |
|
203 | $bar->finish(); |