From 7ce2e10add759455db7d618cbd6fef225a21ccff Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 9 Apr 2020 12:05:26 +0200 Subject: [PATCH] Travis: Skip send mails in travis --- .travis.yml | 9 +-------- main/inc/lib/api.lib.php | 4 ++++ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1f008bfb72..ffce88b8a6 100755 --- a/.travis.yml +++ b/.travis.yml @@ -29,6 +29,7 @@ env: global: - VHOST_URL=localhost - CHAMILO_VERSION=1.11.x + - TRAVIS=1 allow_failures: - php: 7.4 @@ -38,8 +39,6 @@ before_install: #- sudo apt-get install apache2 libapache2-mod-fastcgi # Fix travis error https://github.com/travis-ci/travis-ci/issues/8607 - sudo rm -vf /etc/apt/sources.list.d/*riak* - - sudo apt-get update -qq - - sudo apt-get install -y -qq postfix # Get Chrome #- wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - #- sudo apt-get update @@ -103,12 +102,6 @@ before_install: - curl $VHOST_URL - ls -la web/build -before_script: - - sudo service postfix stop - - smtp-sink -d "%d.%H.%M.%S" localhost:2500 1000 & - - echo -e '#!/usr/bin/env bash\nexit 0' | sudo tee /usr/sbin/sendmail - - echo 'sendmail_path = "/usr/sbin/sendmail -t -i "' | sudo tee "/home/travis/.phpenv/versions/`php -i | grep "PHP Version" | head -n 1 | grep -o -P '\d+\.\d+\.\d+.*'`/etc/conf.d/sendmail.ini" - script: # - whereis google-chrome-stable # - google-chrome-stable --version diff --git a/main/inc/lib/api.lib.php b/main/inc/lib/api.lib.php index fc8a6883c3..f07a73eef3 100644 --- a/main/inc/lib/api.lib.php +++ b/main/inc/lib/api.lib.php @@ -8936,6 +8936,10 @@ function api_mail_html( ) { global $platform_email; + if (isset($_ENV['TRAVIS']) && '1' === $_ENV['TRAVIS']) { + return true; + } + $mail = new PHPMailer(); $mail->Mailer = $platform_email['SMTP_MAILER']; $mail->Host = $platform_email['SMTP_HOST'];