misc_pterodactyl-panel/app/Console/Commands/Overrides/KeyGenerateCommand.php

29 lines
1.2 KiB
PHP
Raw Permalink Normal View History

<?php
namespace Pterodactyl\Console\Commands\Overrides;
use Illuminate\Foundation\Console\KeyGenerateCommand as BaseKeyGenerateCommand;
class KeyGenerateCommand extends BaseKeyGenerateCommand
{
/**
* Override the default Laravel key generation command to throw a warning to the user
* if it appears that they have already generated an application encryption key.
*/
public function handle()
{
2021-01-23 20:33:34 +00:00
if (!empty(config('app.key')) && $this->input->isInteractive()) {
2021-01-23 22:12:15 +00:00
$this->output->warning('It appears you have already configured an application encryption key. Continuing with this process with overwrite that key and cause data corruption for any existing encrypted data. DO NOT CONTINUE UNLESS YOU KNOW WHAT YOU ARE DOING.');
if (!$this->confirm('I understand the consequences of performing this command and accept all responsibility for the loss of encrypted data.')) {
return;
}
2021-01-23 22:12:15 +00:00
if (!$this->confirm('Are you sure you wish to continue? Changing the application encryption key WILL CAUSE DATA LOSS.')) {
return;
}
}
parent::handle();
}
}