From c5f9edf0a609ed77c9b784483d8d09e66403eaef Mon Sep 17 00:00:00 2001 From: Tang Rufus Date: Sat, 25 May 2019 17:52:01 +0100 Subject: [PATCH] Determine minimum PHP version for WordPress core This implementation breaks for non-stable versions, i.e: `beta` and `rc`. https://github.com/ItinerisLtd/wordpress/blob/1d34138b86fb5500480c97fba159b30afbe2a87d/src/MinPhpVersion.php would be a more robust alternative. However, it requires introducing `composer` to the build system. See: - https://wordpress.org/news/2019/04/minimum-php-version-update/ - http://displaywp.com/wordpress-minimum-php-version/ --- bin/build-branch.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/bin/build-branch.php b/bin/build-branch.php index d1473a8..fccb00a 100755 --- a/bin/build-branch.php +++ b/bin/build-branch.php @@ -29,8 +29,20 @@ function getLicense() EOT; } +function minPhpVersionFor(string $version): string +{ + $minPhpVersion = '5.6.20'; + if (version_compare($version, '5.2', '<')) { + $minPhpVersion = '5.2.4'; + } + + return $minPhpVersion; +} + function makeComposerPackage($version, $zipURL) { + $minPhpVersion = minPhpVersionFor($version); + return [ 'name' => 'roots/wordpress', 'description' => 'WordPress is web software you can use to create a beautiful website or blog.', @@ -59,7 +71,7 @@ function makeComposerPackage($version, $zipURL) 'type' => 'wordpress-core', 'version' => $version, 'require' => [ - 'php' => '>=5.3.2', + 'php' => ">=${minPhpVersion}", 'roots/wordpress-core-installer' => '>=1.0.0' ], 'dist' => [