Skip to content

Commit 5839034

Browse files
committed
Fix egg copy from, closes pterodactyl#995
1 parent 4952a27 commit 5839034

File tree

2 files changed

+36
-7
lines changed

2 files changed

+36
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
77
### Fixed
88
* Fixes a UI error when attempting to change the default Nest and Egg for an existing server.
99
* Correct permissions check in UI to allow subusers with permission to `view-allocations` the ability to actually see the sidebar link.
10+
* Fixes improper behavior when marking an egg as copying the configuration from another.
1011

1112
### Changed
1213
* Panel now throws proper 504: Gateway Timeout errors on server listing when daemon is offline.

app/Models/Egg.php

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,11 @@ class Egg extends Model implements CleansAttributes, ValidableContract
113113
*/
114114
public function getCopyScriptInstallAttribute()
115115
{
116-
return (is_null($this->copy_script_from)) ? $this->script_install : $this->scriptFrom->script_install;
116+
if (! is_null($this->script_install) || is_null($this->copy_script_from)) {
117+
return $this->script_install;
118+
}
119+
120+
return $this->scriptFrom->script_install;
117121
}
118122

119123
/**
@@ -124,7 +128,11 @@ public function getCopyScriptInstallAttribute()
124128
*/
125129
public function getCopyScriptEntryAttribute()
126130
{
127-
return (is_null($this->copy_script_from)) ? $this->script_entry : $this->scriptFrom->script_entry;
131+
if (! is_null($this->script_entry) || is_null($this->copy_script_from)) {
132+
return $this->script_entry;
133+
}
134+
135+
return $this->scriptFrom->script_entry;
128136
}
129137

130138
/**
@@ -135,7 +143,11 @@ public function getCopyScriptEntryAttribute()
135143
*/
136144
public function getCopyScriptContainerAttribute()
137145
{
138-
return (is_null($this->copy_script_from)) ? $this->script_container : $this->scriptFrom->script_container;
146+
if (! is_null($this->script_container) || is_null($this->copy_script_from)) {
147+
return $this->script_container;
148+
}
149+
150+
return $this->scriptFrom->script_container;
139151
}
140152

141153
/**
@@ -145,7 +157,11 @@ public function getCopyScriptContainerAttribute()
145157
*/
146158
public function getInheritConfigFilesAttribute()
147159
{
148-
return is_null($this->config_from) ? $this->config_files : $this->configFrom->config_files;
160+
if (! is_null($this->config_files) || is_null($this->config_from)) {
161+
return $this->config_files;
162+
}
163+
164+
return $this->configFrom->config_files;
149165
}
150166

151167
/**
@@ -155,7 +171,11 @@ public function getInheritConfigFilesAttribute()
155171
*/
156172
public function getInheritConfigStartupAttribute()
157173
{
158-
return is_null($this->config_from) ? $this->config_startup : $this->configFrom->config_startup;
174+
if (! is_null($this->config_startup) || is_null($this->config_from)) {
175+
return $this->config_startup;
176+
}
177+
178+
return $this->configFrom->config_startup;
159179
}
160180

161181
/**
@@ -165,7 +185,11 @@ public function getInheritConfigStartupAttribute()
165185
*/
166186
public function getInheritConfigLogsAttribute()
167187
{
168-
return is_null($this->config_from) ? $this->config_logs : $this->configFrom->config_logs;
188+
if (! is_null($this->config_logs) || is_null($this->config_from)) {
189+
return $this->config_logs;
190+
}
191+
192+
return $this->configFrom->config_logs;
169193
}
170194

171195
/**
@@ -175,7 +199,11 @@ public function getInheritConfigLogsAttribute()
175199
*/
176200
public function getInheritConfigStopAttribute()
177201
{
178-
return is_null($this->config_from) ? $this->config_stop : $this->configFrom->config_stop;
202+
if (! is_null($this->config_stop) || is_null($this->config_from)) {
203+
return $this->config_stop;
204+
}
205+
206+
return $this->configFrom->config_stop;
179207
}
180208

181209
/**

0 commit comments

Comments
 (0)