The current code is commented out, so we need to actually test that the library exists when the AMP module is enabled

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mtift created an issue. See original summary.

johnrosswvsu’s picture

Hi @mtift,

I have made a patch (plus 1) to check the existence of AMP Library in hook_requirements(). I have especially set the libraries dependency to >= 2.x. This may need more work especially on the pattern of the 'version arguments' in hook_libraries_info(). It will definitely need some improvement (PCRE RegEx!!!!). The file for checking the library version should also be checked if it is the actual file. I will attach two patches: (1) a patch that addresses the task only, (2) and one that addresses the issue and the coding standard.

I hope anyone can move on forward on this task using these preliminary patches that certain needs work.

Thanks.

johnrosswvsu’s picture

Please note that I have also set the check for the library during runtime only and not during install.

Thanks.

  • sidharth_k committed 271cbeb on 7.x-1.x
    Issue #2687715 by sidharth_k, mtift: hook_requirements for AMP PHP...
sidharth_k’s picture

Status: Needs work » Closed (fixed)

Thanks for your effort on this @johnrosswvsu But we're not using the hook_libraries_info , libraries etc approach. We're actually using composer manager which does not need all this.

Accordingly we will not be considering your patch for future inclusion -- sorry :-( !

Our approach is that of @mtift in Drupal 8 ( see http://cgit.drupalcode.org/amp/commit/?id=fcec721 )

Accordingly I've simply:
- Uncommented @mtifts preexisting hook_requirements code for Drupal 7 ( http://cgit.drupalcode.org/amp/commit/?id=262c259 )
- changed drupal_get_library to a !class_exists (like in the Drupal 8 implementation)
- Added a link to the composer manager homepage on drupal.org

sidharth_k’s picture

FileSize
26.62 KB

Here is a screenshot if the AMP PHP Library requirement is not met.

sidharth_k’s picture

sidharth_k’s picture

sidharth_k’s picture