예제 #1
0
 /**
  * Class constructor.
  *
  * This constructor invokes the parent JCli class constructor,
  * and then creates a connector to the database so that it is
  * always available to the application when needed.
  *
  * @return  void
  *
  * @since   11.3
  * @throws  JDatabaseException
  */
 public function __construct()
 {
     // Call the parent __construct method so it bootstraps the application class.
     parent::__construct();
     jimport('joomla.database.database');
     // Note, this will throw an exception if there is an error
     // creating the database connection.
     $this->dbo = JDatabase::getInstance(array('driver' => $this->get('dbDriver'), 'host' => $this->get('dbHost'), 'user' => $this->get('dbUser'), 'password' => $this->get('dbPass'), 'database' => $this->get('dbName'), 'prefix' => $this->get('dbPrefix')));
 }
예제 #2
0
 /**
  * Class constructor.
  *
  * @return  void
  *
  * @since   11.1
  */
 protected function __construct()
 {
     // Verify that the process control extension for PHP is available.
     if (!defined('SIGHUP')) {
         JLog::add('The PCNTL extension for PHP is not available.', JLog::ERROR);
         throw new ApplicationException();
     }
     // Verify that POSIX support for PHP is available.
     if (!function_exists('posix_getpid')) {
         JLog::add('The POSIX extension for PHP is not available.', JLog::ERROR);
         throw new ApplicationException();
     }
     // Call the parent constructor.
     parent::__construct();
     // Set some system limits.
     @set_time_limit($this->config->get('max_execution_time', 0));
     ini_set('memory_limit', isset($config['max_memory_limit']) ? $config['max_memory_limit'] : $this->config->get('max_memory_limit', '256M'));
     // Flush content immediatly.
     ob_implicit_flush();
 }
예제 #3
0
 /**
  * Class constructor.
  *
  * This constructor invokes the parent JCli class constructor,
  * and then creates a connector to the database so that it is
  * always available to the application when needed.
  *
  * @return  void
  *
  * @since   11.3
  * @throws  JDatabaseException
  */
 public function __construct()
 {
     // Call the parent __construct method so it bootstraps the application class.
     parent::__construct();
     //
     // Prepare the logger.
     //
     // Include the JLog class.
     jimport('joomla.log.log');
     // Get the date so that we can roll the logs over a time interval.
     $date = JFactory::getDate()->format('Y-m-d');
     // Add the logger.
     JLog::addLogger(array('text_file' => 'cron.' . $date . '.php', 'text_file_path' => __DIR__ . '/logs'));
     //
     // Prepare the database connection.
     //
     jimport('joomla.database.database');
     // Note, this will throw an exception if there is an error
     // creating the database connection.
     $this->dbo = JDatabase::getInstance(array('driver' => $this->get('dbDriver'), 'host' => $this->get('dbHost'), 'user' => $this->get('dbUser'), 'password' => $this->get('dbPass'), 'database' => $this->get('dbName'), 'prefix' => $this->get('dbPrefix')));
 }
예제 #4
0
 /**
  * Class constructor.
  *
  * @param   mixed  $input       An optional argument to provide dependency injection for the application's
  *                              input object.  If the argument is a JInputCli object that object will become
  *                              the application's input object, otherwise a default input object is created.
  * @param   mixed  $config      An optional argument to provide dependency injection for the application's
  *                              config object.  If the argument is a JRegistry object that object will become
  *                              the application's config object, otherwise a default config object is created.
  * @param   mixed  $dispatcher  An optional argument to provide dependency injection for the application's
  *                              event dispatcher.  If the argument is a JDispatcher object that object will become
  *                              the application's event dispatcher, if it is null then the default event dispatcher
  *                              will be created based on the application's loadDispatcher() method.
  *
  * @return  void
  *
  * @since   11.1
  */
 public function __construct(JInputCli $input = null, JRegistry $config = null, JDispatcher $dispatcher = null)
 {
     // Verify that the process control extension for PHP is available.
     // @codeCoverageIgnoreStart
     if (!defined('SIGHUP')) {
         JLog::add('The PCNTL extension for PHP is not available.', JLog::ERROR);
         throw new ApplicationException();
     }
     // Verify that POSIX support for PHP is available.
     if (!function_exists('posix_getpid')) {
         JLog::add('The POSIX extension for PHP is not available.', JLog::ERROR);
         throw new ApplicationException();
     }
     // @codeCoverageIgnoreEnd
     // Call the parent constructor.
     parent::__construct($input, $config, $dispatcher);
     // Set some system limits.
     @set_time_limit($this->config->get('max_execution_time', 0));
     if ($this->config->get('max_memory_limit') !== null) {
         ini_set('memory_limit', $this->config->get('max_memory_limit', '256M'));
     }
     // Flush content immediatly.
     ob_implicit_flush();
 }
예제 #5
0
 public function __construct()
 {
     return parent::__construct();
 }