Try to automatically quote strings.
Incredibly basic checking, only checks if there is a space and no quote character. Also includes comments on edited lines to avoid users changing things that get overwritten again later.
This commit is contained in:
parent
30b4934013
commit
e4c341795d
|
@ -12,6 +12,9 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
|
||||||
* Added ability to reinstall a server using the currently assigned service and option.
|
* Added ability to reinstall a server using the currently assigned service and option.
|
||||||
* Added ability to change a server's service and service option, as well as change pack assignments and other management services in that regard.
|
* Added ability to change a server's service and service option, as well as change pack assignments and other management services in that regard.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
* Environment setting commands now attempt to auto-quote strings with spaces in them, as well as comment lines that are edited to avoid manual changes being overwritten.
|
||||||
|
|
||||||
## v0.6.0-beta.2.1 (Courageous Carniadactylus)
|
## v0.6.0-beta.2.1 (Courageous Carniadactylus)
|
||||||
### Fixed
|
### Fixed
|
||||||
* `[beta.2]` — Suspended servers now show as suspended.
|
* `[beta.2]` — Suspended servers now show as suspended.
|
||||||
|
|
|
@ -147,7 +147,10 @@ class UpdateEmailSettings extends Command
|
||||||
|
|
||||||
$this->line('Writing new email environment configuration to file.');
|
$this->line('Writing new email environment configuration to file.');
|
||||||
foreach ($variables as $key => $value) {
|
foreach ($variables as $key => $value) {
|
||||||
$newValue = $key . '=' . $value;
|
if (str_contains($value, ' ') && ! str_contains($value, '"')) {
|
||||||
|
$value = '"' . $value . '"';
|
||||||
|
}
|
||||||
|
$newValue = $key . '=' . $value . ' # DO NOT EDIT! set using pterodactyl:mail';
|
||||||
|
|
||||||
if (preg_match_all('/^' . $key . '=(.*)$/m', $envContents) < 1) {
|
if (preg_match_all('/^' . $key . '=(.*)$/m', $envContents) < 1) {
|
||||||
$envContents = $envContents . "\n" . $newValue;
|
$envContents = $envContents . "\n" . $newValue;
|
||||||
|
|
|
@ -186,7 +186,10 @@ class UpdateEnvironment extends Command
|
||||||
$bar = $this->output->createProgressBar(count($variables));
|
$bar = $this->output->createProgressBar(count($variables));
|
||||||
|
|
||||||
foreach ($variables as $key => $value) {
|
foreach ($variables as $key => $value) {
|
||||||
$newValue = $key . '=' . $value;
|
if (str_contains($value, ' ') && ! str_contains($value, '"')) {
|
||||||
|
$value = '"' . $value . '"';
|
||||||
|
}
|
||||||
|
$newValue = $key . '=' . $value . ' # DO NOT EDIT! set using pterodactyl:env';
|
||||||
|
|
||||||
if (preg_match_all('/^' . $key . '=(.*)$/m', $envContents) < 1) {
|
if (preg_match_all('/^' . $key . '=(.*)$/m', $envContents) < 1) {
|
||||||
$envContents = $envContents . "\n" . $newValue;
|
$envContents = $envContents . "\n" . $newValue;
|
||||||
|
|
Loading…
Reference in New Issue