Merge pull request #13722 from civicrm/5.11
[civicrm-core.git] / tools / scripts / composer / net-smtp-fix.sh
CommitLineData
8aa9061e
SL
1#!/bin/bash
2
3## Cleanup the vendor tree. The main issue here is that civi Civi is
4## deployed as a module inside a CMS, so all its source-code gets published.
5## Some libraries distribute admin tools and sample files which should not
6## be published.
7##
8## This script should be idempotent -- if you rerun it several times, it
9## should always produce the same post-condition.
10
11## Replace a line in a file
12## This is a bit like 'sed -i', but dumber and more cross-platform.
8aa9061e 13
ced6fbcb
TO
14##############################################################################
15## usage: safe_delete <relpath...>
16function safe_delete() {
17 for file in "$@" ; do
18 if [ -z "$file" ]; then
19 echo "Skip: empty file name"
20 elif [ -e "$file" ]; then
21 rm -rf "$file"
22 fi
23 done
24}
25
26
27##############################################################################
0ccbacae
SL
28# Add in CiviCRM custom error message for CRM-8744.
29if ! grep -q 'CRM-8744' vendor/pear/net_smtp/Net/SMTP.php; then
23e72ac4 30 patch vendor/pear/net_smtp/Net/SMTP.php < tools/scripts/composer/patches/net-smtp-patch.txt
0ccbacae
SL
31fi
32if ! grep -q '@STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT' vendor/pear/net_smtp/Net/SMTP.php; then
23e72ac4 33 patch vendor/pear/net_smtp/Net/SMTP.php < tools/scripts/composer/patches/net-smtp-tls-patch.txt
989532f6 34fi
5b0dd2c0 35if ! grep -q 'function __construct' vendor/pear/net_smtp/Net/SMTP.php; then
23e72ac4 36 patch vendor/pear/net_smtp/Net/SMTP.php < tools/scripts/composer/patches/net-smtp-php7-patch.txt
5b0dd2c0 37fi
764b4bff 38if grep -q '&Auth_SASL::factory' vendor/pear/net_smtp/Net/SMTP.php; then
23e72ac4 39 patch vendor/pear/net_smtp/Net/SMTP.php < tools/scripts/composer/patches/net-smtp-ref-patch.txt
ced6fbcb
TO
40fi
41
dec128bb 42safe_delete vendor/pear/net_smtp/{README.rst,examples,phpdoc.sh,tests}