mirror of
https://github.com/codeigniter4/CodeIgniter4.git
synced 2025-02-20 11:44:28 +08:00
move check to CodeIgniter class
This commit is contained in:
parent
61a886726f
commit
bd65ddf5e8
@ -25,7 +25,6 @@ $paths = new Config\Paths();
|
||||
// Location of the framework bootstrap file.
|
||||
$bootstrap = rtrim($paths->systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'bootstrap.php';
|
||||
$app = require realpath($bootstrap) ?: $bootstrap;
|
||||
CodeIgniter\PhpRequirement::validatePHPVersion();
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
|
1
spark
1
spark
@ -43,7 +43,6 @@ chdir(FCPATH);
|
||||
|
||||
$bootstrap = rtrim($paths->systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'bootstrap.php';
|
||||
$app = require realpath($bootstrap) ?: $bootstrap;
|
||||
CodeIgniter\PhpRequirement::validatePHPVersion();
|
||||
|
||||
// Grab our Console
|
||||
$console = new CodeIgniter\CLI\Console($app);
|
||||
|
@ -46,6 +46,11 @@ class CodeIgniter
|
||||
*/
|
||||
const CI_VERSION = '4.1.1';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const MIN_PHP_VERSION = '7.3';
|
||||
|
||||
/**
|
||||
* App startup time.
|
||||
*
|
||||
@ -147,6 +152,17 @@ class CodeIgniter
|
||||
*/
|
||||
public function __construct(App $config)
|
||||
{
|
||||
if (version_compare(PHP_VERSION, self::MIN_PHP_VERSION, '<'))
|
||||
{
|
||||
die(
|
||||
sprintf(
|
||||
'Your PHP version must be %s or higher to run CodeIgniter. Current version: %s',
|
||||
self::MIN_PHP_VERSION,
|
||||
PHP_VERSION
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$this->startTime = microtime(true);
|
||||
$this->config = $config;
|
||||
}
|
||||
|
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the CodeIgniter 4 framework.
|
||||
*
|
||||
* (c) CodeIgniter Foundation <admin@codeigniter.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CodeIgniter;
|
||||
|
||||
final class PhpRequirement
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const MIN_PHP_VERSION = '7.3';
|
||||
|
||||
public static function validatePHPVersion(): void
|
||||
{
|
||||
if (! version_compare(PHP_VERSION, self::MIN_PHP_VERSION, '<'))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
die(
|
||||
sprintf(
|
||||
'Your PHP version must be %s or higher to run CodeIgniter. Current version: %s',
|
||||
self::MIN_PHP_VERSION,
|
||||
PHP_VERSION
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user