Use composer patches to apply CiviCRM customisations for pear_mail
authorSeamus Lee <seamuslee001@gmail.com>
Fri, 20 Mar 2020 22:19:42 +0000 (09:19 +1100)
committerSeamus Lee <seamuslee001@gmail.com>
Fri, 20 Mar 2020 22:19:42 +0000 (09:19 +1100)
composer.json
composer.lock
tools/scripts/composer/patches/pear-mail.patch [deleted file]
tools/scripts/composer/pear-mail-fix.sh

index 005946c04f695f9bedad04391e22e9e95b89e4f9..9debce181a32e140b7af3b58b21a5acaadd4185c 100644 (file)
         "Support PHPUnit 6+": "https://github.com/php-cache/integration-tests/commit/1ec7362962185df91d3d749bc3fa7e7b99cb9fc7.patch",
         "Add tests for binary data round trip": "https://github.com/php-cache/integration-tests/commit/89cd7068e83aa776774bfc44f6bcba858c085616.patch"
       },
+      "pear/mail": {
+        "Apply CiviCRM Customisations for CRM-1367 and CRM-5946": "https://raw.githubusercontent.com/civicrm/civicrm-core/36319938a5bf26c1e7e2110a26a65db6a5979268/tools/scripts/composer/patches/pear-mail.patch"
+      },
       "pear/net_smtp": {
         "Add in CiviCRM custom error message for CRM-8744": "https://raw.githubusercontent.com/civicrm/civicrm-core/a6a0ff13d2a155ad962529595dceaef728116f96/tools/scripts/composer/patches/net-smtp-patch.patch"
       },
index b6daf4ece7c8bd25892ee1cdb48adcfd6a0079cd..4ec8844931d8a1605f027f4768abf0d3b4e179a8 100644 (file)
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "3d22226af501e1f685b799acc269da69",
+    "content-hash": "9c8e8054f45d5bdd4e18f45701527d2b",
     "packages": [
         {
             "name": "adrienrn/php-mimetyper",
                 {
                     "name": "Tobias Nyholm",
                     "email": "tobias.nyholm@gmail.com",
-                    "homepage": "https://github.com/nyholm"
+                    "homepage": "https://github.com/Nyholm"
                 },
                 {
                     "name": "Nicolas Grekas",
                 "pear/net_smtp": "Install optionally via your project's composer.json"
             },
             "type": "library",
+            "extra": {
+                "patches_applied": {
+                    "Apply CiviCRM Customisations for CRM-1367 and CRM-5946": "https://raw.githubusercontent.com/civicrm/civicrm-core/36319938a5bf26c1e7e2110a26a65db6a5979268/tools/scripts/composer/patches/pear-mail.patch"
+                }
+            },
             "autoload": {
                 "psr-0": {
                     "Mail": "./"
diff --git a/tools/scripts/composer/patches/pear-mail.patch b/tools/scripts/composer/patches/pear-mail.patch
deleted file mode 100644 (file)
index 23fa638..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-diff --git a/Mail.php b/Mail.php
-index b04bc01..0e7da00 100644
---- a/Mail.php
-+++ b/Mail.php
-@@ -155,6 +155,10 @@ class Mail
-                 preg_replace('=((<CR>|<LF>|0x0A/%0A|0x0D/%0D|\\n|\\r)\S).*=i',
-                              null, $value);
-         }
-+        // fix for CRM-1367
-+        if (!array_key_exists('Date', $headers)) {
-+            $headers['Date'] = date('r');
-+        }
-     }
-     /**
-diff --git a/Mail/mail.php b/Mail/mail.php
-index ee1ecef..ae6e2e8 100644
---- a/Mail/mail.php
-+++ b/Mail/mail.php
-@@ -145,7 +153,12 @@ class Mail_mail extends Mail {
-         if (is_a($headerElements, 'PEAR_Error')) {
-             return $headerElements;
-         }
--        list(, $text_headers) = $headerElements;
-+        list($from, $text_headers) = $headerElements;
-+        // use Return-Path for SMTP envelope’s FROM address (if set), CRM-5946
-+        if (!empty($headers['Return-Path'])) {
-+            $from = $headers['Return-Path'];
-+        }
-+        $this->_params = "-f".$from;
-         // We only use mail()'s optional fifth parameter if the additional
-         // parameters have been provided and we're not running in safe mode.
index 890dc617be4844c8306f9bcb9874a548746869ae..8bba016989e85ae6eea97d7df6615ab322534356 100755 (executable)
@@ -24,12 +24,6 @@ function safe_delete() {
 }
 
 
-##############################################################################
-# @fixme Extend pear/mail rather than patching it.
-if ! grep -q 'CRM-1367' vendor/pear/mail/Mail.php; then
-  patch -d vendor/pear/mail -p1 < tools/scripts/composer/patches/pear-mail.patch.txt
-fi
-
 safe_delete vendor/pear/console_getopt/{package.xml,README.rst,tests}
 safe_delete vendor/pear/mail/{package.xml,README.rst,tests}
 safe_delete vendor/pear/pear-core-minimal/{package.xml,README.rst}