Skip to content

Commit

Permalink
Composer 2 checks for minimum PHP version, remove duplicated checks
Browse files Browse the repository at this point in the history
  • Loading branch information
mahagr committed Dec 8, 2021
1 parent 1f3f182 commit 3bfbb1a
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 22 deletions.
4 changes: 0 additions & 4 deletions bin/gpm
Expand Up @@ -25,10 +25,6 @@ if (!file_exists(__DIR__ . '/../vendor/autoload.php')){

$autoload = require __DIR__ . '/../vendor/autoload.php';

if (version_compare($ver = PHP_VERSION, $req = GRAV_PHP_MIN, '<')) {
exit(sprintf("You are running PHP %s, but Grav needs at least PHP %s to run.\n", $ver, $req));
}

if (!ini_get('date.timezone')) {
date_default_timezone_set('UTC');
}
Expand Down
4 changes: 0 additions & 4 deletions bin/grav
Expand Up @@ -25,10 +25,6 @@ if (!file_exists(__DIR__ . '/../vendor/autoload.php')){

$autoload = require __DIR__ . '/../vendor/autoload.php';

if (version_compare($ver = PHP_VERSION, $req = GRAV_PHP_MIN, '<')) {
exit(sprintf("You are running PHP %s, but Grav needs at least PHP %s to run.\n", $ver, $req));
}

if (!ini_get('date.timezone')) {
date_default_timezone_set('UTC');
}
Expand Down
4 changes: 0 additions & 4 deletions bin/plugin
Expand Up @@ -25,10 +25,6 @@ if (!file_exists(__DIR__ . '/../vendor/autoload.php')){

$autoload = require __DIR__ . '/../vendor/autoload.php';

if (version_compare($ver = PHP_VERSION, $req = GRAV_PHP_MIN, '<')) {
exit(sprintf("You are running PHP %s, but Grav needs at least PHP %s to run.\n", $ver, $req));
}

if (!ini_get('date.timezone')) {
date_default_timezone_set('UTC');
}
Expand Down
4 changes: 0 additions & 4 deletions index.php
Expand Up @@ -12,10 +12,6 @@
\define('GRAV_REQUEST_TIME', microtime(true));
\define('GRAV_PHP_MIN', '7.3.6');

if (version_compare($ver = PHP_VERSION, $req = GRAV_PHP_MIN, '<')) {
die(sprintf('You are running PHP %s, but Grav needs at least <strong>PHP %s</strong> to run.', $ver, $req));
}

if (PHP_SAPI === 'cli-server') {
$symfony_server = stripos(getenv('_'), 'symfony') !== false || stripos($_SERVER['SERVER_SOFTWARE'] ?? '', 'symfony') !== false || stripos($_ENV['SERVER_SOFTWARE'] ?? '', 'symfony') !== false;

Expand Down
4 changes: 2 additions & 2 deletions system/router.php
Expand Up @@ -22,9 +22,9 @@
// Block all direct access for these folders
|| preg_match('`^/(\.git|cache|bin|logs|backup|webserver-configs|tests)/`ui', $path)
// Block access to specific file types for these system folders
|| preg_match('`^/(system|vendor)/(.*)\.(txt|xml|md|html|yaml|yml|php|pl|py|cgi|twig|sh|bat)$`ui', $path)
|| preg_match('`^/(system|vendor)/(.*)\.(txt|xml|md|html|json|yaml|yml|php|pl|py|cgi|twig|sh|bat)$`ui', $path)
// Block access to specific file types for these user folders
|| preg_match('`^/(user)/(.*)\.(txt|md|yaml|yml|php|pl|py|cgi|twig|sh|bat)$`ui', $path)
|| preg_match('`^/(user)/(.*)\.(txt|md|json|yaml|yml|php|pl|py|cgi|twig|sh|bat)$`ui', $path)
// Block all direct access to .md files
|| preg_match('`\.md$`ui', $path)
// Block access to specific files in the root folder
Expand Down
4 changes: 0 additions & 4 deletions tests/phpstan/plugins-bootstrap.php
Expand Up @@ -10,10 +10,6 @@

$autoload = require __DIR__ . '/../../vendor/autoload.php';

if (version_compare($ver = PHP_VERSION, $req = GRAV_PHP_MIN, '<')) {
exit(sprintf("You are running PHP %s, but Grav needs at least PHP %s to run.\n", $ver, $req));
}

if (!ini_get('date.timezone')) {
date_default_timezone_set('UTC');
}
Expand Down

0 comments on commit 3bfbb1a

Please sign in to comment.