More singularization and correct file names.
This commit is contained in:
parent
8ba479e51f
commit
19d352619e
11 changed files with 17 additions and 17 deletions
|
@ -230,13 +230,13 @@ class ServerController extends Controller
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
$allocation = $server->allocations->pop();
|
$allocation = $server->allocations->pop();
|
||||||
$serverVariables = [
|
$ServerVariable = [
|
||||||
'{{SERVER_MEMORY}}' => $server->memory,
|
'{{SERVER_MEMORY}}' => $server->memory,
|
||||||
'{{SERVER_IP}}' => $allocation->ip,
|
'{{SERVER_IP}}' => $allocation->ip,
|
||||||
'{{SERVER_PORT}}' => $allocation->port,
|
'{{SERVER_PORT}}' => $allocation->port,
|
||||||
];
|
];
|
||||||
|
|
||||||
$processed = str_replace(array_keys($serverVariables), array_values($serverVariables), $server->startup);
|
$processed = str_replace(array_keys($ServerVariable), array_values($ServerVariable), $server->startup);
|
||||||
foreach ($variables as &$variable) {
|
foreach ($variables as &$variable) {
|
||||||
$replace = ($variable->user_viewable === 1) ? $variable->a_serverValue : '[hidden]';
|
$replace = ($variable->user_viewable === 1) ? $variable->a_serverValue : '[hidden]';
|
||||||
$processed = str_replace('{{' . $variable->env_variable . '}}', $replace, $processed);
|
$processed = str_replace('{{' . $variable->env_variable . '}}', $replace, $processed);
|
||||||
|
|
|
@ -263,7 +263,7 @@ class Server extends Model
|
||||||
*/
|
*/
|
||||||
public function variables()
|
public function variables()
|
||||||
{
|
{
|
||||||
return $this->hasMany(ServerVariables::class);
|
return $this->hasMany(ServerVariable::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace Pterodactyl\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class ServerVariables extends Model
|
class ServerVariable extends Model
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The table associated with the model.
|
* The table associated with the model.
|
|
@ -54,8 +54,8 @@ class ServiceVariable extends Model
|
||||||
'required' => 'integer',
|
'required' => 'integer',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function serverVariables()
|
public function ServerVariable()
|
||||||
{
|
{
|
||||||
return $this->hasMany(ServerVariables::class, 'variable_id');
|
return $this->hasMany(ServerVariable::class, 'variable_id');
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -288,7 +288,7 @@ class ServerRepository
|
||||||
foreach ($variableList as $item) {
|
foreach ($variableList as $item) {
|
||||||
$environmentVariables[$item['env']] = $item['val'];
|
$environmentVariables[$item['env']] = $item['val'];
|
||||||
|
|
||||||
Models\ServerVariables::create([
|
Models\ServerVariable::create([
|
||||||
'server_id' => $server->id,
|
'server_id' => $server->id,
|
||||||
'variable_id' => $item['id'],
|
'variable_id' => $item['id'],
|
||||||
'variable_value' => $item['val'],
|
'variable_value' => $item['val'],
|
||||||
|
@ -718,7 +718,7 @@ class ServerRepository
|
||||||
$environmentVariables[$item['env']] = $item['val'];
|
$environmentVariables[$item['env']] = $item['val'];
|
||||||
|
|
||||||
// Update model or make a new record if it doesn't exist.
|
// Update model or make a new record if it doesn't exist.
|
||||||
$model = Models\ServerVariables::firstOrNew([
|
$model = Models\ServerVariable::firstOrNew([
|
||||||
'variable_id' => $item['id'],
|
'variable_id' => $item['id'],
|
||||||
'server_id' => $server->id,
|
'server_id' => $server->id,
|
||||||
]);
|
]);
|
||||||
|
@ -787,7 +787,7 @@ class ServerRepository
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Remove Variables
|
// Remove Variables
|
||||||
Models\ServerVariables::where('server_id', $server->id)->delete();
|
Models\ServerVariable::where('server_id', $server->id)->delete();
|
||||||
|
|
||||||
// Remove Permissions (Foreign Key requires before Subusers)
|
// Remove Permissions (Foreign Key requires before Subusers)
|
||||||
Models\Permission::where('server_id', $server->id)->delete();
|
Models\Permission::where('server_id', $server->id)->delete();
|
||||||
|
|
|
@ -76,11 +76,11 @@ class Variable
|
||||||
|
|
||||||
public function delete($id)
|
public function delete($id)
|
||||||
{
|
{
|
||||||
$variable = Models\ServiceVariable::with('serverVariables')->findOrFail($id);
|
$variable = Models\ServiceVariable::with('ServerVariable')->findOrFail($id);
|
||||||
|
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
try {
|
try {
|
||||||
foreach ($variable->serverVariables as $svar) {
|
foreach ($variable->ServerVariable as $svar) {
|
||||||
$svar->delete();
|
$svar->delete();
|
||||||
}
|
}
|
||||||
$variable->delete();
|
$variable->delete();
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
class AddServerVariables extends Migration
|
class AddServerVariable extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
|
|
|
@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
class AddForeignServerVariables extends Migration
|
class AddForeignServerVariable extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
|
|
2
public/js/vendor/ace/mode-vbscript.js
vendored
2
public/js/vendor/ace/mode-vbscript.js
vendored
File diff suppressed because one or more lines are too long
|
@ -248,7 +248,7 @@
|
||||||
<div class="alert alert-info">Some service options have additional environment variables that you can define for a given instance. They will show up below when you select a service option. If none show up, chances are that none were defined, and there is nothing to worry about.</div>
|
<div class="alert alert-info">Some service options have additional environment variables that you can define for a given instance. They will show up below when you select a service option. If none show up, chances are that none were defined, and there is nothing to worry about.</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row" id="serverVariables"></div>
|
<div class="row" id="ServerVariable"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="well">
|
<div class="well">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -431,7 +431,7 @@ $(document).ready(function () {
|
||||||
|
|
||||||
handleLoader('#load_services', true);
|
handleLoader('#load_services', true);
|
||||||
handleLoader('#ServiceOption', true);
|
handleLoader('#ServiceOption', true);
|
||||||
$('#serverVariables').html('');
|
$('#ServerVariable').html('');
|
||||||
$('input[name="custom_image_name"]').val($(this).find(':selected').data('image'));
|
$('input[name="custom_image_name"]').val($(this).find(':selected').data('image'));
|
||||||
$('#getPack').html('<option disabled selected> -- Select a Service Pack</option>');
|
$('#getPack').html('<option disabled selected> -- Select a Service Pack</option>');
|
||||||
|
|
||||||
|
@ -466,7 +466,7 @@ $(document).ready(function () {
|
||||||
</div>\
|
</div>\
|
||||||
</div>\
|
</div>\
|
||||||
';
|
';
|
||||||
$('#serverVariables').append(dataAppend);
|
$('#ServerVariable').append(dataAppend);
|
||||||
});
|
});
|
||||||
$('#ServiceOption').slideDown();
|
$('#ServiceOption').slideDown();
|
||||||
}).fail(function (jqXHR) {
|
}).fail(function (jqXHR) {
|
||||||
|
|
Loading…
Reference in a new issue