function __construct(JUpgradeproStep $step = null) { parent::__construct($step); $class = !empty($step->class) ? $step->class : 'JUpgradepro'; $name = !empty($step->name) ? $step->name : ''; $xmlpath = !empty($step->xmlpath) ? $step->xmlpath : ''; JLoader::import('helpers.jupgradepro', JPATH_COMPONENT_ADMINISTRATOR); JUpgradeproHelper::requireClass($name, $xmlpath, $class); // @@ Fix bug using PHP < 5.2.3 version if (version_compare(PHP_VERSION, '5.2.3', '<')) { $this->_conditions = call_user_func(array($class, 'getConditionsHook')); } else { $this->_conditions = $class::getConditionsHook(); } $db_config = array(); $db_config['driver'] = $this->params->old_dbtype; $db_config['host'] = $this->params->old_hostname; $db_config['user'] = $this->params->old_username; $db_config['password'] = $this->params->old_password; $db_config['database'] = $this->params->old_db; $db_config['prefix'] = $this->params->old_dbprefix; $this->_db_old = JDatabase::getInstance($db_config); }
/** * * @param stdClass $options Parameters to be passed to the database driver. * * @return jUpgradePro A jUpgradePro object. * * @since 3.0.0 */ static function getInstance(JUpgradeproStep $step = null) { if ($step == null) { return false; } // Correct the 3rd party extensions class name if (isset($step->element)) { $step->class = empty($step->class) ? 'JUpgradeproExtensions' : $step->class; } // Getting the class name $class = ''; if (isset($step->class)) { $class = $step->class; } // Require the correct file if (is_object($step)) { JUpgradeproHelper::requireClass($step->name, $step->xmlpath, $class); } // If the class still doesn't exist we have nothing left to do but throw an exception. We did our best. if (!class_exists($class)) { $class = 'JUpgradepro'; } // Create our new jUpgradePro connector based on the options given. try { $instance = new $class($step); } catch (RuntimeException $e) { throw new RuntimeException(sprintf('Unable to load JUpgradepro object: %s', $e->getMessage())); } return $instance; }