Merge branch '114-refresh-system-version-in-system-tab' into develop

# Conflicts:
#	public/js/app.js
This commit is contained in:
Dennis
2022-07-01 07:52:21 +02:00
7 changed files with 580 additions and 11 deletions

View File

@@ -2,17 +2,25 @@
namespace App\Http\Controllers\Admin;
use Inertia\Response;
use Illuminate\Http\Request;
use App\Jobs\Core\UpdateSystem;
use App\Services\VersionChecker;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
class SystemController extends Controller
{
public function index(MasterSupervisorRepository $masterSupervisorRepository)
public function index(Request $request, MasterSupervisorRepository $masterSupervisorRepository): Response|RedirectResponse
{
$version = (new VersionChecker)->getVersions();
if ($request->input('flush', false)) {
app(VersionChecker::class)->flushVersionData();
return redirect()->route('admin.system')->with('success', __('Refreshed versions'));
}
$version = app(VersionChecker::class)->getVersions();
return inertia('Admin/System', [
'version' => [
@@ -20,11 +28,11 @@ class SystemController extends Controller
'current' => $version->currentVersion,
'remote' => $version->remoteVersion
],
'horizonRunning' => !!$masterSupervisorRepository->all()
'horizonRunning' => (bool) $masterSupervisorRepository->all(),
]);
}
public function update(Request $request)
public function update(Request $request): RedirectResponse
{
dispatch(new UpdateSystem);

View File

@@ -2,6 +2,8 @@
namespace App\Services;
use Exception;
class VersionChecker
{
public $remoteVersion;
@@ -35,12 +37,13 @@ class VersionChecker
return $this->currentVersion < $this->remoteVersion || $this->currentVersion != $this->remoteVersion;
}
public function flushVersionData()
public function flushVersionData(): void
{
try {
cache()->forget('ploi-core-current-version');
cache()->forget('ploi-core-remote-version');
} catch (\Exception $exception) {
} catch (Exception $exception) {
//
}
}
}

View File

@@ -40,7 +40,8 @@
"pestphp/pest": "^1.21",
"pestphp/pest-plugin-laravel": "^1.2",
"phpunit/phpunit": "^9.5.4",
"spatie/laravel-ignition": "^1.0"
"spatie/laravel-ignition": "^1.0",
"spatie/laravel-ray": "^1.29"
},
"config": {
"optimize-autoloader": true,

548
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "373a2d3f4d67471c02e3daf910f92f96",
"content-hash": "5082d89d1a3df202446c0b0fe37769e5",
"packages": [
{
"name": "aws/aws-crt-php",
@@ -9978,6 +9978,59 @@
],
"time": "2022-06-19T12:14:25+00:00"
},
{
"name": "pimple/pimple",
"version": "v3.5.0",
"source": {
"type": "git",
"url": "https://github.com/silexphp/Pimple.git",
"reference": "a94b3a4db7fb774b3d78dad2315ddc07629e1bed"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/silexphp/Pimple/zipball/a94b3a4db7fb774b3d78dad2315ddc07629e1bed",
"reference": "a94b3a4db7fb774b3d78dad2315ddc07629e1bed",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"psr/container": "^1.1 || ^2.0"
},
"require-dev": {
"symfony/phpunit-bridge": "^5.4@dev"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.4.x-dev"
}
},
"autoload": {
"psr-0": {
"Pimple": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "Pimple, a simple Dependency Injection Container",
"homepage": "https://pimple.symfony.com",
"keywords": [
"container",
"dependency injection"
],
"support": {
"source": "https://github.com/silexphp/Pimple/tree/v3.5.0"
},
"time": "2021-10-28T11:13:42+00:00"
},
{
"name": "psr/cache",
"version": "3.0.0",
@@ -11287,6 +11340,215 @@
],
"time": "2022-06-17T06:28:57+00:00"
},
{
"name": "spatie/laravel-ray",
"version": "1.29.7",
"source": {
"type": "git",
"url": "https://github.com/spatie/laravel-ray.git",
"reference": "97b8ccdb9975e3339069765417990e89474254ee"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/laravel-ray/zipball/97b8ccdb9975e3339069765417990e89474254ee",
"reference": "97b8ccdb9975e3339069765417990e89474254ee",
"shasum": ""
},
"require": {
"ext-json": "*",
"illuminate/contracts": "^7.20|^8.19|^9.0",
"illuminate/database": "^7.20|^8.19|^9.0",
"illuminate/queue": "^7.20|^8.19|^9.0",
"illuminate/support": "^7.20|^8.19|^9.0",
"php": "^7.3|^8.0",
"spatie/backtrace": "^1.0",
"spatie/ray": "^1.33",
"symfony/stopwatch": "4.2|^5.1|^6.0",
"zbateson/mail-mime-parser": "^1.3.1|^2.0"
},
"require-dev": {
"guzzlehttp/guzzle": "^7.3",
"laravel/framework": "^7.20|^8.19|^9.0",
"orchestra/testbench-core": "^5.0|^6.0|^7.0",
"phpstan/phpstan": "^0.12.93",
"phpunit/phpunit": "^9.3",
"spatie/phpunit-snapshot-assertions": "^4.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.29.x-dev"
},
"laravel": {
"providers": [
"Spatie\\LaravelRay\\RayServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Spatie\\LaravelRay\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Freek Van der Herten",
"email": "freek@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
}
],
"description": "Easily debug Laravel apps",
"homepage": "https://github.com/spatie/laravel-ray",
"keywords": [
"laravel-ray",
"spatie"
],
"support": {
"issues": "https://github.com/spatie/laravel-ray/issues",
"source": "https://github.com/spatie/laravel-ray/tree/1.29.7"
},
"funding": [
{
"url": "https://github.com/sponsors/spatie",
"type": "github"
},
{
"url": "https://spatie.be/open-source/support-us",
"type": "other"
}
],
"time": "2022-05-27T18:45:58+00:00"
},
{
"name": "spatie/macroable",
"version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/spatie/macroable.git",
"reference": "ec2c320f932e730607aff8052c44183cf3ecb072"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/macroable/zipball/ec2c320f932e730607aff8052c44183cf3ecb072",
"reference": "ec2c320f932e730607aff8052c44183cf3ecb072",
"shasum": ""
},
"require": {
"php": "^8.0"
},
"require-dev": {
"phpunit/phpunit": "^8.0|^9.3"
},
"type": "library",
"autoload": {
"psr-4": {
"Spatie\\Macroable\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Freek Van der Herten",
"email": "freek@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
}
],
"description": "A trait to dynamically add methods to a class",
"homepage": "https://github.com/spatie/macroable",
"keywords": [
"macroable",
"spatie"
],
"support": {
"issues": "https://github.com/spatie/macroable/issues",
"source": "https://github.com/spatie/macroable/tree/2.0.0"
},
"time": "2021-03-26T22:39:02+00:00"
},
{
"name": "spatie/ray",
"version": "1.34.5",
"source": {
"type": "git",
"url": "https://github.com/spatie/ray.git",
"reference": "2d64ea264eecbdc7ec01e4e8b45978cae80815d2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/ray/zipball/2d64ea264eecbdc7ec01e4e8b45978cae80815d2",
"reference": "2d64ea264eecbdc7ec01e4e8b45978cae80815d2",
"shasum": ""
},
"require": {
"ext-curl": "*",
"ext-json": "*",
"php": "^7.3|^8.0",
"ramsey/uuid": "^3.0|^4.1",
"spatie/backtrace": "^1.1",
"spatie/macroable": "^1.0|^2.0",
"symfony/stopwatch": "^4.0|^5.1|^6.0",
"symfony/var-dumper": "^4.2|^5.1|^6.0"
},
"require-dev": {
"illuminate/support": "6.x|^8.18|^9.0",
"nesbot/carbon": "^2.43",
"phpstan/phpstan": "^0.12.92",
"phpunit/phpunit": "^9.5",
"spatie/phpunit-snapshot-assertions": "^4.2",
"spatie/test-time": "^1.2"
},
"type": "library",
"autoload": {
"files": [
"src/helpers.php"
],
"psr-4": {
"Spatie\\Ray\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Freek Van der Herten",
"email": "freek@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
}
],
"description": "Debug with Ray to fix problems faster",
"homepage": "https://github.com/spatie/ray",
"keywords": [
"ray",
"spatie"
],
"support": {
"issues": "https://github.com/spatie/ray/issues",
"source": "https://github.com/spatie/ray/tree/1.34.5"
},
"funding": [
{
"url": "https://github.com/sponsors/spatie",
"type": "github"
},
{
"url": "https://spatie.be/open-source/support-us",
"type": "other"
}
],
"time": "2022-06-03T12:32:57+00:00"
},
{
"name": "symfony/debug",
"version": "v4.4.41",
@@ -11486,6 +11748,89 @@
],
"time": "2022-02-25T11:15:52+00:00"
},
{
"name": "symfony/polyfill-iconv",
"version": "v1.26.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-iconv.git",
"reference": "143f1881e655bebca1312722af8068de235ae5dc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/143f1881e655bebca1312722af8068de235ae5dc",
"reference": "143f1881e655bebca1312722af8068de235ae5dc",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"provide": {
"ext-iconv": "*"
},
"suggest": {
"ext-iconv": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.26-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Iconv\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Iconv extension",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"iconv",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-iconv/tree/v1.26.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2022-05-24T11:49:31+00:00"
},
{
"name": "symfony/stopwatch",
"version": "v6.1.0",
@@ -11597,6 +11942,207 @@
}
],
"time": "2021-07-28T10:34:58+00:00"
},
{
"name": "zbateson/mail-mime-parser",
"version": "2.2.1",
"source": {
"type": "git",
"url": "https://github.com/zbateson/mail-mime-parser.git",
"reference": "24955de7ec352b3258c1d4551efd21202cb8710c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zbateson/mail-mime-parser/zipball/24955de7ec352b3258c1d4551efd21202cb8710c",
"reference": "24955de7ec352b3258c1d4551efd21202cb8710c",
"shasum": ""
},
"require": {
"guzzlehttp/psr7": "^1.7.0|^2.0",
"php": ">=5.4",
"pimple/pimple": "^3.0",
"zbateson/mb-wrapper": "^1.0.1",
"zbateson/stream-decorators": "^1.0.6"
},
"require-dev": {
"mikey179/vfsstream": "^1.6.0",
"sanmai/phpunit-legacy-adapter": "^6.3 || ^8.2"
},
"suggest": {
"ext-iconv": "For best support/performance",
"ext-mbstring": "For best support/performance"
},
"type": "library",
"autoload": {
"psr-4": {
"ZBateson\\MailMimeParser\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-2-Clause"
],
"authors": [
{
"name": "Zaahid Bateson"
},
{
"name": "Contributors",
"homepage": "https://github.com/zbateson/mail-mime-parser/graphs/contributors"
}
],
"description": "MIME email message parser",
"homepage": "https://mail-mime-parser.org",
"keywords": [
"MimeMailParser",
"email",
"mail",
"mailparse",
"mime",
"mimeparse",
"parser",
"php-imap"
],
"support": {
"docs": "https://mail-mime-parser.org/#usage-guide",
"issues": "https://github.com/zbateson/mail-mime-parser/issues",
"source": "https://github.com/zbateson/mail-mime-parser"
},
"funding": [
{
"url": "https://github.com/zbateson",
"type": "github"
}
],
"time": "2022-02-22T21:35:59+00:00"
},
{
"name": "zbateson/mb-wrapper",
"version": "1.1.2",
"source": {
"type": "git",
"url": "https://github.com/zbateson/mb-wrapper.git",
"reference": "5d9d190ef18ce6d424e3ac6f5ebe13901f92b74a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zbateson/mb-wrapper/zipball/5d9d190ef18ce6d424e3ac6f5ebe13901f92b74a",
"reference": "5d9d190ef18ce6d424e3ac6f5ebe13901f92b74a",
"shasum": ""
},
"require": {
"php": ">=5.4",
"symfony/polyfill-iconv": "^1.9",
"symfony/polyfill-mbstring": "^1.9"
},
"require-dev": {
"sanmai/phpunit-legacy-adapter": "^6.3 || ^8"
},
"suggest": {
"ext-iconv": "For best support/performance",
"ext-mbstring": "For best support/performance"
},
"type": "library",
"autoload": {
"psr-4": {
"ZBateson\\MbWrapper\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-2-Clause"
],
"authors": [
{
"name": "Zaahid Bateson"
}
],
"description": "Wrapper for mbstring with fallback to iconv for encoding conversion and string manipulation",
"keywords": [
"charset",
"encoding",
"http",
"iconv",
"mail",
"mb",
"mb_convert_encoding",
"mbstring",
"mime",
"multibyte",
"string"
],
"support": {
"issues": "https://github.com/zbateson/mb-wrapper/issues",
"source": "https://github.com/zbateson/mb-wrapper/tree/1.1.2"
},
"funding": [
{
"url": "https://github.com/zbateson",
"type": "github"
}
],
"time": "2022-05-26T15:55:05+00:00"
},
{
"name": "zbateson/stream-decorators",
"version": "1.0.6",
"source": {
"type": "git",
"url": "https://github.com/zbateson/stream-decorators.git",
"reference": "3403c4323bd1cd15fe54348b031b26b064c706af"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zbateson/stream-decorators/zipball/3403c4323bd1cd15fe54348b031b26b064c706af",
"reference": "3403c4323bd1cd15fe54348b031b26b064c706af",
"shasum": ""
},
"require": {
"guzzlehttp/psr7": "^1.7.0|^2.0",
"php": ">=5.4",
"zbateson/mb-wrapper": "^1.0.0"
},
"require-dev": {
"sanmai/phpunit-legacy-adapter": "^6.3 || ^8"
},
"type": "library",
"autoload": {
"psr-4": {
"ZBateson\\StreamDecorators\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-2-Clause"
],
"authors": [
{
"name": "Zaahid Bateson"
}
],
"description": "PHP psr7 stream decorators for mime message part streams",
"keywords": [
"base64",
"charset",
"decorators",
"mail",
"mime",
"psr7",
"quoted-printable",
"stream",
"uuencode"
],
"support": {
"issues": "https://github.com/zbateson/stream-decorators/issues",
"source": "https://github.com/zbateson/stream-decorators/tree/1.0.6"
},
"funding": [
{
"url": "https://github.com/zbateson",
"type": "github"
}
],
"time": "2021-07-08T19:01:59+00:00"
}
],
"aliases": [],

4
public/js/app.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
{
"/js/app.js": "/js/app.js?id=9ee803044beb658de1ea",
"/css/app.css": "/css/app.css?id=41639892ced7cdee7205"
"/js/app.js": "/js/app.js?id=1431da8af1971538c7cd",
"/css/app.css": "/css/app.css?id=e8dff6de4f81212f4866"
}

View File

@@ -25,7 +25,10 @@
<template #content>
<p>{{ __('Current version') }}: {{ version.current }}</p>
<p>{{ __('Remote version') }}: {{ version.remote }}</p>
<p>
{{ __('Remote version') }}: {{ version.remote }}
<button class="text-primary" type="button" v-on:click="refreshVersions">{{ 'Refresh' }}</button>
</p>
<p>Horizon worker status: <span v-if="horizonRunning" class="text-success">Active</span><span v-else class="text-danger">Inactive</span></p>
<div v-if="version.out_of_date && !updating" class="bg-primary text-on-primary px-4 py-3 rounded relative space-y-2" role="alert">
@@ -125,6 +128,10 @@
methods: {
useNotification,
refreshVersions() {
this.$inertia.get(this.route('admin.system') + '?flush=true');
}
}
}
</script>