예제 #1
0
 /**
  * Overrides JGithub constructor to initialise the api property.
  *
  * @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.
  *
  * @see     loadDispatcher()
  * @since   11.1
  */
 public function __construct(JInputCli $input = null, JRegistry $config = null, JDispatcher $dispatcher = null)
 {
     parent::__construct($input, $config, $dispatcher);
     $options = new JRegistry();
     $options->set('headers.Accept', 'application/vnd.github.html+json');
     $this->api = new JGithub($options);
 }
예제 #2
0
 public function __construct(JInputCli $input = null, JRegistry $config = null, JDispatcher $dispatcher = null)
 {
     // CLI Constructor
     parent::__construct($input, $config, $dispatcher);
     // Utilities
     $this->db = JFactory::getDBO();
     $this->updater = JUpdater::getInstance();
     $this->installer = JComponentHelper::getComponent('com_installer');
     // Validate Log Path
     $logPath = $this->config->get('log_path');
     if (!is_dir($logPath) || !is_writeable($logPath)) {
         $logPath = JPATH_BASE . '/logs';
         if (!is_dir($logPath) || !is_writeable($logPath)) {
             $this->out('Log Path not found - ' . $logPath);
         }
         $this->config->set('log_path', JPATH_BASE . '/logs');
     }
     // Validate Tmp Path
     $tmpPath = $this->config->get('tmp_path');
     if (!is_writeable($tmpPath)) {
         $tmpPath = JPATH_BASE . '/tmp';
         if (!is_dir($tmpPath) || !is_writeable($tmpPath)) {
             $this->out('Tmp Path not found - ' . $tmpPath);
         }
         $this->config->set('tmp_path', JPATH_BASE . '/tmp');
     }
     // Push to Global Config
     $config = JFactory::getConfig();
     $config->set('tmp_path', $this->config->get('tmp_path'));
     $config->set('log_path', $this->config->get('log_path'));
 }
예제 #3
0
 /**
  * Class constructor.
  *
  * This constructor invokes the parent JApplicationCli class constructor,
  * and then creates a connector to the database so that it is
  * always available to the application when needed.
  *
  * @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');
     $this->dbo = JFactory::getDbo();
     $this->app = JFactory::getApplication('site');
     $this->config = JFactory::getConfig();
 }
예제 #4
0
 /**
  * Class constructor.
  *
  * This constructor invokes the parent JApplicationCli class constructor,
  * and then creates a connector to the database so that it is
  * always available to the application when needed.
  *
  */
 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')));
 }
예제 #5
0
 /**
  * Class constructor.
  *
  * This constructor invokes the parent JApplicationCli class constructor,
  * and then creates a connector to the database so that it is
  * always available to the application when needed.
  *
  * @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')));
 }
예제 #6
0
파일: daemon.php 프로젝트: raquelsa/Joomla
 /**
  * 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.
  *
  * @since   11.1
  * @throws  RuntimeException
  */
 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 RuntimeException('The PCNTL extension for PHP is not available.');
     }
     // 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 RuntimeException('The POSIX extension for PHP is not available.');
     }
     // @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 immediately.
     ob_implicit_flush();
 }
예제 #7
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 JEventDispatcher 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.
  *
  * @see     loadDispatcher()
  * @since   11.1
  * @deprecated  12.3 Use JApplicationCli instead.
  */
 public function __construct(JInputCli $input = null, JRegistry $config = null, JEventDispatcher $dispatcher = null)
 {
     JLog::add('JCli is deprecated. Use JApplicationCli instead.', JLog::WARNING, 'deprecated');
     parent::__construct($input, $config, $dispatcher);
 }
 /**
  * [__construct description]
  * @param JInputCli|null   $input      [description]
  * @param JRegistry|null   $config     [description]
  * @param JDispatcher|null $dispatcher [description]
  */
 public function __construct(JInputCli $input = null, JRegistry $config = null, JDispatcher $dispatcher = null)
 {
     // CLI Constructor
     parent::__construct($input, $config, $dispatcher);
     // Error Handlers
     JError::setErrorHandling(E_NOTICE, 'callback', array($this, 'throwNotice'));
     JError::setErrorHandling(E_WARNING, 'callback', array($this, 'throwWarning'));
     JError::setErrorHandling(E_ERROR, 'callback', array($this, 'throwError'));
     // Utilities
     $this->db = JFactory::getDBO();
     $this->updater = JUpdater::getInstance();
     $this->installer = JComponentHelper::getComponent('com_installer');
     // Validate Log Path
     $logPath = $this->config->get('log_path');
     if (!is_dir($logPath) || !is_writeable($logPath)) {
         $logPath = JPATH_BASE . '/logs';
         if (!is_dir($logPath) || !is_writeable($logPath)) {
             $this->out('Log Path not found - ' . $logPath);
         }
         $this->config->set('log_path', JPATH_BASE . '/logs');
     }
     // Validate Tmp Path
     $tmpPath = $this->config->get('tmp_path');
     if (!is_writeable($tmpPath)) {
         $tmpPath = JPATH_BASE . '/tmp';
         if (!is_dir($tmpPath) || !is_writeable($tmpPath)) {
             $this->out('Tmp Path not found - ' . $tmpPath);
         }
         $this->config->set('tmp_path', JPATH_BASE . '/tmp');
     }
     // Push to Global Config
     $config = JFactory::getConfig();
     $config->set('tmp_path', $this->config->get('tmp_path'));
     $config->set('log_path', $this->config->get('log_path'));
 }