• totten's avatar
    (drupal#79) Fail more gracefully when attempting to install on PHP 5.x · 1f180621
    totten authored
    Before
    ------
    
    If an admin stracts the code and navigates to `/sites/all/modules/civicrm/install/index.php`, it displays
    a syntax error.
    
    After
    -----
    
    If an admin stracts the code and navigates to `/sites/all/modules/civicrm/install/index.php`, it displays
    the message:
    
    > __PHP Version Requirement__
    > CiviCRM requires PHP 7.0+. The web server is running PHP 5.6.38.
    
    Comments
    --------
    
    This is similar to https://github.com/civicrm/civicrm-drupal/pull/583
    
    The canonical representation of the minimum PHP version is in
    `$civicrm_root/CRM/Upgrade/Form.php`.  However, setting up the classloader
    triggers a syntax error, so we need to read this without having access to
    the classloader.
    
    The approach herein has a few effects:
    
    * The minimum PHP can be read from a JSON file.
    * That JSON file is also used by `composer`, so you'll also get better errors when downloading that way.
    * At some unknown point, the minimum will probably bump up again (7.1 or 7.2 or whatever). When that
      happens, the unit-test will ensure we keep `CRM/Upgrade/Form.php` and `composer.json` in sync.
    
    Note: I was little concerned that the `composer.json` file might not be
    available when normal installers run, so I checked the published tarballs
    for D7, BD, WP, and J - in all cases, the `composer.json` looks to be
    included at the expected location.
    1f180621
Analyzing file…
composer.json 3.18 KB