Update to Laravel 8
Co-authored-by: Matthew Penner <me@matthewp.io>
This commit is contained in:
parent
028921b42a
commit
a043071e3c
211 changed files with 4394 additions and 2933 deletions
29
database/Factories/AllocationFactory.php
Normal file
29
database/Factories/AllocationFactory.php
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Pterodactyl\Models\Allocation;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class AllocationFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Allocation::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'ip' => $this->faker->ipv4,
|
||||
'port' => $this->faker->randomNumber(5),
|
||||
];
|
||||
}
|
||||
}
|
38
database/Factories/ApiKeyFactory.php
Normal file
38
database/Factories/ApiKeyFactory.php
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Str;
|
||||
use Pterodactyl\Models\ApiKey;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class ApiKeyFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = ApiKey::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
static $token;
|
||||
|
||||
return [
|
||||
'key_type' => ApiKey::TYPE_APPLICATION,
|
||||
'identifier' => Str::random(\Pterodactyl\Models\ApiKey::IDENTIFIER_LENGTH),
|
||||
'token' => $token ?: $token = encrypt(Str::random(\Pterodactyl\Models\ApiKey::KEY_LENGTH)),
|
||||
'allowed_ips' => null,
|
||||
'memo' => 'Test Function Key',
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
];
|
||||
}
|
||||
}
|
32
database/Factories/BackupFactory.php
Normal file
32
database/Factories/BackupFactory.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Pterodactyl\Models\Backup;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class BackupFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Backup::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'uuid' => Uuid::uuid4()->toString(),
|
||||
'is_successful' => true,
|
||||
'name' => $this->faker->sentence,
|
||||
'disk' => Backup::ADAPTER_WINGS,
|
||||
];
|
||||
}
|
||||
}
|
37
database/Factories/DatabaseFactory.php
Normal file
37
database/Factories/DatabaseFactory.php
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Str;
|
||||
use Pterodactyl\Models\Database;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class DatabaseFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Database::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
static $password;
|
||||
|
||||
return [
|
||||
'database' => Str::random(10),
|
||||
'username' => Str::random(10),
|
||||
'remote' => '%',
|
||||
'password' => $password ?: encrypt('test123'),
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
];
|
||||
}
|
||||
}
|
33
database/Factories/DatabaseHostFactory.php
Normal file
33
database/Factories/DatabaseHostFactory.php
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Pterodactyl\Models\DatabaseHost;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class DatabaseHostFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = DatabaseHost::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->colorName,
|
||||
'host' => $this->faker->unique()->ipv4,
|
||||
'port' => 3306,
|
||||
'username' => $this->faker->colorName,
|
||||
'password' => Crypt::encrypt($this->faker->word),
|
||||
];
|
||||
}
|
||||
}
|
32
database/Factories/EggFactory.php
Normal file
32
database/Factories/EggFactory.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Pterodactyl\Models\Egg;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class EggFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Egg::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'uuid' => Uuid::uuid4()->toString(),
|
||||
'name' => $this->faker->name,
|
||||
'description' => implode(' ', $this->faker->sentences()),
|
||||
'startup' => 'java -jar test.jar',
|
||||
];
|
||||
}
|
||||
}
|
63
database/Factories/EggVariableFactory.php
Normal file
63
database/Factories/EggVariableFactory.php
Normal file
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Pterodactyl\Models\EggVariable;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class EggVariableFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = EggVariable::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->firstName,
|
||||
'description' => $this->faker->sentence(),
|
||||
'env_variable' => Str::upper(Str::replaceArray(' ', ['_'], $this->faker->words(2, true))),
|
||||
'default_value' => $this->faker->colorName,
|
||||
'user_viewable' => 0,
|
||||
'user_editable' => 0,
|
||||
'rules' => 'required|string',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the egg variable is viewable.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Factories\Factory
|
||||
*/
|
||||
public function viewable(): Factory
|
||||
{
|
||||
return $this->state(function (array $attributes) {
|
||||
return [
|
||||
'user_viewable' => 1,
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the egg variable is editable.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Factories\Factory
|
||||
*/
|
||||
public function editable(): Factory
|
||||
{
|
||||
return $this->state(function (array $attributes) {
|
||||
return [
|
||||
'user_editable' => 1,
|
||||
];
|
||||
});
|
||||
}
|
||||
}
|
30
database/Factories/LocationFactory.php
Normal file
30
database/Factories/LocationFactory.php
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Pterodactyl\Models\Location;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class LocationFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Location::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'short' => Str::random(8),
|
||||
'long' => Str::random(32),
|
||||
];
|
||||
}
|
||||
}
|
32
database/Factories/NestFactory.php
Normal file
32
database/Factories/NestFactory.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Pterodactyl\Models\Nest;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class NestFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Nest::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'uuid' => Uuid::uuid4()->toString(),
|
||||
'author' => 'testauthor@example.com',
|
||||
'name' => $this->faker->word,
|
||||
'description' => null,
|
||||
];
|
||||
}
|
||||
}
|
46
database/Factories/NodeFactory.php
Normal file
46
database/Factories/NodeFactory.php
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Illuminate\Support\Str;
|
||||
use Pterodactyl\Models\Node;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class NodeFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Node::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'uuid' => Uuid::uuid4()->toString(),
|
||||
'public' => true,
|
||||
'name' => $this->faker->firstName,
|
||||
'fqdn' => $this->faker->ipv4,
|
||||
'scheme' => 'http',
|
||||
'behind_proxy' => false,
|
||||
'memory' => 1024,
|
||||
'memory_overallocate' => 0,
|
||||
'disk' => 10240,
|
||||
'disk_overallocate' => 0,
|
||||
'upload_size' => 100,
|
||||
'daemon_token_id' => Str::random(Node::DAEMON_TOKEN_ID_LENGTH),
|
||||
'daemon_token' => Crypt::encrypt(Str::random(Node::DAEMON_TOKEN_LENGTH)),
|
||||
'daemonListen' => 8080,
|
||||
'daemonSFTP' => 2022,
|
||||
'daemonBase' => '/var/lib/pterodactyl/volumes',
|
||||
];
|
||||
}
|
||||
}
|
28
database/Factories/ScheduleFactory.php
Normal file
28
database/Factories/ScheduleFactory.php
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Pterodactyl\Models\Schedule;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class ScheduleFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Schedule::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->firstName(),
|
||||
];
|
||||
}
|
||||
}
|
48
database/Factories/ServerFactory.php
Normal file
48
database/Factories/ServerFactory.php
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Illuminate\Support\Str;
|
||||
use Pterodactyl\Models\Server;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class ServerFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Server::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'uuid' => Uuid::uuid4()->toString(),
|
||||
'uuidShort' => Str::lower(Str::random(8)),
|
||||
'name' => $this->faker->firstName,
|
||||
'description' => implode(' ', $this->faker->sentences()),
|
||||
'skip_scripts' => 0,
|
||||
'suspended' => 0,
|
||||
'memory' => 512,
|
||||
'swap' => 0,
|
||||
'disk' => 512,
|
||||
'io' => 500,
|
||||
'cpu' => 0,
|
||||
'threads' => null,
|
||||
'oom_disabled' => 0,
|
||||
'installed' => 1,
|
||||
'allocation_limit' => null,
|
||||
'database_limit' => null,
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
];
|
||||
}
|
||||
}
|
31
database/Factories/SubuserFactory.php
Normal file
31
database/Factories/SubuserFactory.php
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Pterodactyl\Models\Subuser;
|
||||
use Pterodactyl\Models\Permission;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class SubuserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Subuser::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'permissions' => [
|
||||
Permission::ACTION_WEBSOCKET_CONNECT,
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
32
database/Factories/TaskFactory.php
Normal file
32
database/Factories/TaskFactory.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Pterodactyl\Models\Task;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class TaskFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Task::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'sequence_id' => $this->faker->randomNumber(1),
|
||||
'action' => 'command',
|
||||
'payload' => 'test command',
|
||||
'time_offset' => 120,
|
||||
'is_queued' => false,
|
||||
];
|
||||
}
|
||||
}
|
57
database/Factories/UserFactory.php
Normal file
57
database/Factories/UserFactory.php
Normal file
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Pterodactyl\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = User::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
static $password;
|
||||
|
||||
return [
|
||||
'external_id' => $this->faker->unique()->isbn10,
|
||||
'uuid' => Uuid::uuid4()->toString(),
|
||||
'username' => $this->faker->userName,
|
||||
'email' => $this->faker->safeEmail,
|
||||
'name_first' => $this->faker->firstName,
|
||||
'name_last' => $this->faker->lastName,
|
||||
'password' => $password ?: $password = bcrypt('password'),
|
||||
'language' => 'en',
|
||||
'root_admin' => false,
|
||||
'use_totp' => false,
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the user is an admin.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Factories\Factory
|
||||
*/
|
||||
public function admin(): Factory
|
||||
{
|
||||
return $this->state(function (array $attributes) {
|
||||
return [
|
||||
'root_admin' => true,
|
||||
];
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Pterodactyl\Models\Nest;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
|
@ -109,7 +111,7 @@ class EggSeeder extends Seeder
|
|||
*/
|
||||
private function parseEggFiles(Nest $nest)
|
||||
{
|
||||
$files = $this->filesystem->allFiles(database_path('seeds/eggs/' . kebab_case($nest->name)));
|
||||
$files = $this->filesystem->allFiles(database_path('seeders/eggs/' . kebab_case($nest->name)));
|
||||
|
||||
$this->command->alert('Updating Eggs for Nest: ' . $nest->name);
|
||||
Collection::make($files)->each(function ($file) use ($nest) {
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Pterodactyl\Services\Nests\NestCreationService;
|
||||
use Pterodactyl\Contracts\Repository\NestRepositoryInterface;
|
|
@ -1,211 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Cake\Chronos\Chronos;
|
||||
use Illuminate\Support\Str;
|
||||
use Pterodactyl\Models\Node;
|
||||
use Faker\Generator as Faker;
|
||||
use Pterodactyl\Models\ApiKey;
|
||||
use Pterodactyl\Models\Backup;
|
||||
use Pterodactyl\Models\Permission;
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Model Factories
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of your model factories. Model factories give
|
||||
| you a convenient way to create models for testing and seeding your
|
||||
| database. Just tell the factory how a default model should look.
|
||||
|
|
||||
*/
|
||||
|
||||
$factory->define(Pterodactyl\Models\Server::class, function (Faker $faker) {
|
||||
return [
|
||||
'uuid' => Uuid::uuid4()->toString(),
|
||||
'uuidShort' => str_random(8),
|
||||
'name' => $faker->firstName,
|
||||
'description' => implode(' ', $faker->sentences()),
|
||||
'skip_scripts' => 0,
|
||||
'suspended' => 0,
|
||||
'memory' => 512,
|
||||
'swap' => 0,
|
||||
'disk' => 512,
|
||||
'io' => 500,
|
||||
'cpu' => 0,
|
||||
'oom_disabled' => 0,
|
||||
'installed' => 1,
|
||||
'database_limit' => null,
|
||||
'allocation_limit' => null,
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(Pterodactyl\Models\User::class, function (Faker $faker) {
|
||||
static $password;
|
||||
|
||||
return [
|
||||
'external_id' => $faker->unique()->isbn10,
|
||||
'uuid' => $faker->uuid,
|
||||
'username' => $faker->userName,
|
||||
'email' => $faker->safeEmail,
|
||||
'name_first' => $faker->firstName,
|
||||
'name_last' => $faker->lastName,
|
||||
'password' => $password ?: $password = bcrypt('password'),
|
||||
'language' => 'en',
|
||||
'root_admin' => false,
|
||||
'use_totp' => false,
|
||||
'created_at' => Chronos::now(),
|
||||
'updated_at' => Chronos::now(),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(Pterodactyl\Models\User::class, 'admin', function () {
|
||||
return [
|
||||
'root_admin' => true,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(Pterodactyl\Models\Location::class, function (Faker $faker) {
|
||||
return [
|
||||
'short' => Str::random(8),
|
||||
'long' => $faker->catchPhrase,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(Pterodactyl\Models\Node::class, function (Faker $faker) {
|
||||
return [
|
||||
'uuid' => Uuid::uuid4()->toString(),
|
||||
'public' => true,
|
||||
'name' => $faker->firstName,
|
||||
'fqdn' => $faker->ipv4,
|
||||
'scheme' => 'http',
|
||||
'behind_proxy' => false,
|
||||
'memory' => 1024,
|
||||
'memory_overallocate' => 0,
|
||||
'disk' => 10240,
|
||||
'disk_overallocate' => 0,
|
||||
'upload_size' => 100,
|
||||
'daemon_token_id' => Str::random(Node::DAEMON_TOKEN_ID_LENGTH),
|
||||
'daemon_token' => encrypt(Str::random(Node::DAEMON_TOKEN_LENGTH)),
|
||||
'daemonListen' => 8080,
|
||||
'daemonSFTP' => 2022,
|
||||
'daemonBase' => '/var/lib/pterodactyl/volumes',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(Pterodactyl\Models\Nest::class, function (Faker $faker) {
|
||||
return [
|
||||
'uuid' => $faker->unique()->uuid,
|
||||
'author' => 'testauthor@example.com',
|
||||
'name' => $faker->word,
|
||||
'description' => null,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(Pterodactyl\Models\Egg::class, function (Faker $faker) {
|
||||
return [
|
||||
'uuid' => $faker->unique()->uuid,
|
||||
'name' => $faker->name,
|
||||
'description' => implode(' ', $faker->sentences(3)),
|
||||
'startup' => 'java -jar test.jar',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(Pterodactyl\Models\EggVariable::class, function (Faker $faker) {
|
||||
return [
|
||||
'name' => $faker->firstName,
|
||||
'description' => $faker->sentence(),
|
||||
'env_variable' => strtoupper(str_replace(' ', '_', $faker->words(2, true))),
|
||||
'default_value' => $faker->colorName,
|
||||
'user_viewable' => 0,
|
||||
'user_editable' => 0,
|
||||
'rules' => 'required|string',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(Pterodactyl\Models\EggVariable::class, 'viewable', function () {
|
||||
return ['user_viewable' => 1];
|
||||
});
|
||||
|
||||
$factory->state(Pterodactyl\Models\EggVariable::class, 'editable', function () {
|
||||
return ['user_editable' => 1];
|
||||
});
|
||||
|
||||
$factory->define(Pterodactyl\Models\Subuser::class, function (Faker $faker) {
|
||||
return [
|
||||
'permissions' => [Permission::ACTION_WEBSOCKET_CONNECT],
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(Pterodactyl\Models\Allocation::class, function (Faker $faker) {
|
||||
return [
|
||||
'ip' => $faker->ipv4,
|
||||
'port' => $faker->randomNumber(5),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(Pterodactyl\Models\DatabaseHost::class, function (Faker $faker) {
|
||||
return [
|
||||
'name' => $faker->colorName,
|
||||
'host' => $faker->unique()->ipv4,
|
||||
'port' => 3306,
|
||||
'username' => $faker->colorName,
|
||||
'password' => Crypt::encrypt($faker->word),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(Pterodactyl\Models\Database::class, function (Faker $faker) {
|
||||
static $password;
|
||||
|
||||
return [
|
||||
'database' => str_random(10),
|
||||
'username' => str_random(10),
|
||||
'remote' => '%',
|
||||
'password' => $password ?: encrypt('test123'),
|
||||
'created_at' => Carbon::now()->toDateTimeString(),
|
||||
'updated_at' => Carbon::now()->toDateTimeString(),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(Pterodactyl\Models\Schedule::class, function (Faker $faker) {
|
||||
return [
|
||||
'name' => $faker->firstName(),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(Pterodactyl\Models\Task::class, function (Faker $faker) {
|
||||
return [
|
||||
'sequence_id' => $faker->randomNumber(1),
|
||||
'action' => 'command',
|
||||
'payload' => 'test command',
|
||||
'time_offset' => 120,
|
||||
'is_queued' => false,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(Pterodactyl\Models\ApiKey::class, function (Faker $faker) {
|
||||
static $token;
|
||||
|
||||
return [
|
||||
'key_type' => ApiKey::TYPE_APPLICATION,
|
||||
'identifier' => str_random(Pterodactyl\Models\ApiKey::IDENTIFIER_LENGTH),
|
||||
'token' => $token ?: $token = encrypt(str_random(Pterodactyl\Models\ApiKey::KEY_LENGTH)),
|
||||
'allowed_ips' => null,
|
||||
'memo' => 'Test Function Key',
|
||||
'created_at' => Carbon::now()->toDateTimeString(),
|
||||
'updated_at' => Carbon::now()->toDateTimeString(),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(Pterodactyl\Models\Backup::class, function (Faker $faker) {
|
||||
return [
|
||||
'uuid' => Uuid::uuid4()->toString(),
|
||||
'is_successful' => true,
|
||||
'name' => $faker->sentence,
|
||||
'disk' => Backup::ADAPTER_WINGS,
|
||||
];
|
||||
});
|
|
@ -11,13 +11,11 @@ class DeleteServiceExecutableOption extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
DB::transaction(function () {
|
||||
Schema::table('services', function (Blueprint $table) {
|
||||
$table->renameColumn('file', 'folder');
|
||||
$table->dropColumn('executable');
|
||||
$table->text('description')->nullable()->change();
|
||||
$table->text('startup')->nullable()->change();
|
||||
});
|
||||
Schema::table('services', function (Blueprint $table) {
|
||||
$table->renameColumn('file', 'folder');
|
||||
$table->dropColumn('executable');
|
||||
$table->text('description')->nullable()->change();
|
||||
$table->text('startup')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ class MigrateToNewServiceSystem extends Migration
|
|||
}
|
||||
|
||||
$options = DB::table('service_options')->where('service_id', $service->id)->get();
|
||||
$options->each(function ($item) use ($options) {
|
||||
$options->each(function ($item) {
|
||||
if ($item->tag === 'srcds' && $item->name === 'Insurgency') {
|
||||
$item->tag = 'insurgency';
|
||||
} elseif ($item->tag === 'srcds' && $item->name === 'Team Fortress 2') {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Pterodactyl\Models\Permission;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Pterodactyl\Models\Permission as P;
|
||||
|
|
|
@ -20,13 +20,13 @@ class CreateBackupsTable extends Migration
|
|||
// to use. For now, just rename them to maintain the data.
|
||||
$results = DB::select('SELECT TABLE_NAME FROM information_schema.tables WHERE table_schema = ? AND table_name LIKE ? AND table_name NOT LIKE \'%_plugin_bak\'', [
|
||||
config("database.connections.{$db}.database"),
|
||||
'backup%'
|
||||
'backup%',
|
||||
]);
|
||||
|
||||
// Take any of the results, most likely "backups" and "backup_logs" and rename them to have a
|
||||
// suffix so data isn't completely lost, but they're no longer in the way of this migration...
|
||||
foreach ($results as $result) {
|
||||
Schema::rename($result->TABLE_NAME, $result->TABLE_NAME. '_plugin_bak');
|
||||
Schema::rename($result->TABLE_NAME, $result->TABLE_NAME . '_plugin_bak');
|
||||
}
|
||||
|
||||
Schema::create('backups', function (Blueprint $table) {
|
||||
|
|
|
@ -19,7 +19,7 @@ class AddBackupLimitToServers extends Migration
|
|||
// here. If we find a result we'll actually keep the column around since we can maintain that backup
|
||||
// limit, but we need to correct the column definition a bit.
|
||||
$results = DB::select('SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = ? AND TABLE_NAME = \'servers\' AND COLUMN_NAME = \'backup_limit\'', [
|
||||
config("database.connections.{$db}.database")
|
||||
config("database.connections.{$db}.database"),
|
||||
]);
|
||||
|
||||
if (count($results) === 1) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateUserRecoveryTokensTable extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddNotesColumnForAllocations extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddBackupStateColumnToBackups extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class UpdateBytesToUnsignedBigint extends Migration
|
||||
{
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class ModifyChecksumsColumnForBackups extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class DropPacksFromServers extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class DropPacksFromApiKeyPermissions extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class DropPacksTable extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class DropDaemonKeyTable extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class ChangeUniqueDatabaseNameToAccountForServer extends Migration
|
||||
{
|
||||
|
@ -36,6 +36,5 @@ class ChangeUniqueDatabaseNameToAccountForServer extends Migration
|
|||
Schema::table('databases', function (Blueprint $table) {
|
||||
$table->unique(['database_host_id', 'database']);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RemoveNullableFromScheduleNameField extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddFeaturesColumnToEggs extends Migration
|
||||
{
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class SupportMultipleDockerImagesAndUpdates extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class MakeAllocationFieldsJson extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddFileDenylistToEggConfigs extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddCronMonth extends Migration
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue