Skip to content

Commit

Permalink
Determine minimum PHP version for WordPress core
Browse files Browse the repository at this point in the history
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/
  • Loading branch information
tangrufus committed May 27, 2019
1 parent 049d863 commit c5f9edf
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion bin/build-branch.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
Expand Down Expand Up @@ -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' => [
Expand Down

0 comments on commit c5f9edf

Please sign in to comment.