Copyright 2011-2016 Horde LLC (http://www.horde.org/) See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
Author: Mike Hardy
Author: Jan Schneider (jan@horde.org)
Author: Gunnar Wrobel (wrobel@pardus.de)
Example #1
0
    /**
     * Run the task.
     *
     * @param array &$options Additional options.
     *
     * @return NULL
     */
    public function run(&$options)
    {
        if (!$this->getNotes()->hasNotes()) {
            $this->getOutput()->warn('No release announcements available! No information will be sent to the mailing lists.');
            return;
        }
        $mailer = new Horde_Release_MailingList($this->getComponent()->getName(), $this->getNotes()->getName(), $this->getNotes()->getBranch(), $options['from'], $this->getNotes()->getList(), $this->getComponent()->getVersion(), $this->getNotes()->getSecurity());
        $mailer->append($this->getNotes()->getAnnouncement());
        $mailer->append("\n\n" . 'The full list of changes can be viewed here:' . "\n\n" . $this->getComponent()->getChangelog(new Components_Helper_ChangeLog($this->getOutput())) . "\n\n" . 'Have fun!' . "\n\n" . 'The Horde Team.');
        if (!$this->getTasks()->pretend()) {
            try {
                //@todo: Make configurable again
                $class = 'Horde_Mail_Transport_Sendmail';
                $mailer->getMail()->send(new $class(array()));
            } catch (Exception $e) {
                $this->getOutput()->warn((string) $e);
            }
        } else {
            $info = 'ANNOUNCEMENT

Message headers
---------------

';
            foreach ($mailer->getHeaders() as $key => $value) {
                $info .= $key . ': ' . $value . "\n";
            }
            $info .= '
Message body
------------

';
            $info .= $mailer->getBody();
            $this->getOutput()->info($info);
        }
    }
Example #2
0
 /**
  * announce release to mailing lists.
  */
 public function announce($doc_dir = null)
 {
     $module = $this->_options['module'];
     if (!isset($this->notes)) {
         print "NOT announcing release, RELEASE_NOTES missing.\n";
         return;
     }
     if (empty($doc_dir)) {
         $doc_dir = $module . '/docs';
     }
     $url_changelog = $this->_oldVersion ? "http://cvs.horde.org/diff.php/{$doc_dir}/CHANGES?rt=horde&r1={$this->_oldChangelogVersion}&r2={$this->_changelogVersion}&ty=h" : '';
     $mailer = new Horde_Release_MailingList($module, $this->notes['name'], $this->_hordeVersionString, $this->_options['from'], isset($this->notes['list']) ? $this->notes['list'] : null, $this->_ticketVersion, $this->notes['security']);
     $headers = $mailer->getHeaders();
     if (!empty($this->_options['noannounce'])) {
         print "NOT announcing release on " . $headers['To'] . "\n";
     } else {
         print "Announcing release to " . $headers['To'] . "\n";
     }
     // Building message text
     $mailer->append($this->notes['changes']);
     if ($this->_oldVersion) {
         $mailer->append("\n\n" . sprintf('The full list of changes (from version %s) can be viewed here:', $this->_oldSourceVersionString) . "\n\n" . $url_changelog);
     }
     $mailer->append("\n\n" . sprintf('The %s %s distribution is available from the following locations:', $this->notes['name'], $this->_sourceVersionString) . "\n\n" . sprintf('    ftp://ftp.horde.org/pub/%s/%s', $module, $this->_tarballName) . "\n" . sprintf('    http://ftp.horde.org/pub/%s/%s', $module, $this->_tarballName));
     if ($this->_makeDiff) {
         $mailer->append("\n\n" . sprintf('Patches against version %s are available at:', $this->_oldSourceVersionString) . "\n\n" . sprintf('    ftp://ftp.horde.org/pub/%s/patches/%s.gz', $module, $this->_patchName) . "\n" . sprintf('    http://ftp.horde.org/pub/%s/patches/%s.gz', $module, $this->_patchName));
         if (!empty($this->_binaryDiffs)) {
             $mailer->append("\n\n" . 'NOTE: Patches do not contain differences between files containing binary data.' . "\n" . 'These files will need to be updated via the distribution files:' . "\n\n    " . implode("\n    ", $this->_binaryDiffs));
         }
     }
     $mailer->append("\n\n" . 'MD5 sums for the packages are as follows:' . "\n\n" . '    ' . $this->_tarballMD5[0] . "\n" . '    ' . $this->_patchMD5[0] . "\n\n" . 'Have fun!' . "\n\n" . 'The Horde Team.');
     if (!empty($this->_options['noannounce'])) {
         print "Message headers:\n";
         print_r($headers);
         print "Message body:\n" . $mailer->getBody() . "\n";
         return;
     }
     // Building and sending message
     try {
         $class = 'Horde_Mail_Transport_' . Horde_String::ucfirst($this->_options['mailer']['type']);
         $mailer->getMail()->send(new $class($this->_options['mailer']['params']));
     } catch (Horde_Mime_Exception $e) {
         print $e->getMessage() . "\n";
     }
 }