/**
  * Constructor
  *
  * @param \phpbb\install\helper\config							$config				Installer's config provider
  * @param \phpbb\install\helper\database						$db_helper			Installer's database helper
  * @param \phpbb\filesystem\filesystem_interface				$filesystem			Filesystem service
  * @param string												$phpbb_root_path	Path phpBB's root
  * @param string												$php_ext			Extension of PHP files
  */
 public function __construct(\phpbb\install\helper\config $config, \phpbb\install\helper\database $db_helper, \phpbb\filesystem\filesystem_interface $filesystem, $phpbb_root_path, $php_ext)
 {
     $dbms = $db_helper->get_available_dbms($config->get('dbms'));
     $dbms = $dbms[$config->get('dbms')]['DRIVER'];
     $this->db = new $dbms();
     $this->db->sql_connect($config->get('dbhost'), $config->get('dbuser'), $config->get('dbpasswd'), $config->get('dbname'), $config->get('dbport'), false, false);
     $this->config = $config;
     $this->filesystem = $filesystem;
     $this->phpbb_root_path = $phpbb_root_path;
     $this->php_ext = $php_ext;
     parent::__construct(true);
 }
示例#2
0
 /**
  * Constructor
  *
  * @param \phpbb\install\helper\config				$config
  * @param \phpbb\install\helper\database			$db_helper
  * @param \phpbb\filesystem\filesystem_interface	$filesystem
  * @param string									$phpbb_root_path
  */
 public function __construct(\phpbb\install\helper\config $config, \phpbb\install\helper\database $db_helper, \phpbb\filesystem\filesystem_interface $filesystem, $phpbb_root_path)
 {
     $dbms = $db_helper->get_available_dbms($config->get('dbms'));
     $dbms = $dbms[$config->get('dbms')]['DRIVER'];
     $factory = new \phpbb\db\tools\factory();
     $this->db = new $dbms();
     $this->db->sql_connect($config->get('dbhost'), $config->get('dbuser'), $config->get('dbpasswd'), $config->get('dbname'), $config->get('dbport'), false, false);
     $this->config = $config;
     $this->db_tools = $factory->get($this->db);
     $this->filesystem = $filesystem;
     $this->schema_file_path = $phpbb_root_path . 'store/schema.json';
     parent::__construct(true);
 }
 /**
  * Get DB connection.
  *
  * @return \phpbb\db\driver\driver_interface
  */
 protected function get_dbal_connection()
 {
     if ($this->dbal_connection === null) {
         $dbal_driver_class = $this->config_php_file->convert_30_dbms_to_31($this->config_php_file->get('dbms'));
         $this->dbal_connection = new $dbal_driver_class();
         $this->dbal_connection->sql_connect($this->config_php_file->get('dbhost'), $this->config_php_file->get('dbuser'), $this->config_php_file->get('dbpasswd'), $this->config_php_file->get('dbname'), $this->config_php_file->get('dbport'), defined('PHPBB_DB_NEW_LINK') && PHPBB_DB_NEW_LINK);
     }
     return $this->dbal_connection;
 }