Remove the autoupdater #1133 (#1195)

* Remove the autoupdater #1133

* Remove self-updater package

* Package still needed :|
This commit is contained in:
Nabeel S
2021-05-20 11:37:27 -04:00
committed by GitHub
parent 5adc0b4072
commit edcea258ce
9 changed files with 17 additions and 120 deletions

View File

@@ -7,9 +7,6 @@ use App\Events\CronNightly;
use App\Services\VersionService; use App\Services\VersionService;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
/**
* Determine if any pilots should be set to ON LEAVE status
*/
class NewVersionCheck extends Listener class NewVersionCheck extends Listener
{ {
private $versionSvc; private $versionSvc;

View File

@@ -7,29 +7,24 @@ use App\Repositories\KvpRepository;
use App\Services\CronService; use App\Services\CronService;
use App\Services\VersionService; use App\Services\VersionService;
use App\Support\Utils; use App\Support\Utils;
use Codedge\Updater\UpdaterManager;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Laracasts\Flash\Flash; use Laracasts\Flash\Flash;
use Nwidart\Modules\Facades\Module;
class MaintenanceController extends Controller class MaintenanceController extends Controller
{ {
private $cronSvc; private $cronSvc;
private $kvpRepo; private $kvpRepo;
private $updateManager;
private $versionSvc; private $versionSvc;
public function __construct( public function __construct(
CronService $cronSvc, CronService $cronSvc,
KvpRepository $kvpRepo, KvpRepository $kvpRepo,
UpdaterManager $updateManager,
VersionService $versionSvc VersionService $versionSvc
) { ) {
$this->cronSvc = $cronSvc; $this->cronSvc = $cronSvc;
$this->kvpRepo = $kvpRepo; $this->kvpRepo = $kvpRepo;
$this->updateManager = $updateManager;
$this->versionSvc = $versionSvc; $this->versionSvc = $versionSvc;
} }
@@ -106,24 +101,6 @@ class MaintenanceController extends Controller
return redirect(route('admin.maintenance.index')); return redirect(route('admin.maintenance.index'));
} }
/**
* Update the phpVMS install
*
* @param \Illuminate\Http\Request $request
*
* @return mixed
*/
public function update(Request $request)
{
$new_version_tag = $this->kvpRepo->get('latest_version_tag');
Log::info('Attempting to update to '.$new_version_tag);
$module = Module::find('updater');
$module->enable();
return redirect('/update/downloader');
}
/** /**
* Enable the cron, or if it's enabled, change the ID that is used * Enable the cron, or if it's enabled, change the ID that is used
* *

View File

@@ -3,49 +3,32 @@
namespace App\Http\Controllers\System; namespace App\Http\Controllers\System;
use App\Contracts\Controller; use App\Contracts\Controller;
use App\Repositories\KvpRepository;
use App\Services\AnalyticsService;
use App\Services\Installer\InstallerService; use App\Services\Installer\InstallerService;
use App\Services\Installer\MigrationService; use App\Services\Installer\MigrationService;
use App\Services\Installer\SeederService; use App\Services\Installer\SeederService;
use Codedge\Updater\UpdaterManager;
use function count; use function count;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\View\View;
class UpdateController extends Controller class UpdateController extends Controller
{ {
private $analyticsSvc;
private $installerSvc; private $installerSvc;
private $kvpRepo;
private $migrationSvc; private $migrationSvc;
private $seederSvc; private $seederSvc;
private $updateManager;
/** /**
* @param AnalyticsService $analyticsSvc
* @param InstallerService $installerSvc * @param InstallerService $installerSvc
* @param KvpRepository $kvpRepo
* @param MigrationService $migrationSvc * @param MigrationService $migrationSvc
* @param SeederService $seederSvc * @param SeederService $seederSvc
* @param UpdaterManager $updateManager
*/ */
public function __construct( public function __construct(
AnalyticsService $analyticsSvc,
InstallerService $installerSvc, InstallerService $installerSvc,
KvpRepository $kvpRepo,
MigrationService $migrationSvc, MigrationService $migrationSvc,
SeederService $seederSvc, SeederService $seederSvc
UpdaterManager $updateManager
) { ) {
$this->analyticsSvc = $analyticsSvc;
$this->migrationSvc = $migrationSvc; $this->migrationSvc = $migrationSvc;
$this->seederSvc = $seederSvc; $this->seederSvc = $seederSvc;
$this->installerSvc = $installerSvc; $this->installerSvc = $installerSvc;
$this->kvpRepo = $kvpRepo;
$this->updateManager = $updateManager;
} }
/** /**
@@ -107,38 +90,4 @@ class UpdateController extends Controller
{ {
return redirect('/admin'); return redirect('/admin');
} }
/**
* Show the update page with the latest version
*
* @return Factory|View
*/
public function updater()
{
$version = $this->kvpRepo->get('latest_version_tag');
return view('system.updater.downloader/downloader', [
'version' => $version,
]);
}
/**
* Download the actual update and then forward the user to the updater page
*
* @return mixed
*/
public function update_download()
{
$version = $this->kvpRepo->get('latest_version_tag');
if (empty($version)) {
return view('system.updater.steps.step1-no-update');
}
$release = $this->updateManager->source('github')->fetch($version);
$this->updateManager->source('github')->update($release);
$this->analyticsSvc->sendUpdate();
Log::info('Update completed to '.$version.', redirecting');
return redirect('/update');
}
} }

View File

@@ -90,10 +90,6 @@ class RouteServiceProvider extends ServiceProvider
Route::post('/run-migrations', 'UpdateController@run_migrations')->name('run_migrations'); Route::post('/run-migrations', 'UpdateController@run_migrations')->name('run_migrations');
Route::get('/complete', 'UpdateController@complete')->name('complete'); Route::get('/complete', 'UpdateController@complete')->name('complete');
// Routes for the update downloader
Route::get('/downloader', 'UpdateController@updater')->name('updater');
Route::post('/downloader', 'UpdateController@update_download')->name('update_download');
}); });
} }

26
composer.lock generated
View File

@@ -4,20 +4,20 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "882504a81fb8c4daf946022b51b73f93", "content-hash": "9306757768b0fad9102766b70d4e18d8",
"packages": [ "packages": [
{ {
"name": "akaunting/money", "name": "akaunting/money",
"version": "1.2.1", "version": "1.2.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/akaunting/laravel-money.git", "url": "https://github.com/akaunting/laravel-money.git",
"reference": "38e3af880653700d7e67ca028d6d5f422eda96b5" "reference": "a60cd786ac85e290ff1fa62b104ae04df2dcbd30"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/akaunting/laravel-money/zipball/38e3af880653700d7e67ca028d6d5f422eda96b5", "url": "https://api.github.com/repos/akaunting/laravel-money/zipball/a60cd786ac85e290ff1fa62b104ae04df2dcbd30",
"reference": "38e3af880653700d7e67ca028d6d5f422eda96b5", "reference": "a60cd786ac85e290ff1fa62b104ae04df2dcbd30",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -67,10 +67,10 @@
], ],
"support": { "support": {
"issues": "https://github.com/akaunting/laravel-money/issues", "issues": "https://github.com/akaunting/laravel-money/issues",
"source": "https://github.com/akaunting/laravel-money/tree/1.2.1" "source": "https://github.com/akaunting/laravel-money/tree/1.2.2"
}, },
"abandoned": "akaunting/laravel-money", "abandoned": "akaunting/laravel-money",
"time": "2021-03-05T12:06:16+00:00" "time": "2021-05-19T19:42:05+00:00"
}, },
{ {
"name": "anhskohbo/no-captcha", "name": "anhskohbo/no-captcha",
@@ -1285,16 +1285,16 @@
}, },
{ {
"name": "doctrine/cache", "name": "doctrine/cache",
"version": "1.11.1", "version": "1.11.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/doctrine/cache.git", "url": "https://github.com/doctrine/cache.git",
"reference": "163074496dc7c3c7b8ccbf3d4376c0187424ed81" "reference": "9c53086695937c50c47936ed86d96150ffbcf60d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/doctrine/cache/zipball/163074496dc7c3c7b8ccbf3d4376c0187424ed81", "url": "https://api.github.com/repos/doctrine/cache/zipball/9c53086695937c50c47936ed86d96150ffbcf60d",
"reference": "163074496dc7c3c7b8ccbf3d4376c0187424ed81", "reference": "9c53086695937c50c47936ed86d96150ffbcf60d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1364,7 +1364,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/doctrine/cache/issues", "issues": "https://github.com/doctrine/cache/issues",
"source": "https://github.com/doctrine/cache/tree/1.11.1" "source": "https://github.com/doctrine/cache/tree/1.11.2"
}, },
"funding": [ "funding": [
{ {
@@ -1380,7 +1380,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-05-18T16:45:32+00:00" "time": "2021-05-20T14:57:29+00:00"
}, },
{ {
"name": "doctrine/dbal", "name": "doctrine/dbal",

View File

@@ -7,22 +7,12 @@
<div class="row" style="padding-top: 5px"> <div class="row" style="padding-top: 5px">
<div class="col-sm-12"> <div class="col-sm-12">
<div class="row"> <div class="row">
<div class="col-sm-6"> <div class="col-sm-12">
<p>Force new version check</p> <p>Force new version check</p>
{{ Form::open(['route' => 'admin.maintenance.forcecheck']) }} {{ Form::open(['route' => 'admin.maintenance.forcecheck']) }}
{{ Form::button('Force update check', ['type' => 'submit', 'class' => 'btn btn-success']) }} {{ Form::button('Force update check', ['type' => 'submit', 'class' => 'btn btn-success']) }}
{{ Form::close() }} {{ Form::close() }}
</div> </div>
<div class="col-sm-6">
@if ($new_version)
<p>An update to version {{ $new_version_tag }} is available.</p>
{{ Form::open(['route' => 'admin.maintenance.update']) }}
{{ Form::button('Update', ['type' => 'submit', 'class' => 'btn btn-success']) }}
{{ Form::close() }}
@else
<p>There is no new version available</p>
@endif
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -75,7 +75,7 @@
@endability @endability
@ability('admin', 'modules') @ability('admin', 'modules')
<li><a href="{!! url('/admin/modules') !!}"><i class="pe-7s-box2"></i>Modules Manager</a></li> <li><a href="{!! url('/admin/modules') !!}"><i class="pe-7s-box2"></i>addons/modules</a></li>
@endability @endability
@ability('admin', 'maintenance') @ability('admin', 'maintenance')

View File

@@ -1,5 +1,5 @@
@extends('admin.app') @extends('admin.app')
@section('title', "Modules Manager") @section('title', 'modules')
@section('actions') @section('actions')
<li> <li>
<a href="{{ route('admin.modules.create') }}"> <a href="{{ route('admin.modules.create') }}">

View File

@@ -1,12 +0,0 @@
@extends('system.updater.app')
@section('title', 'Update phpVMS')
@section('content')
<h2>phpvms updater</h2>
<p>Click run to complete the update to version {{ $version }}</p>
{{ Form::open(['route' => 'update.update_download', 'method' => 'post']) }}
<p style="text-align: right">
{{ Form::submit('Run >>', ['class' => 'btn btn-success']) }}
</p>
{{ Form::close() }}
@endsection