7.0.0-beta3 Release (#541)
* 391 Notification refactorings (#441) * Refactor notifications to allow easier plugins * Notification refactoring * Formatting * Move news to NewsService; cleanup of events * More refactoring; added send email out for news item and the template * Formatting * Formatting * Fix missing newsRepo (#445) * Refactor and add importer to Installer module #443 (#444) * Refactor and add importer to Installer module #443 * Refactor for finances to use in import * Import groups into roles * Formatting * Formatting * Add interface in installer for import * Notes about importing * Check for installer folder * Formatting * Fix pirep->user mapping * Unused import * Formatting * Replace importer with AJAX powered; better error handling #443 (#447) * Replace importer with AJAX powered; better error handling #443 * Formatting * Fix command line importer * Remove bootstrap cache (#448) * Cleanup the bootstrap/cache directory when packaging * Fix removal of bootstrap cache * Formatting * Stricter checks on ACARS API data (#451) * Stricter checks on ACARS API data * More checks * Fix for flight_number check forcing to exist * Allow nullable on flight_id * Avoid proc_open use #455 (#456) * Use PhpExecutableFinder() closes #457 #458 (#460) * Use DateTimeZone instead of int for creating datetime closes #461 * Fix CSV imports giving Storage class not found #454 (#462) * Fix CSV imports giving Storage class not found #454 * Update yarn files for security alert * Add PHP 7.4 support (#464) * Add PHP 7.4 to build matrix * DB fix * YAML parser fix in test data * Show versions * Package updates * Track used ICAOs * 7.4 METAR parsing fix * METAR parser fix * Formatting * Add meters to response units * Call instance for unit conversion * Return value * Catch exception for unknown quantity * Comment fix * Formatting * METAR parsing fixes on PHP 7.4 * Package updates * More random airport ID * More random airport ID * Properly disable toolbar * Semver written out to version file * Use dev as default identifier * Fix BindingResolutionError when debug toolbar isn't present (#465) * Fix BindingResolutionError when debug toolbar isn't present * Formatting * Split the importer module out from the installer module (#468) * Split the importer module out from the installer module * Cleanup of unused imports * Move updater into separate module #453 * Remove unused imports/formatting * Disable the install and importer modules at the end of the setup * Unused imports; update IJ style * test explicit stage for php+mysql * add more to matrix * Add different MariaDB versions * undo * Cleanup Model doc * Pilots cannot use the dashboard or flights without admin rights (#481) * Use auth middleware instead of specific groups for logged in state * Auth check for admin access * Check user admin access for updates * Formatting * Allow nullable field and calculate distance if nulled for flight import #478 (#482) * Check for no roles being attached #480 (#483) * Return the flight fares if there are no subfleet fares #488 (#489) * Return the flight fares if there are no subfleet fares #488 * Formatting * Formatting * Account for units when entering fuel amounts #493 * Search for ICAO not working properly (#496) * /flights and /flights/search direct to the same endpoint * Properly set the distance/planned_distance on save (#497) * 491 Installation Error (#495) * Disable CSRF token * Add error handling around looking up the theme and set a default * Note about logs in issue template * Formatting * Fix GeoService errors when viewing PIREP #498 (#499) * Add new command to export a specific PIREP for debugging (#501) * Set a default model value for airports on PIREP (#500) * Set a default model value for airports on PIREP * Fix airport icao reference * Default airport models * Catch broader exception writing out config files #491 * style * Add reference to docs on doc site (#502) * Properly create/update rows importing #486 (#503) * Add base Dockerfile for Dockerhub builds (#504) * New subfleet not being attached to an airline on import #479 (#505) * Fix subfleet not being attached to an airline on creation in import #479 * Call airline name with optional() around subfleet * Minor cleanup * Search flights by subfleet #484 (#506) * API level search of flights #484 * Add Subfleet to flights page for search * Make the fuel used optional (#512) * Add make to Docker container * Add getRootDomain() to Utils (#514) * Show admin dropdown for admin-access ability (#515) * Show admin dropdown for admin-access ability closes #509 * Formatting * Check user permissions on the routes #508 (#516) * Check user permissions on the routes #508 * Formatting * Return default value on exception for setting() * Correct text for no subfleets #507 (#518) * Add a public_url() helper #513 (#519) * Reduce number of queries for update check (#520) * Try to clear caches before updating (#522) * Try to clear caches before updating * Add clear-compiled to maintenance cache list * Formatting * Set PIREPs page to public (#526) Set PIREPs page to public * Fix live and route map errors #527 (#528) * Add menu bar for mobile (#529) * Format all blade templates to 2 spaces #530 (#531) * Fix PIREP edit endpoint closes #533 (#534) * Fix import during flight cron #532 (#535) * PIREPS resource except for show (#536) * Use optional() around the airport fields (#537) * Use optional() around the airport fields * Add null-coalesce around full_name * Add link to download ACARS config from profile (#539) * Add link to download ACARS config from profile * Formatting * Update xml config file template (#540)
This commit is contained in:
4
modules/Updater/Config/config.php
Normal file
4
modules/Updater/Config/config.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
];
|
||||
97
modules/Updater/Http/Controllers/UpdateController.php
Normal file
97
modules/Updater/Http/Controllers/UpdateController.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Updater\Http\Controllers;
|
||||
|
||||
use App\Contracts\Controller;
|
||||
use App\Services\Installer\InstallerService;
|
||||
use App\Services\Installer\MigrationService;
|
||||
use App\Services\Installer\SeederService;
|
||||
use function count;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class UpdateController extends Controller
|
||||
{
|
||||
private $installerSvc;
|
||||
private $migrationSvc;
|
||||
private $seederSvc;
|
||||
|
||||
/**
|
||||
* @param InstallerService $installerSvc
|
||||
* @param MigrationService $migrationSvc
|
||||
* @param SeederService $seederSvc
|
||||
*/
|
||||
public function __construct(
|
||||
InstallerService $installerSvc,
|
||||
MigrationService $migrationSvc,
|
||||
SeederService $seederSvc
|
||||
) {
|
||||
$this->migrationSvc = $migrationSvc;
|
||||
$this->seederSvc = $seederSvc;
|
||||
$this->installerSvc = $installerSvc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('updater::index-start');
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 1. Check if there's an update available. Check if there
|
||||
* are any unrun migrations
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function step1(Request $request)
|
||||
{
|
||||
$this->installerSvc->clearCaches();
|
||||
|
||||
if ($this->installerSvc->isUpgradePending()) {
|
||||
Log::info('Upgrade is pending');
|
||||
}
|
||||
|
||||
return view('updater::steps/step1-update-available');
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 2 Run all of the migrations
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function run_migrations(Request $request)
|
||||
{
|
||||
Log::info('Update: run_migrations', $request->post());
|
||||
|
||||
$migrations = $this->migrationSvc->migrationsAvailable();
|
||||
if (count($migrations) === 0) {
|
||||
$this->seederSvc->syncAllSeeds();
|
||||
return view('updater::steps/step3-update-complete');
|
||||
}
|
||||
|
||||
$output = $this->migrationSvc->runAllMigrations();
|
||||
$this->seederSvc->syncAllSeeds();
|
||||
|
||||
return view('updater::steps/step2-migrations-done', [
|
||||
'console_output' => $output,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Final step
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function complete(Request $request)
|
||||
{
|
||||
return redirect('/login');
|
||||
}
|
||||
}
|
||||
91
modules/Updater/Providers/UpdateServiceProvider.php
Normal file
91
modules/Updater/Providers/UpdateServiceProvider.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Updater\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class UpdateServiceProvider extends ServiceProvider
|
||||
{
|
||||
public function boot()
|
||||
{
|
||||
$this->registerRoutes();
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the routes
|
||||
*/
|
||||
protected function registerRoutes()
|
||||
{
|
||||
Route::group([
|
||||
'as' => 'update.',
|
||||
'prefix' => 'update',
|
||||
'middleware' => ['web', 'auth', 'ability:admin,admin-access'],
|
||||
'namespace' => 'Modules\Updater\Http\Controllers',
|
||||
], function () {
|
||||
Route::get('/', 'UpdateController@index')->name('index');
|
||||
|
||||
Route::get('/step1', 'UpdateController@step1')->name('step1');
|
||||
Route::post('/step1', 'UpdateController@step1')->name('step1');
|
||||
|
||||
Route::post('/run-migrations', 'UpdateController@run_migrations')->name('run_migrations');
|
||||
Route::get('/complete', 'UpdateController@complete')->name('complete');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*/
|
||||
protected function registerConfig()
|
||||
{
|
||||
$this->mergeConfigFrom(__DIR__.'/../Config/config.php', 'updater');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*/
|
||||
public function registerViews()
|
||||
{
|
||||
$viewPath = resource_path('views/modules/updater');
|
||||
$sourcePath = __DIR__.'/../Resources/views';
|
||||
|
||||
$this->publishes([
|
||||
$sourcePath => $viewPath,
|
||||
], 'views');
|
||||
|
||||
$paths = array_map(
|
||||
function ($path) {
|
||||
return $path.'/modules/updater';
|
||||
},
|
||||
\Config::get('view.paths')
|
||||
);
|
||||
|
||||
$paths[] = $sourcePath;
|
||||
$this->loadViewsFrom($paths, 'updater');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register translations.
|
||||
*/
|
||||
public function registerTranslations()
|
||||
{
|
||||
$langPath = resource_path('lang/modules/updater');
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, 'updater');
|
||||
} else {
|
||||
$this->loadTranslationsFrom(__DIR__.'/../Resources/lang', 'updater');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*/
|
||||
public function provides(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
94
modules/Updater/Resources/views/app.blade.php
Normal file
94
modules/Updater/Resources/views/app.blade.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
|
||||
<title>@yield('title') - updater</title>
|
||||
|
||||
<link rel="shortcut icon" type="image/png" href="{{ public_asset('/assets/img/favicon.png') }}"/>
|
||||
|
||||
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no'
|
||||
name='viewport'/>
|
||||
<meta name="base-url" content="{!! url('') !!}">
|
||||
<meta name="api-key" content="{!! Auth::check() ? Auth::user()->api_key: '' !!}">
|
||||
<meta name="csrf-token" content="{!! csrf_token() !!}">
|
||||
|
||||
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700,200" rel="stylesheet"/>
|
||||
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css" rel="stylesheet"/>
|
||||
|
||||
<link href="{{ public_asset('/assets/frontend/css/bootstrap.min.css') }}" rel="stylesheet"/>
|
||||
<link href="{{ public_asset('/assets/frontend/css/now-ui-kit.css') }}" rel="stylesheet"/>
|
||||
<link href="{{ public_asset('/assets/installer/css/vendor.css') }}" rel="stylesheet"/>
|
||||
<link href="{{ public_asset('/assets/frontend/css/styles.css') }}" rel="stylesheet"/>
|
||||
|
||||
<link rel="stylesheet"
|
||||
href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css">
|
||||
|
||||
<style>
|
||||
.table tr:first-child td {
|
||||
border-top: 0px;
|
||||
}
|
||||
@yield('css')
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- Navbar -->
|
||||
<nav class="navbar navbar-toggleable-md" style="background: #067ec1;">
|
||||
<div class="container" style="width: 85%!important;">
|
||||
<div class="navbar-translate">
|
||||
<p class="navbar-brand text-white" data-placement="bottom" target="_blank">
|
||||
<a href="{{ url('/') }}">
|
||||
<img src="{{ public_asset('/assets/img/logo_blue_bg.svg') }}" width="135px" style=""/>
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
<div class="justify-content-center" id="navigation" style="margin-left: 50px; color: white; font-size: 20px;">
|
||||
@yield('title')
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<!-- End Navbar -->
|
||||
{{--<div class="clearfix" style="height: 25px;"></div>--}}
|
||||
<div class="wrapper">
|
||||
<div class="clear"></div>
|
||||
<div class="container" style="width: 50%">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('installer::flash.message')
|
||||
@yield('content')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix" style="height: 200px;"></div>
|
||||
</div>
|
||||
|
||||
{{--<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>--}}
|
||||
|
||||
<script src="{{ public_mix('/assets/global/js/vendor.js') }}"></script>
|
||||
<script src="{{ public_mix('/assets/frontend/js/vendor.js') }}"></script>
|
||||
<script src="{{ public_mix('/assets/frontend/js/app.js') }}"></script>
|
||||
<script src="{{ public_asset('/assets/installer/js/vendor.js') }}" type="text/javascript"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
|
||||
|
||||
<script>
|
||||
hljs.configure({languages: ['sh']});
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
$(".select2").select2();
|
||||
|
||||
$('pre code').each(function (i, block) {
|
||||
hljs.fixMarkup(block);
|
||||
hljs.highlightBlock(block);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@yield('scripts')
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,6 @@
|
||||
@if($errors->has($field))
|
||||
<p class="text-danger" style="margin-top: 10px;">{{ $errors->first($field) }}</p>
|
||||
{{--<div class="alert alert-danger" role="alert" style="margin-top: 10px;">
|
||||
{{ $errors->first($field) }}
|
||||
</div>--}}
|
||||
@endif
|
||||
11
modules/Updater/Resources/views/flash/message.blade.php
Normal file
11
modules/Updater/Resources/views/flash/message.blade.php
Normal file
@@ -0,0 +1,11 @@
|
||||
@foreach (session('flash_notification', collect())->toArray() as $message)
|
||||
<div class="alert alert-danger" role="alert">
|
||||
<div class="container">
|
||||
<div class="alert-icon">
|
||||
<i class="now-ui-icons ui-2_like"></i>
|
||||
</div>
|
||||
{{ $message['message'] }}
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
{{ session()->forget('flash_notification') }}
|
||||
12
modules/Updater/Resources/views/index-start.blade.php
Normal file
12
modules/Updater/Resources/views/index-start.blade.php
Normal file
@@ -0,0 +1,12 @@
|
||||
@extends('installer::app')
|
||||
@section('title', 'Update phpVMS')
|
||||
|
||||
@section('content')
|
||||
<h2>phpvms updater</h2>
|
||||
<p>Press continue to check if there are any updates available.</p>
|
||||
{{ Form::open(['route' => 'update.step1', 'method' => 'post']) }}
|
||||
<p style="text-align: right">
|
||||
{{ Form::submit('Start >>', ['class' => 'btn btn-success']) }}
|
||||
</p>
|
||||
{{ Form::close() }}
|
||||
@endsection
|
||||
@@ -0,0 +1,13 @@
|
||||
@extends('installer::app')
|
||||
@section('title', 'Update phpVMS')
|
||||
|
||||
@section('content')
|
||||
<h2>phpvms updater</h2>
|
||||
<p>It seems like you're up to date!</p>
|
||||
{{ Form::open(['route' => 'update.complete', 'method' => 'GET']) }}
|
||||
|
||||
<p style="text-align: right">
|
||||
{{ Form::submit('Complete >>', ['class' => 'btn btn-success']) }}
|
||||
</p>
|
||||
{{ Form::close() }}
|
||||
@endsection
|
||||
@@ -0,0 +1,12 @@
|
||||
@extends('installer::app')
|
||||
@section('title', 'Update phpVMS')
|
||||
|
||||
@section('content')
|
||||
<h2>phpvms updater</h2>
|
||||
<p>Click run to complete the update!.</p>
|
||||
{{ Form::open(['route' => 'update.run_migrations', 'method' => 'post']) }}
|
||||
<p style="text-align: right">
|
||||
{{ Form::submit('Run >>', ['class' => 'btn btn-success']) }}
|
||||
</p>
|
||||
{{ Form::close() }}
|
||||
@endsection
|
||||
@@ -0,0 +1,18 @@
|
||||
@extends('installer::app')
|
||||
@section('title', 'Update Completed')
|
||||
@section('content')
|
||||
<div style="align-content: center;">
|
||||
{{ Form::open(['route' => 'update.complete', 'method' => 'GET']) }}
|
||||
|
||||
<pre class="lang-sh">
|
||||
<code class="lang-sh">
|
||||
{{ $console_output }}
|
||||
</code>
|
||||
</pre>
|
||||
|
||||
<p style="text-align: right">
|
||||
{{ Form::submit('Complete >>', ['class' => 'btn btn-success']) }}
|
||||
</p>
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
@endsection
|
||||
@@ -0,0 +1,13 @@
|
||||
@extends('installer::app')
|
||||
@section('title', 'Update Completed')
|
||||
|
||||
@section('content')
|
||||
<h2>phpvms updater</h2>
|
||||
<p>Update completed!.</p>
|
||||
|
||||
{{ Form::open(['route' => 'update.complete', 'method' => 'GET']) }}
|
||||
<p style="text-align: right">
|
||||
{{ Form::submit('Finish >>', ['class' => 'btn btn-success']) }}
|
||||
</p>
|
||||
{{ Form::close() }}
|
||||
@endsection
|
||||
30
modules/Updater/composer.json
Normal file
30
modules/Updater/composer.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "phpvms/updater",
|
||||
"license": "",
|
||||
"type": "laravel-library",
|
||||
"description": "The installer module for phpVMS",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nabeel Shahzad",
|
||||
"email": "nabeel@phpvms.net"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"composer/installers": "~1.0"
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Modules\\Updater\\Providers\\UpdateServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Modules\\Installer\\": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
14
modules/Updater/module.json
Normal file
14
modules/Updater/module.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "Updater",
|
||||
"alias": "updater",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"active": 1,
|
||||
"order": 0,
|
||||
"providers": [
|
||||
"Modules\\Updater\\Providers\\UpdateServiceProvider"
|
||||
],
|
||||
"aliases": {},
|
||||
"files": [],
|
||||
"requires": []
|
||||
}
|
||||
Reference in New Issue
Block a user