Multiple ticket crash fixes (#347)
* Fix for initial seed data not being run during install closes #346 * StyleCI keepin' me honest * Tooltips for ranks
This commit is contained in:
parent
e12188b7d3
commit
5cce1b3040
@ -9,7 +9,8 @@ use App\Models\Pirep;
|
|||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Services\AwardService;
|
use App\Services\AwardService;
|
||||||
use App\Services\DatabaseService;
|
use App\Services\DatabaseService;
|
||||||
use DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
use PDO;
|
use PDO;
|
||||||
use Symfony\Component\Yaml\Yaml;
|
use Symfony\Component\Yaml\Yaml;
|
||||||
|
|
||||||
@ -46,12 +47,13 @@ class DevCommands extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
$commands = [
|
$commands = [
|
||||||
'list-awards' => 'listAwardClasses',
|
|
||||||
'clear-acars' => 'clearAcars',
|
'clear-acars' => 'clearAcars',
|
||||||
'clear-users' => 'clearUsers',
|
'clear-users' => 'clearUsers',
|
||||||
'compile-assets' => 'compileAssets',
|
'compile-assets' => 'compileAssets',
|
||||||
'db-attrs' => 'dbAttrs',
|
'db-attrs' => 'dbAttrs',
|
||||||
|
'list-awards' => 'listAwardClasses',
|
||||||
'manual-insert' => 'manualInsert',
|
'manual-insert' => 'manualInsert',
|
||||||
|
'reset-install' => 'resetInstall',
|
||||||
'xml-to-yaml' => 'xmlToYaml',
|
'xml-to-yaml' => 'xmlToYaml',
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -212,4 +214,33 @@ class DevCommands extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete all of the tables, etc from the database, for a clean install
|
||||||
|
*/
|
||||||
|
protected function resetInstall(): void
|
||||||
|
{
|
||||||
|
$confirm = $this->ask('This will erase your entire install and database, are you sure? y/n ');
|
||||||
|
if (strtolower($confirm) !== 'y') {
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config('database.default') === 'mysql') {
|
||||||
|
DB::statement('SET foreign_key_checks=0');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->info('Dropping all tables');
|
||||||
|
$tables = DB::connection()->getDoctrineSchemaManager()->listTableNames();
|
||||||
|
foreach ($tables as $table) {
|
||||||
|
Schema::dropIfExists($table);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->info('Deleting config file');
|
||||||
|
unlink('config.php');
|
||||||
|
|
||||||
|
$this->info('Deleting env file');
|
||||||
|
unlink('env.php');
|
||||||
|
|
||||||
|
$this->info('Done!');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
#
|
|
||||||
# Initial minimal data required. You probably don't
|
|
||||||
# want to modify or erase any of this here
|
|
||||||
#
|
|
||||||
|
|
||||||
airports:
|
|
||||||
- id: KAUS
|
|
||||||
iata: AUS
|
|
||||||
icao: KAUS
|
|
||||||
name: Austin-Bergstrom
|
|
||||||
location: Austin, Texas, USA
|
|
||||||
country: United States
|
|
||||||
timezone: America/Chicago
|
|
||||||
lat: 30.1945278
|
|
||||||
lon: -97.6698889
|
|
||||||
hub: 1
|
|
@ -8,13 +8,14 @@ use App\Models\User;
|
|||||||
use App\Repositories\AirlineRepository;
|
use App\Repositories\AirlineRepository;
|
||||||
use App\Services\AnalyticsService;
|
use App\Services\AnalyticsService;
|
||||||
use App\Services\Installer\MigrationService;
|
use App\Services\Installer\MigrationService;
|
||||||
|
use App\Services\Installer\SeederService;
|
||||||
use App\Services\UserService;
|
use App\Services\UserService;
|
||||||
use App\Support\Countries;
|
use App\Support\Countries;
|
||||||
use Illuminate\Database\QueryException;
|
use Illuminate\Database\QueryException;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
use Log;
|
|
||||||
use Modules\Installer\Services\ConfigService;
|
use Modules\Installer\Services\ConfigService;
|
||||||
use Modules\Installer\Services\DatabaseService;
|
use Modules\Installer\Services\DatabaseService;
|
||||||
use Modules\Installer\Services\RequirementsService;
|
use Modules\Installer\Services\RequirementsService;
|
||||||
@ -28,21 +29,23 @@ class InstallerController extends Controller
|
|||||||
{
|
{
|
||||||
private $airlineRepo,
|
private $airlineRepo,
|
||||||
$analyticsSvc,
|
$analyticsSvc,
|
||||||
$dbService,
|
$dbSvc,
|
||||||
$envService,
|
$envSvc,
|
||||||
$migrationSvc,
|
$migrationSvc,
|
||||||
$reqService,
|
$reqSvc,
|
||||||
|
$seederSvc,
|
||||||
$userService;
|
$userService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* InstallerController constructor.
|
* InstallerController constructor.
|
||||||
* @param AirlineRepository $airlineRepo
|
* @param AirlineRepository $airlineRepo
|
||||||
* @param AnalyticsService $analyticsSvc
|
* @param AnalyticsService $analyticsSvc
|
||||||
* @param DatabaseService $dbService
|
* @param DatabaseService $dbService
|
||||||
* @param ConfigService $envService
|
* @param ConfigService $envService
|
||||||
* @param MigrationService $migrationSvc
|
* @param MigrationService $migrationSvc
|
||||||
* @param RequirementsService $reqService
|
* @param RequirementsService $reqSvc
|
||||||
* @param UserService $userService
|
* @param SeederService $seederSvc
|
||||||
|
* @param UserService $userService
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
AirlineRepository $airlineRepo,
|
AirlineRepository $airlineRepo,
|
||||||
@ -50,15 +53,17 @@ class InstallerController extends Controller
|
|||||||
DatabaseService $dbService,
|
DatabaseService $dbService,
|
||||||
ConfigService $envService,
|
ConfigService $envService,
|
||||||
MigrationService $migrationSvc,
|
MigrationService $migrationSvc,
|
||||||
RequirementsService $reqService,
|
RequirementsService $reqSvc,
|
||||||
|
SeederService $seederSvc,
|
||||||
UserService $userService
|
UserService $userService
|
||||||
) {
|
) {
|
||||||
$this->airlineRepo = $airlineRepo;
|
$this->airlineRepo = $airlineRepo;
|
||||||
$this->analyticsSvc = $analyticsSvc;
|
$this->analyticsSvc = $analyticsSvc;
|
||||||
$this->dbService = $dbService;
|
$this->dbSvc = $dbService;
|
||||||
$this->envService = $envService;
|
$this->envSvc = $envService;
|
||||||
$this->migrationSvc = $migrationSvc;
|
$this->migrationSvc = $migrationSvc;
|
||||||
$this->reqService = $reqService;
|
$this->reqSvc = $reqSvc;
|
||||||
|
$this->seederSvc = $seederSvc;
|
||||||
$this->userService = $userService;
|
$this->userService = $userService;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -75,7 +80,7 @@ class InstallerController extends Controller
|
|||||||
|
|
||||||
protected function testDb(Request $request)
|
protected function testDb(Request $request)
|
||||||
{
|
{
|
||||||
$this->dbService->checkDbConnection(
|
$this->dbSvc->checkDbConnection(
|
||||||
$request->post('db_conn'),
|
$request->post('db_conn'),
|
||||||
$request->post('db_host'),
|
$request->post('db_host'),
|
||||||
$request->post('db_port'),
|
$request->post('db_port'),
|
||||||
@ -131,9 +136,9 @@ class InstallerController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function step1(Request $request)
|
public function step1(Request $request)
|
||||||
{
|
{
|
||||||
$php_version = $this->reqService->checkPHPVersion();
|
$php_version = $this->reqSvc->checkPHPVersion();
|
||||||
$extensions = $this->reqService->checkExtensions();
|
$extensions = $this->reqSvc->checkExtensions();
|
||||||
$directories = $this->reqService->checkPermissions();
|
$directories = $this->reqSvc->checkPermissions();
|
||||||
|
|
||||||
# Only pass if all the items in the ext and dirs are passed
|
# Only pass if all the items in the ext and dirs are passed
|
||||||
$statuses = [
|
$statuses = [
|
||||||
@ -210,7 +215,7 @@ class InstallerController extends Controller
|
|||||||
* setup the database and stuff
|
* setup the database and stuff
|
||||||
*/
|
*/
|
||||||
try {
|
try {
|
||||||
$this->envService->createConfigFiles($attrs);
|
$this->envSvc->createConfigFiles($attrs);
|
||||||
} catch(FileException $e) {
|
} catch(FileException $e) {
|
||||||
Log::error('Config files failed to write');
|
Log::error('Config files failed to write');
|
||||||
Log::error($e->getMessage());
|
Log::error($e->getMessage());
|
||||||
@ -234,12 +239,13 @@ class InstallerController extends Controller
|
|||||||
$console_out = '';
|
$console_out = '';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$console_out .= $this->dbService->setupDB();
|
$console_out .= $this->dbSvc->setupDB();
|
||||||
$console_out .= $this->migrationSvc->runAllMigrations();
|
$console_out .= $this->migrationSvc->runAllMigrations();
|
||||||
|
$this->seederSvc->syncAllSeeds();
|
||||||
} catch(QueryException $e) {
|
} catch(QueryException $e) {
|
||||||
Log::error('Error on db setup: ' . $e->getMessage());
|
Log::error('Error on db setup: ' . $e->getMessage());
|
||||||
|
|
||||||
$this->envService->removeConfigFiles();
|
$this->envSvc->removeConfigFiles();
|
||||||
flash()->error($e->getMessage());
|
flash()->error($e->getMessage());
|
||||||
return redirect(route('installer.step2'))->withInput();
|
return redirect(route('installer.step2'))->withInput();
|
||||||
}
|
}
|
||||||
@ -309,8 +315,6 @@ class InstallerController extends Controller
|
|||||||
'email' => $request->get('email'),
|
'email' => $request->get('email'),
|
||||||
'api_key' => Utils::generateApiKey(),
|
'api_key' => Utils::generateApiKey(),
|
||||||
'airline_id' => $airline->id,
|
'airline_id' => $airline->id,
|
||||||
'home_airport_id' => 'KAUS',
|
|
||||||
'curr_airport_id' => 'KAUS',
|
|
||||||
'password' => Hash::make($request->get('password'))
|
'password' => Hash::make($request->get('password'))
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -12,8 +12,11 @@ return [
|
|||||||
'name' => '$SITE_NAME$',
|
'name' => '$SITE_NAME$',
|
||||||
'url' => '$SITE_URL$',
|
'url' => '$SITE_URL$',
|
||||||
|
|
||||||
# Don't forget to change these when live
|
// When live, 'env' should be 'prod'
|
||||||
'env' => 'prod',
|
'env' => 'prod',
|
||||||
|
|
||||||
|
// debug as true shows the Laravel debug bar, which is helpful for
|
||||||
|
// debugging templates and other internals
|
||||||
'debug' => false,
|
'debug' => false,
|
||||||
],
|
],
|
||||||
|
|
||||||
@ -71,7 +74,7 @@ return [
|
|||||||
'default' => env('DB_CONNECTION', '$DB_CONN$'),
|
'default' => env('DB_CONNECTION', '$DB_CONN$'),
|
||||||
'connections' => [
|
'connections' => [
|
||||||
'mysql' => [
|
'mysql' => [
|
||||||
'host' => '$DB_HOST$',
|
'host' => env('DB_HOST', '$DB_HOST$'),
|
||||||
'port' => $DB_PORT$,
|
'port' => $DB_PORT$,
|
||||||
'database' => '$DB_NAME$',
|
'database' => '$DB_NAME$',
|
||||||
'username' => '$DB_USER$',
|
'username' => '$DB_USER$',
|
||||||
|
@ -50,35 +50,50 @@
|
|||||||
<div class="form-container-body">
|
<div class="form-container-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<!-- Auto Approve Acars Field -->
|
<!-- Auto Approve Acars Field -->
|
||||||
<div class="form-group col-sm-4 text-center">
|
<div class="form-group col-sm-4">
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label class="checkbox-inline">
|
<label class="checkbox-inline">
|
||||||
{{ Form::hidden('auto_approve_acars', false) }}
|
{{ Form::hidden('auto_approve_acars', false) }}
|
||||||
{{ Form::checkbox('auto_approve_acars') }}
|
{{ Form::checkbox('auto_approve_acars') }}
|
||||||
{{ Form::label('auto_approve_acars', 'Auto Approve ACARS PIREPs') }}
|
{{ Form::label('auto_approve_acars', 'Auto Approve ACARS PIREPs') }}
|
||||||
</label>
|
</label>
|
||||||
|
<div style="margin-left: 10px">
|
||||||
|
@component('admin.components.info')
|
||||||
|
PIREPS submitted through ACARS are automatically accepted
|
||||||
|
@endcomponent
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Auto Approve Manual Field -->
|
<!-- Auto Approve Manual Field -->
|
||||||
<div class="form-group col-sm-4 text-center">
|
<div class="form-group col-sm-4">
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label class="checkbox-inline">
|
<label class="checkbox-inline">
|
||||||
{{ Form::hidden('auto_approve_manual', false) }}
|
{{ Form::hidden('auto_approve_manual', false) }}
|
||||||
{{ Form::checkbox('auto_approve_manual') }}
|
{{ Form::checkbox('auto_approve_manual') }}
|
||||||
{{ Form::label('auto_approve_manual', 'Auto Approve Manual PIREPs') }}
|
{{ Form::label('auto_approve_manual', 'Auto Approve Manual PIREPs') }}
|
||||||
</label>
|
</label>
|
||||||
|
<div style="margin-left: 10px">
|
||||||
|
@component('admin.components.info')
|
||||||
|
PIREPS submitted manually are automatically accepted
|
||||||
|
@endcomponent
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Auto Promote Field -->
|
<!-- Auto Promote Field -->
|
||||||
<div class="form-group col-sm-4 text-center">
|
<div class="form-group col-sm-4">
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label class="checkbox-inline">
|
<label class="checkbox-inline">
|
||||||
{{ Form::hidden('auto_promote', false) }}
|
{{ Form::hidden('auto_promote', false) }}
|
||||||
{{ Form::checkbox('auto_promote') }}
|
{{ Form::checkbox('auto_promote') }}
|
||||||
{{ Form::label('auto_promote', 'Auto Promote') }}
|
{{ Form::label('auto_promote', 'Auto Promote') }}
|
||||||
</label>
|
</label>
|
||||||
|
<div style="margin-left: 10px">
|
||||||
|
@component('admin.components.info')
|
||||||
|
When a pilot reaches these hours, they'll be upgraded to this rank
|
||||||
|
@endcomponent
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user