1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-10-27 04:12:28 +01:00

More singularization and correct file names.

This commit is contained in:
Dane Everitt 2017-02-12 16:03:17 -05:00
parent 8ba479e51f
commit 19d352619e
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
11 changed files with 17 additions and 17 deletions

View File

@ -230,13 +230,13 @@ class ServerController extends Controller
->first();
$allocation = $server->allocations->pop();
$serverVariables = [
$ServerVariable = [
'{{SERVER_MEMORY}}' => $server->memory,
'{{SERVER_IP}}' => $allocation->ip,
'{{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) {
$replace = ($variable->user_viewable === 1) ? $variable->a_serverValue : '[hidden]';
$processed = str_replace('{{' . $variable->env_variable . '}}', $replace, $processed);

View File

@ -263,7 +263,7 @@ class Server extends Model
*/
public function variables()
{
return $this->hasMany(ServerVariables::class);
return $this->hasMany(ServerVariable::class);
}
/**

View File

@ -26,7 +26,7 @@ namespace Pterodactyl\Models;
use Illuminate\Database\Eloquent\Model;
class ServerVariables extends Model
class ServerVariable extends Model
{
/**
* The table associated with the model.

View File

@ -54,8 +54,8 @@ class ServiceVariable extends Model
'required' => 'integer',
];
public function serverVariables()
public function ServerVariable()
{
return $this->hasMany(ServerVariables::class, 'variable_id');
return $this->hasMany(ServerVariable::class, 'variable_id');
}
}

View File

@ -288,7 +288,7 @@ class ServerRepository
foreach ($variableList as $item) {
$environmentVariables[$item['env']] = $item['val'];
Models\ServerVariables::create([
Models\ServerVariable::create([
'server_id' => $server->id,
'variable_id' => $item['id'],
'variable_value' => $item['val'],
@ -718,7 +718,7 @@ class ServerRepository
$environmentVariables[$item['env']] = $item['val'];
// Update model or make a new record if it doesn't exist.
$model = Models\ServerVariables::firstOrNew([
$model = Models\ServerVariable::firstOrNew([
'variable_id' => $item['id'],
'server_id' => $server->id,
]);
@ -787,7 +787,7 @@ class ServerRepository
]);
// 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)
Models\Permission::where('server_id', $server->id)->delete();

View File

@ -76,11 +76,11 @@ class Variable
public function delete($id)
{
$variable = Models\ServiceVariable::with('serverVariables')->findOrFail($id);
$variable = Models\ServiceVariable::with('ServerVariable')->findOrFail($id);
DB::beginTransaction();
try {
foreach ($variable->serverVariables as $svar) {
foreach ($variable->ServerVariable as $svar) {
$svar->delete();
}
$variable->delete();

View File

@ -3,7 +3,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddServerVariables extends Migration
class AddServerVariable extends Migration
{
/**
* Run the migrations.

View File

@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddForeignServerVariables extends Migration
class AddForeignServerVariable extends Migration
{
/**
* Run the migrations.

File diff suppressed because one or more lines are too long

View File

@ -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>
</div>
<div class="row" id="serverVariables"></div>
<div class="row" id="ServerVariable"></div>
</div>
<div class="well">
<div class="row">
@ -431,7 +431,7 @@ $(document).ready(function () {
handleLoader('#load_services', true);
handleLoader('#ServiceOption', true);
$('#serverVariables').html('');
$('#ServerVariable').html('');
$('input[name="custom_image_name"]').val($(this).find(':selected').data('image'));
$('#getPack').html('<option disabled selected> -- Select a Service Pack</option>');
@ -466,7 +466,7 @@ $(document).ready(function () {
</div>\
</div>\
';
$('#serverVariables').append(dataAppend);
$('#ServerVariable').append(dataAppend);
});
$('#ServiceOption').slideDown();
}).fail(function (jqXHR) {