Skip to content

Commit

Permalink
Add supported_php
Browse files Browse the repository at this point in the history
  • Loading branch information
mattstauffer committed Aug 25, 2023
1 parent d2080ea commit a522ca2
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 57 deletions.
8 changes: 3 additions & 5 deletions app/Console/Commands/FetchLatestReleaseNumbers.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,15 @@ public function handle(): int
$this->fetchVersionsFromGitHub()
->each(function ($item) use ($manualData) {
$semver = new Version($item['name']);
$firstReleaseSemver = $semver->major > 5 ? $semver->major . '.0.0' : $semver->major . '.' . $semver->minor . '.0';
$firstRelease = LaravelVersion::where('first_release', $firstReleaseSemver)->first();
$manualMajor = $manualData[$semver->major > 5 ? $semver->major : $semver->major . '.' . $semver->minor];

$versionMeta = [
'changelog' => $item['changelog'],
'order' => LaravelVersion::calculateOrder($semver->major, $semver->minor, $semver->patch),
'released_at' => Carbon::parse($item['released_at'])->format('Y-m-d'),
'ends_bugfixes_at' => $firstRelease ? $firstRelease->ends_bugfixes_at : $manualMajor->ends_bugfixes_at,
'ends_securityfixes_at' => $firstRelease ? $firstRelease->ends_securityfixes_at : $manualMajor->ends_securityfixes_at,
// @todo: Add a "supported_php" property in a migration, and I GUESS just add it to all of them here
'ends_bugfixes_at' => $manualMajor->ends_bugfixes_at,
'ends_securityfixes_at' => $manualMajor->ends_securityfixes_at,
'supported_php' => $manualMajor->supported_php,
];

$version = LaravelVersion::withoutGlobalScope('first')
Expand Down
1 change: 1 addition & 0 deletions app/Http/Resources/LaravelVersionResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public function toArray($request): array
'released_at' => $this->released_at,
'ends_bugfixes_at' => $this->ends_bugfixes_at,
'ends_securityfixes_at' => $this->ends_securityfixes_at,
'supported_php' => explode(', ', $this->supported_php),
'status' => $this->status,
$this->mergeWhen($this->specificVersionProvided($request), [
'specific_version' => [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('laravel_versions', function (Blueprint $table) {
$table->string('supported_php')->nullable();
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('laravel_versions', function (Blueprint $table) {
$table->dropColumn('supported_php');
});
}
};
44 changes: 22 additions & 22 deletions manual-version-info.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,132 +3,132 @@
"release": "10",
"ends_bugfixes_at": "2024-08-07",
"ends_securityfixes_at": "2025-02-07",
"php_versions": "8.1, 8.2, (8.3)"
"supported_php": "8.1, 8.2, (8.3)"
},
{
"release": "9",
"ends_bugfixes_at": "2023-08-08",
"ends_securityfixes_at": "2024-02-08",
"php_versions": "8.0, 8.1, 8.2, (8.3)"
"supported_php": "8.0, 8.1, 8.2, (8.3)"
},
{
"release": "8",
"ends_bugfixes_at": "2022-07-26",
"ends_securityfixes_at": "2023-01-24",
"php_versions": "7.3, 7.4, 8.0"
"supported_php": "7.3, 7.4, 8.0"
},
{
"release": "7",
"ends_bugfixes_at": "2020-10-06",
"ends_securityfixes_at": "2021-03-03",
"php_versions": "7.2, 7.3, 7.4, 8.0"
"supported_php": "7.2, 7.3, 7.4, 8.0"
},
{
"release": "6",
"ends_bugfixes_at": "2021-09-07",
"ends_securityfixes_at": "2022-09-06",
"php_versions": "7.2, 7.3, 7.4"
"supported_php": "7.2, 7.3, 7.4"
},
{
"release": "5.8",
"ends_bugfixes_at": "2019-08-26",
"ends_securityfixes_at": "2020-02-26",
"php_versions": "7.1, 7.2, 7.3 (maybe 7.4)"
"supported_php": "7.1, 7.2, 7.3, 7.4?"
},
{
"release": "5.7",
"ends_bugfixes_at": "2019-03-04",
"ends_securityfixes_at": "2019-09-04",
"php_versions": "7.1, 7.2, 7.3 (maybe 7.4)"
"supported_php": "7.1, 7.2, 7.3, 7.4?"
},
{
"release": "5.6",
"ends_bugfixes_at": "2018-08-07",
"ends_securityfixes_at": "2019-02-07",
"php_versions": "7.1, 7.2, 7.3 (maybe 7.4)"
"supported_php": "7.1, 7.2, 7.3, 7.4?"
},
{
"release": "5.5",
"ends_bugfixes_at": "2019-08-30",
"ends_securityfixes_at": "2020-08-30",
"php_versions": "7.0, 7.1, 7.2"
"supported_php": "7.0, 7.1, 7.2"
},
{
"release": "5.4",
"ends_bugfixes_at": "2017-07-24",
"ends_securityfixes_at": "2018-01-24",
"php_versions": "5.6, 7.0, 7.1"
"supported_php": "5.6, 7.0, 7.1"
},
{
"release": "5.3",
"ends_bugfixes_at": "2017-02-23",
"ends_securityfixes_at": "2017-08-23",
"php_versions": "5.6, 7.0"
"supported_php": "5.6, 7.0"
},
{
"release": "5.2",
"ends_bugfixes_at": "2016-06-21",
"ends_securityfixes_at": "2016-12-12",
"php_versions": "5.5, 5.6, 7.0"
"supported_php": "5.5, 5.6, 7.0"
},
{
"release": "5.1",
"ends_bugfixes_at": "2017-06-09",
"ends_securityfixes_at": "2018-06-09",
"php_versions": "5.5, 5.6 (maybe 7.0)"
"supported_php": "5.5, 5.6, 7.0?"
},
{
"release": "5.0",
"ends_bugfixes_at": "2015-08-04",
"ends_securityfixes_at": "2016-02-04",
"php_versions": "5.4, 5.5, 5.6"
"supported_php": "5.4, 5.5, 5.6"
},
{
"release": "4.2",
"ends_bugfixes_at": null,
"ends_securityfixes_at": null,
"php_versions": ""
"supported_php": ""
},
{
"release": "4.1",
"ends_bugfixes_at": null,
"ends_securityfixes_at": null,
"php_versions": ""
"supported_php": ""
},
{
"release": "4.0",
"ends_bugfixes_at": null,
"ends_securityfixes_at": null,
"php_versions": ""
"supported_php": ""
},
{
"release": "3.2",
"ends_bugfixes_at": null,
"ends_securityfixes_at": null,
"php_versions": ""
"supported_php": ""
},
{
"release": "3.1",
"ends_bugfixes_at": null,
"ends_securityfixes_at": null,
"php_versions": ""
"supported_php": ""
},
{
"release": "3.0",
"ends_bugfixes_at": null,
"ends_securityfixes_at": null,
"php_versions": ""
"supported_php": ""
},
{
"release": "2.0",
"ends_bugfixes_at": null,
"ends_securityfixes_at": null,
"php_versions": ""
"supported_php": ""
},
{
"release": "1.0",
"ends_bugfixes_at": null,
"ends_securityfixes_at": null,
"php_versions": ""
"supported_php": ""
}
]
12 changes: 9 additions & 3 deletions resources/views/partials/tables/current_table.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<table class="min-w-full divide-y divide-gray-200">
<thead>
<tr class="bg-gray-50">
<th scope="col" class="py-3 pl-6 font-medium tracking-wider text-left text-gray-500 uppercase lg:pl-8">
<th scope="col" class="py-3 pl-6 font-medium tracking-wider text-left text-gray-500 uppercase">
{{ __('Version') }}
</th>
<th scope="col" class="py-3 pl-6 font-medium tracking-wider text-left text-gray-500 uppercase lg:pl-8">
<th scope="col" class="py-3 pl-6 font-medium tracking-wider text-left text-gray-500 uppercase">
{{ __('Release date') }}
</th>
<th scope="col" class="py-3 pl-6 font-medium tracking-wider text-left text-gray-500 uppercase lg:pl-8">
Expand All @@ -18,6 +18,9 @@
<th scope="col" class="py-3 pl-6 font-medium tracking-wider text-left text-gray-500 uppercase lg:pl-8">
{{ __('Security Fixes Until') }}
</th>
<th scope="col" class="py-3 pl-6 text-xs font-medium tracking-wider text-left text-gray-500 uppercase">
{{ __('PHP Versions') }}
</th>
<th scope="col" class="py-3 pl-6 text-xs font-medium tracking-wider text-left text-gray-500 uppercase">
{{ __('Status') }}
</th>
Expand All @@ -34,7 +37,7 @@
}}</a>
</th>
<td class="px-6 py-4 text-sm text-gray-500 whitespace-nowrap">
{{ $version->released_at->gt(now())
{{ $version->released_at->gt(now())
? 'Q' . $version->released_at->quarter . ' ' . $version->released_at->year . ' (' . __('estimated') . ')'
: $version->released_at->translatedFormat(__('DateLongFormat')) }}

Expand All @@ -53,6 +56,9 @@
: $version->ends_securityfixes_at->translatedFormat(__('DateLongFormat')) }}
@endif
</td>
<td class="py-4 pl-6 text-sm text-gray-500 lg:pl-6 whitespace-nowrap">
{{ $version->supported_php }}
</td>
<td scope="col">
<div class="{{ $statusClassMap[$version->status] }}">
<span>{{ $statusTextMap[$version->status] }}</span>
Expand Down
52 changes: 29 additions & 23 deletions resources/views/partials/tables/eol_table.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,21 @@
<table class="min-w-full divide-y divide-gray-200">
<thead>
<tr class="bg-gray-50">
<th scope="col" class="py-3 pl-6 text-xs font-medium tracking-wider text-left text-gray-500 uppercase lg:pl-8">
<th scope="col" class="py-3 pl-6 text-xs font-medium tracking-wider text-left text-gray-500 uppercase">
{{ __('Version') }}
</th>
<th scope="col" class="py-3 pl-6 text-xs font-medium tracking-wider text-left text-gray-500 uppercase lg:pl-8">
<th scope="col" class="py-3 pl-6 text-xs font-medium tracking-wider text-left text-gray-500 uppercase">
{{ __('Release date') }}
</th>
<th scope="col" class="py-3 pl-6 text-xs font-medium tracking-wider text-left text-gray-500 uppercase lg:pl-8">
<th scope="col" class="py-3 pl-6 text-xs font-medium tracking-wider text-left text-gray-500 uppercase">
{{ __('Bug Fixes Until') }}
</th>
<th scope="col" class="py-3 pl-6 text-xs font-medium tracking-wider text-left text-gray-500 uppercase lg:pl-8">
<th scope="col" class="py-3 pl-6 text-xs font-medium tracking-wider text-left text-gray-500 uppercase">
{{ __('Security Fixes Until') }}
</th>
<th scope="col" class="py-3 pl-6 text-xs font-medium tracking-wider text-left text-gray-500 uppercase">
{{ __('PHP Versions') }}
</th>
<th scope="col" class="py-3 pl-6 text-xs font-medium tracking-wider text-left text-gray-500 uppercase">
{{ __('Status') }}
</th>
Expand All @@ -32,41 +35,44 @@
<tbody class="bg-white divide-y divide-gray-200">

@foreach ($inactiveVersions as $version)
<tr>
<th class="px-6 py-4 text-sm font-medium text-left text-gray-900 whitespace-nowrap">
<a href="{{ $version->url }}" class="border-hover">{{ $version->major }}{{
<tr>
<th class="px-6 py-4 text-sm font-medium text-left text-gray-900 whitespace-nowrap">
<a href="{{ $version->url }}" class="border-hover">{{ $version->major }}{{
$version->major < 6
? '.' . $version->minor
: ''
}}</a>
</th>
<td class="px-6 py-4 text-sm text-gray-500 whitespace-nowrap">
{{
</th>
<td class="px-6 py-4 text-sm text-gray-500 whitespace-nowrap">
{{
$version->released_at->translatedFormat(__('DateLongFormat')) }} {{ $version->released_at->gt(now())
? '(' . __('estimated') . ')'
: ''
}}
</td>
<td class="px-6 py-4 text-sm text-gray-500 whitespace-nowrap">
{{
</td>
<td class="px-6 py-4 text-sm text-gray-500 whitespace-nowrap">
{{
$version->ends_bugfixes_at
? $version->ends_bugfixes_at->translatedFormat(__('DateLongFormat'))
: ''
}}
</td>
<td class="px-6 py-4 text-sm text-gray-500 whitespace-nowrap">
{{
</td>
<td class="px-6 py-4 text-sm text-gray-500 whitespace-nowrap">
{{
$version->ends_securityfixes_at
? $version->ends_securityfixes_at->translatedFormat(__('DateLongFormat'))
: ''
}}
</td>
<td scope="col">
<div class="{{ $statusClassMap[$version->status] }}">
<span>{{ $statusTextMap[$version->status] }}</span>
</div>
</td>
</tr>
</td>
<td class="py-4 pl-6 text-sm text-gray-500 lg:pl-6 whitespace-nowrap">
{{ $version->supported_php }}
</td>
<td scope="col">
<div class="{{ $statusClassMap[$version->status] }}">
<span>{{ $statusTextMap[$version->status] }}</span>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
Expand Down
14 changes: 10 additions & 4 deletions resources/views/partials/tables/show_table.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th scope="col" class="py-3 pl-6 text-xs font-medium tracking-wider text-left text-gray-500 uppercase lg:pl-8">
<th scope="col" class="py-3 pl-6 text-xs font-medium tracking-wider text-left text-gray-500 uppercase">
{{ __('Major Version') }}
</th>
<th scope="col" class="py-3 pl-6 text-xs font-medium tracking-wider text-left text-gray-500 uppercase lg:pl-8">
<th scope="col" class="py-3 pl-6 text-xs font-medium tracking-wider text-left text-gray-500 uppercase">
{{ __('Release date') }}
</th>
<th scope="col" class="py-3 pl-6 text-xs font-medium tracking-wider text-left text-gray-500 uppercase lg:pl-8">
<th scope="col" class="py-3 pl-6 text-xs font-medium tracking-wider text-left text-gray-500 uppercase">
{{ __('Bug Fixes Until') }}
</th>
<th scope="col" class="py-3 pl-6 text-xs font-medium tracking-wider text-left text-gray-500 uppercase lg:pl-8">
<th scope="col" class="py-3 pl-6 text-xs font-medium tracking-wider text-left text-gray-500 uppercase">
{{ __('Security Fixes Until') }}
</th>
<th scope="col" class="py-3 pl-6 text-xs font-medium tracking-wider text-left text-gray-500 uppercase">
{{ __('PHP Versions') }}
</th>
<th scope="col" class="py-3 pl-6 text-xs font-medium tracking-wider text-left text-gray-500 uppercase lg:pl-8">
{{ __('Status') }}
</th>
Expand Down Expand Up @@ -77,6 +80,9 @@
: ''
}}
</td>
<td class="px-6 py-4 text-sm text-gray-500 whitespace-nowrap">
{{ $version->supported_php }}
</td>
<td scope="col">
<div class="{{ $statusClassMap[$version->status] }}">
<span>{{ $statusTextMap[$version->status] }}</span>
Expand Down
1 change: 1 addition & 0 deletions tests/Feature/ApiListVersionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ private function getVersionsJsonResponse(Collection $versions): string
$versions = $versions->map(fn ($version) => [
'ends_bugfixes_at' => $version->ends_bugfixes_at,
'ends_securityfixes_at' => $version->ends_securityfixes_at,
'supported_php' => explode(', ', $version->supported_php),
'global' => [
'latest_version' => LaravelVersion::withoutGlobalScope('first')->latest('order')->first()->semver,
],
Expand Down

0 comments on commit a522ca2

Please sign in to comment.