2017-03-11 00:25:12 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Pterodactyl - Panel
|
|
|
|
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
|
|
|
|
*
|
2017-09-26 04:43:01 +02:00
|
|
|
* This software is licensed under the terms of the MIT license.
|
|
|
|
* https://opensource.org/licenses/MIT
|
2017-03-11 00:25:12 +01:00
|
|
|
*/
|
|
|
|
use Pterodactyl\Models\Service;
|
|
|
|
use Pterodactyl\Models\ServiceOption;
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
|
|
|
|
class MigrateToNewServiceSystem extends Migration
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Run the migrations.
|
|
|
|
*/
|
|
|
|
public function up()
|
|
|
|
{
|
2017-03-12 23:26:36 +01:00
|
|
|
DB::transaction(function () {
|
|
|
|
$service = Service::where('author', config('pterodactyl.service.core'))->where('folder', 'srcds')->first();
|
|
|
|
if (! $service) {
|
|
|
|
return;
|
2017-03-12 23:05:30 +01:00
|
|
|
}
|
2017-03-12 23:26:36 +01:00
|
|
|
|
|
|
|
$options = ServiceOption::where('service_id', $service->id)->get();
|
|
|
|
$options->each(function ($item) use ($options) {
|
|
|
|
if ($item->tag === 'srcds' && $item->name === 'Insurgency') {
|
|
|
|
$item->tag = 'insurgency';
|
|
|
|
} elseif ($item->tag === 'srcds' && $item->name === 'Team Fortress 2') {
|
|
|
|
$item->tag = 'tf2';
|
|
|
|
} elseif ($item->tag === 'srcds' && $item->name === 'Custom Source Engine Game') {
|
|
|
|
$item->tag = 'source';
|
|
|
|
}
|
2017-03-18 18:53:22 +01:00
|
|
|
$item->save();
|
2017-03-12 23:26:36 +01:00
|
|
|
});
|
2017-03-12 23:05:30 +01:00
|
|
|
});
|
2017-03-11 00:25:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverse the migrations.
|
|
|
|
*/
|
|
|
|
public function down()
|
|
|
|
{
|
|
|
|
// Not doing reversals right now...
|
|
|
|
}
|
|
|
|
}
|