Example #1
0
 public function setUp()
 {
     if (!(extension_loaded('apc') && ini_get('apc.enabled'))) {
         $this->markTestSkipped('The APC extension is not available.');
     }
     $config = new Foundation\Configuration();
     $config->setCacheType('apc');
     $this->cache = new \Foundation\Cache(uniqid(), $config);
 }
Example #2
0
 /**
  * Get our cache
  * @return \Foundation\Cache;
  */
 protected static function getCache()
 {
     if (is_null(self::$cache)) {
         if (!is_null(self::$tempCache)) {
             return self::$tempCache;
         }
         //no cache was set so we will use our internal array for now.
         //When a cache is set we will update it using this array
         $config = new \Foundation\Configuration();
         $config->setCacheType('array');
         //use a unique id to namespace so we don't have collisions
         self::$tempCache = new \Foundation\Cache(uniqid(), $config);
         return self::$tempCache;
     }
     return self::$cache;
 }
Example #3
0
 public function testGetSourcePath()
 {
     $object = new \Foundation\Configuration();
     $path = $object->getSourcePath();
     $this->assertSame(realpath(__DIR__ . '/..'), $path);
 }
Example #4
0
 /**
  * Get the cache
  * We use a static method here so the cache is always available
  * 
  * @return \Foundation\Cache
  */
 public static function getCache()
 {
     if (!isset(self::$_cache)) {
         $config = new \Jazzee\Configuration();
         $foundationConfig = new \Foundation\Configuration();
         if ($config->getStatus() == 'DEVELOPMENT') {
             $foundationConfig->setCacheType('array');
         } else {
             $foundationConfig->setCacheType('apc');
         }
         //use the path as a namespace so multiple installs on the same system dont conflict
         self::$_cache = new \Foundation\Cache('JAZZEE-' . str_ireplace(array('/', ' '), '', __DIR__), $foundationConfig);
     }
     return self::$_cache;
 }
Example #5
0
 public function setUp()
 {
     $config = new Foundation\Configuration();
     $config->setCacheType('array');
     $this->cache = new \Foundation\Cache(uniqid(), $config);
 }
Example #6
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);
 }