2017-03-10 23:25:12 +00:00
|
|
|
<?php
|
|
|
|
|
2017-03-18 17:45:38 +00:00
|
|
|
use Pterodactyl\Models\ServiceOption;
|
2017-03-10 23:25:12 +00:00
|
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
|
|
|
|
class DeleteServiceExecutableOption extends Migration
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Run the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function up()
|
|
|
|
{
|
2017-03-12 22:26:36 +00:00
|
|
|
DB::transaction(function () {
|
|
|
|
// Attempt to fix any startup commands for servers
|
2017-03-18 18:49:48 +00:00
|
|
|
// that we possibly can. Also set new containers.
|
2017-03-12 22:26:36 +00:00
|
|
|
foreach (ServiceOption::with('servers')->get() as $option) {
|
|
|
|
$option->servers->each(function ($s) use ($option) {
|
|
|
|
$prepend = $option->display_executable;
|
|
|
|
$prepend = ($prepend === './ShooterGameServer') ? './ShooterGame/Binaries/Linux/ShooterGameServer' : $prepend;
|
|
|
|
$prepend = ($prepend === 'TerrariaServer.exe') ? 'mono TerrariaServer.exe' : $prepend;
|
|
|
|
|
|
|
|
$s->startup = $prepend . ' ' . $s->startup;
|
2017-03-18 18:49:48 +00:00
|
|
|
|
|
|
|
$container = $s->container;
|
|
|
|
if (starts_with($container, 'quay.io/pterodactyl/minecraft')) {
|
|
|
|
$s->container = 'quay.io/pterodactyl/core:java';
|
|
|
|
} elseif (starts_with($container, 'quay.io/pterodactyl/srcds')) {
|
|
|
|
$s->container = 'quay.io/pterodactyl/core:source';
|
|
|
|
} elseif (starts_with($container, 'quay.io/pterodactyl/voice')) {
|
|
|
|
$s->container = 'quay.io/pterodactyl/core:glibc';
|
|
|
|
} elseif (starts_with($container, 'quay.io/pterodactyl/terraria')) {
|
|
|
|
$s->container = 'quay.io/pterodactyl/core:mono'
|
|
|
|
}
|
|
|
|
|
2017-03-12 22:26:36 +00:00
|
|
|
$s->save();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
Schema::table('services', function (Blueprint $table) {
|
2017-03-18 17:45:38 +00:00
|
|
|
$table->renameColumn('file', 'folder');
|
2017-03-12 22:26:36 +00:00
|
|
|
$table->dropColumn('executable');
|
2017-03-18 17:45:38 +00:00
|
|
|
$table->text('description')->nullable()->change();
|
|
|
|
$table->text('startup')->nullable()->change();
|
2017-03-12 22:26:36 +00:00
|
|
|
});
|
2017-03-10 23:25:12 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverse the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function down()
|
|
|
|
{
|
|
|
|
Schema::table('services', function (Blueprint $table) {
|
|
|
|
$table->string('executable')->after('folder');
|
|
|
|
$table->renameColumn('folder', 'file');
|
|
|
|
$table->text('description')->nullable(false)->change();
|
|
|
|
$table->text('startup')->nullable(false)->change();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|