1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-06-02 20:45:29 +02:00

[ticket/13740] Load schema_data.sql from the correct location

[ci skip]

PHPBB3-13740
This commit is contained in:
CHItA 2015-06-18 02:12:49 +02:00 committed by Mate Bartus
parent 69a19e48fa
commit 0f5f62f8db
2 changed files with 12 additions and 6 deletions

View File

@ -18,6 +18,7 @@ services:
- @installer.helper.iohandler
- @installer.helper.container_factory
- @language
- %core.root_path%
installer.install_database.add_config_settings:
class: phpbb\install\module\install_database\task\add_config_settings

View File

@ -43,6 +43,11 @@ class add_default_data extends \phpbb\install\task_base
*/
protected $language;
/**
* @var string
*/
protected $phpbb_root_path;
/**
* Constructor
*
@ -51,26 +56,26 @@ class add_default_data extends \phpbb\install\task_base
* @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler
* @param \phpbb\install\helper\container_factory $container Installer's DI container
* @param \phpbb\language\language $language Language service
* @param string $root_path Root path of phpBB
*/
public function __construct(\phpbb\install\helper\database $db_helper,
\phpbb\install\helper\config $config,
\phpbb\install\helper\iohandler\iohandler_interface $iohandler,
\phpbb\install\helper\container_factory $container,
\phpbb\language\language $language)
\phpbb\language\language $language,
$root_path)
{
$dbms = $db_helper->get_available_dbms($config->get('dbms'));
$dbms = $dbms[$config->get('dbms')]['DRIVER'];
$this->db = $container->get('dbal.conn'); //new $dbms();
$this->db = $container->get('dbal.conn');
$this->database_helper = $db_helper;
$this->config = $config;
$this->iohandler = $iohandler;
$this->language = $language;
$this->phpbb_root_path = $root_path;
parent::__construct(true);
// Connect to DB
//$this->db->sql_connect($config->get('dbhost'), $config->get('dbuser'), $config->get('dbpasswd'), $config->get('dbname'), $config->get('dbport'), false, false);
}
/**
@ -85,7 +90,7 @@ class add_default_data extends \phpbb\install\task_base
$dbms_info = $this->database_helper->get_available_dbms($dbms);
// Get schema data from file
$sql_query = @file_get_contents('schemas/schema_data.sql');
$sql_query = @file_get_contents($this->phpbb_root_path . 'phpbb/install/schemas/schema_data.sql');
// Clean up SQL
$sql_query = $this->replace_dbms_specific_sql($sql_query);