I downloaded the mailgun project's latest release -- because of fixed security issues -- and found I needed to follow the instructions in this comment in order for the library to be located:
https://www.drupal.org/node/2547591#comment-11804377
that is:
cd sites/all/libraries/mailgun
composer require --update-no-dev mailgun/mailgun-php
I also found that I need to add:
composer require php-http/guzzle6-adapter
... because the 'message factory' required by php-http/message is only included in --dev composer builds!
Additionally, a patch is needed to the library detect code because the mailgun library file is now Api.php rather than Constants.php, and the pattern used in the module to extract the version no longer matches: the code now uses ' rather than " strings.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | 2866627-mailgun-library-info-10.patch | 1.07 KB | bohart |
Comments
Comment #2
rivimeyThe attached patch 'works for me': I expect it will fail on older-than-2.1 versions of the Mailgun php library (possibly not even v2.0), however.
I expect that could be avoided by recoding the version arguments as a version callback function, but that is for another day.
Note: there are two library 'version' numbers in play here: the SDK version and the code version. The SDK version appears to be related to the library API (1.7 at present), while the code version is the thing tagged in git (2.1.2 at present). The code version does not appear to be present in the downloaded code, making it hard to adapt :(
Comment #3
rivimeyComment #4
rivimeyComment #5
balagan commentedI have followed your install instructions, and applied the patch. It's all good, I have successfully sent myself a test email from devel/php using the current API.
Comment #6
tijsdeboeckHad to manually apply the patch, but the code works.
Comment #7
sokru commentedUpdated patch so it applies cleanly on latest -dev.
Comment #8
jackbravo commentedYou don't need to run any composer command other than "composer install". In particular:
> composer require --update-no-dev mailgun/mailgun-php
would download the same as the zip that you already downloaded from github: the mailgun-php library.
The patch needs this change:
+ 'file' => 'src/Mailgun/Constants/Api.php',
instead of
+ 'file' => 'vendor/mailgun/mailgun-php/src/Mailgun/Constants/Api.php',
Comment #9
rivimeyHi jackbravo, the patch was designed to pull mailgun from composer, no zip required. Other workflows are available :)
Comment #10
bohart1) Mailgun does not update those files for SDK versions:
It always said the same for any versions.
Additionally, those files are deprecated and will be removed in 3.0 release.
2) The only one place where SDK version updated is CHANGELOG.md file.
3) Drupal 7 requires PHP 5.2, Mailgun module requires PHP 5.3.
That's why should not use short array syntax (introduced in PHP 5.4).
An updated patch attached.
Comment #11
bohartIn the meantime, I have updated the installation section of the documentation:
https://www.drupal.org/node/2547591
Comment #13
matroskeenHi @bohart, your patch works well for me. It is committed to 7.x-1.x.
Other guys, thank you for your activity!
Comment #15
rivimey