Return egg "done" checks as an array rather than a string
This commit is contained in:
parent
26704a2d5f
commit
164d6ef2e4
1 changed files with 19 additions and 1 deletions
|
@ -51,12 +51,30 @@ class EggConfigurationService
|
|||
);
|
||||
|
||||
return [
|
||||
'startup' => json_decode($server->egg->inherit_config_startup),
|
||||
'startup' => $this->convertStartupToNewFormat(json_decode($server->egg->inherit_config_startup, true)),
|
||||
'stop' => $this->convertStopToNewFormat($server->egg->inherit_config_stop),
|
||||
'configs' => $configs,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the "done" variable into an array if it is not currently one.
|
||||
*
|
||||
* @param array $startup
|
||||
* @return array
|
||||
*/
|
||||
protected function convertStartupToNewFormat(array $startup)
|
||||
{
|
||||
$done = Arr::get($startup, 'done');
|
||||
|
||||
return array_filter([
|
||||
'done' => is_string($done) ? [$done] : $done,
|
||||
'user_interaction' => Arr::get($startup, 'userInteraction'),
|
||||
], function ($datum) {
|
||||
return ! is_null($datum);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a legacy stop string into a new generation stop option for a server.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue