Add minimum PHP version

This commit is contained in:
Julian Prieber 2024-12-16 16:31:56 +01:00
parent ff4e3b3d83
commit 591e3743f5

View File

@ -4,8 +4,17 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use App\Models\Link; use App\Models\Link;
$minPhpVersion = '8.1.0';
set_time_limit(0); set_time_limit(0);
if (version_compare(PHP_VERSION, $minPhpVersion, '<')) {
session(['update_error' => "This update requires at least PHP version $minPhpVersion. Your current PHP version is " . PHP_VERSION]);
echo "<meta http-equiv='refresh' content='0;" . url()->current() . "/?error' />";
} else {
try { try {
if(!isset($preUpdateServer)){$preUpdateServer = 'https://pre-update.linkstack.org/';} if(!isset($preUpdateServer)){$preUpdateServer = 'https://pre-update.linkstack.org/';}
$file = Http::timeout(10)->get($preUpdateServer . 'update')->body(); $file = Http::timeout(10)->get($preUpdateServer . 'update')->body();
@ -81,3 +90,5 @@ if (!Schema::hasColumn('links', 'type_params')) {
} }
} }
} }
}