示例#1
0
 /**
  * Setup configuration
  *
  * Load config.ini.php
  * translate to foundation config
  * create absolute path
  * set defautl timezone
  */
 protected function setupConfiguration()
 {
     $this->_config = new \Jazzee\Configuration();
     $this->_foundationConfig = new \Foundation\Configuration();
     if ($this->_config->getStatus() == 'DEVELOPMENT') {
         $this->_foundationConfig->setCacheType('array');
     } else {
         $this->_foundationConfig->setCacheType('apc');
     }
     $this->_foundationConfig->setMailSubjectPrefix($this->_config->getMailSubjectPrefix());
     $this->_foundationConfig->setMailDefaultFromAddress($this->_config->getMailDefaultFromAddress());
     $this->_foundationConfig->setMailDefaultFromName($this->_config->getMailDefaultFromName());
     $this->_foundationConfig->setMailOverrideToAddress($this->_config->getMailOverrideToAddress());
     $this->_foundationConfig->setMailServerType($this->_config->getMailServerType());
     $this->_foundationConfig->setMailServerHost($this->_config->getMailServeHost());
     $this->_foundationConfig->setMailServerPort($this->_config->getMailServerPort());
     $this->_foundationConfig->setMailServerUsername($this->_config->getMailServerUsername());
     $this->_foundationConfig->setMailServerPassword($this->_config->getMailServerPassword());
     \Foundation\VC\Config::setCache(self::getCache());
     if (empty($_SERVER['HTTPS']) or $_SERVER['HTTPS'] == 'off') {
         $protocol = 'http';
     } else {
         $protocol = 'https';
     }
     if (in_array($_SERVER['SERVER_PORT'], array('80', '443'))) {
         $port = '';
     } else {
         $port = ':' . $_SERVER['SERVER_PORT'];
     }
     $this->_serverPath = $protocol . '://' . $_SERVER['SERVER_NAME'] . $port;
     \Jazzee\Globals::setConfig($this->_config);
 }
示例#2
0
 /**
  * @param \Symfony\Component\Console\Input\InputInterface $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  */
 protected function execute(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output)
 {
     $this->_config = new \Jazzee\Configuration();
     $foundationConfig = new \Foundation\Configuration();
     $foundationConfig->setCacheType('array');
     $foundationConfig->setMailSubjectPrefix($this->_config->getMailSubjectPrefix());
     $foundationConfig->setMailDefaultFromAddress($this->_config->getMailDefaultFromAddress());
     $foundationConfig->setMailDefaultFromName($this->_config->getMailDefaultFromName());
     $foundationConfig->setMailOverrideToAddress($this->_config->getMailOverrideToAddress());
     $foundationConfig->setMailServerType($this->_config->getMailServerType());
     $foundationConfig->setMailServerHost($this->_config->getMailServeHost());
     $foundationConfig->setMailServerPort($this->_config->getMailServerPort());
     $foundationConfig->setMailServerUsername($this->_config->getMailServerUsername());
     $foundationConfig->setMailServerPassword($this->_config->getMailServerPassword());
     $entityManager = $this->getHelper('em')->getEntityManager();
     $body = '';
     $from = new \DateTime($input->getOption('from'));
     $to = new \DateTime($input->getOption('to'));
     if ($input->getOption('error-log')) {
         $messages = $this->parseErrorLog($from, $to);
         $body .= '<h4>Error Log</h4><p>There were ' . count($messages) . ' errors between ' . $from->format(self::DATE_FORMAT) . ' and ' . $to->format(self::DATE_FORMAT) . '</p>';
         $body .= $this->formatString($messages);
     }
     if ($input->getOption('access-log')) {
         $messages = $this->parseAccessLog($from, $to);
         $body .= '<h4>Access Log ' . $from->format(self::DATE_FORMAT) . ' to ' . $to->format(self::DATE_FORMAT) . '</h4>';
         $body .= $this->formatString($messages);
     }
     $message = new \Foundation\Mail\Message($foundationConfig);
     $message->IsHTML();
     $message->AddAddress($input->getArgument('email'));
     $message->Subject = 'Jazzee Log Summary';
     $message->Body = $body;
     $message->Send();
     $output->write("<info>Log Summary sent to {$input->getArgument('email')}.</info>" . PHP_EOL);
 }