mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 05:20:56 +02:00
Merge remote-tracking branch 'upstream/develop' into ticket/11574
* upstream/develop: (575 commits) [ticket/11702] Fix forum_posts left over for link-click counts in viewforum.php [ticket/11696] Move file to new directory [ticket/11696] Rename constructor to __construct() [ticket/11696] Remove manual loading of db_tools in extension controller test [ticket/11696] Rename db_tools.php so it can be autoloaded [ticket/11698] Moving all autoloadable files to phpbb/ [ticket/11694] Do not locate assets with root path [ticket/11692] Don't update search_type in dev migration if already appended [ticket/11675] Fix template loop [ticket/11690] Old module class names may get autoloaded by class_exists [ticket/9649] Display information on index for moderators on unapproved posts [ticket/10999] Fix assets_version in ACP [prep-release-3.0.12] More changelog items for the 3.0.12 release. [ticket/11687] Add assets_version to phpbb_config [ticket/11686] Not checking for phpBB Debug errors on functional tests [ticket/11670] Consistency with logo: Replace "phpBB(tm)" with "phpBB(R)". [ticket/11674] Do not include vendor folder if there are no dependencies. [ticket/11685] Remove logout confirmation page [ticket/11684] Remove useless confirmation page after login and admin login [ticket/9657] Define user before injecting ... Conflicts: phpBB/includes/functions_container.php phpBB/install/database_update.php phpBB/install/index.php
This commit is contained in:
@@ -20,6 +20,71 @@ if (!defined('IN_PHPBB'))
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get DB connection from config.php.
|
||||
*
|
||||
* Used to bootstrap the container.
|
||||
*
|
||||
* @param string $config_file
|
||||
* @return phpbb_db_driver
|
||||
*/
|
||||
function phpbb_bootstrap_db_connection($config_file)
|
||||
{
|
||||
require($config_file);
|
||||
$dbal_driver_class = phpbb_convert_30_dbms_to_31($dbms);
|
||||
|
||||
$db = new $dbal_driver_class();
|
||||
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, defined('PHPBB_DB_NEW_LINK'));
|
||||
|
||||
return $db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get table prefix from config.php.
|
||||
*
|
||||
* Used to bootstrap the container.
|
||||
*
|
||||
* @param string $config_file
|
||||
* @return string table prefix
|
||||
*/
|
||||
function phpbb_bootstrap_table_prefix($config_file)
|
||||
{
|
||||
require($config_file);
|
||||
return $table_prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get enabled extensions.
|
||||
*
|
||||
* Used to bootstrap the container.
|
||||
*
|
||||
* @param string $config_file
|
||||
* @param string $phpbb_root_path
|
||||
* @return array enabled extensions
|
||||
*/
|
||||
function phpbb_bootstrap_enabled_exts($config_file, $phpbb_root_path)
|
||||
{
|
||||
$db = phpbb_bootstrap_db_connection($config_file);
|
||||
$table_prefix = phpbb_bootstrap_table_prefix($config_file);
|
||||
$extension_table = $table_prefix.'ext';
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . $extension_table . '
|
||||
WHERE ext_active = 1';
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
$rows = $db->sql_fetchrowset($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$exts = array();
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
$exts[$row['ext_name']] = $phpbb_root_path . 'ext/' . $row['ext_name'] . '/';
|
||||
}
|
||||
|
||||
return $exts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the ContainerBuilder object
|
||||
*
|
||||
@@ -106,16 +171,9 @@ function phpbb_create_update_container($phpbb_root_path, $php_ext, $config_path)
|
||||
* @param string $php_ext PHP Extension
|
||||
* @return ContainerBuilder object (compiled)
|
||||
*/
|
||||
function phpbb_create_compiled_container(array $extensions, array $passes, $phpbb_root_path, $php_ext)
|
||||
function phpbb_create_compiled_container($config_file, array $extensions, array $passes, $phpbb_root_path, $php_ext)
|
||||
{
|
||||
// Create a temporary container for access to the ext.manager service
|
||||
$tmp_container = phpbb_create_container($extensions, $phpbb_root_path, $php_ext);
|
||||
$tmp_container->compile();
|
||||
|
||||
// XXX stop writing to global $cache when
|
||||
// http://tracker.phpbb.com/browse/PHPBB3-11203 is fixed
|
||||
$GLOBALS['cache'] = $tmp_container->get('cache');
|
||||
$installed_exts = $tmp_container->get('ext.manager')->all_enabled();
|
||||
$installed_exts = phpbb_bootstrap_enabled_exts($config_file, $phpbb_root_path);
|
||||
|
||||
// Now pass the enabled extension paths into the ext compiler extension
|
||||
$extensions[] = new phpbb_di_extension_ext($installed_exts);
|
||||
@@ -142,7 +200,7 @@ function phpbb_create_compiled_container(array $extensions, array $passes, $phpb
|
||||
* @param string $php_ext PHP Extension
|
||||
* @return ContainerBuilder object (compiled)
|
||||
*/
|
||||
function phpbb_create_dumped_container(array $extensions, array $passes, $phpbb_root_path, $php_ext)
|
||||
function phpbb_create_dumped_container($config_file, array $extensions, array $passes, $phpbb_root_path, $php_ext)
|
||||
{
|
||||
// Check for our cached container; if it exists, use it
|
||||
$container_filename = phpbb_container_filename($phpbb_root_path, $php_ext);
|
||||
@@ -152,7 +210,7 @@ function phpbb_create_dumped_container(array $extensions, array $passes, $phpbb_
|
||||
return new phpbb_cache_container();
|
||||
}
|
||||
|
||||
$container = phpbb_create_compiled_container($extensions, $passes, $phpbb_root_path, $php_ext);
|
||||
$container = phpbb_create_compiled_container($config_file, $extensions, $passes, $phpbb_root_path, $php_ext);
|
||||
|
||||
// Lastly, we create our cached container class
|
||||
$dumper = new PhpDumper($container);
|
||||
@@ -182,10 +240,10 @@ function phpbb_create_dumped_container(array $extensions, array $passes, $phpbb_
|
||||
* @param string $php_ext PHP Extension
|
||||
* @return ContainerBuilder object (compiled)
|
||||
*/
|
||||
function phpbb_create_dumped_container_unless_debug(array $extensions, array $passes, $phpbb_root_path, $php_ext)
|
||||
function phpbb_create_dumped_container_unless_debug($config_file, array $extensions, array $passes, $phpbb_root_path, $php_ext)
|
||||
{
|
||||
$container_factory = defined('DEBUG') ? 'phpbb_create_compiled_container' : 'phpbb_create_dumped_container';
|
||||
return $container_factory($extensions, $passes, $phpbb_root_path, $php_ext);
|
||||
return $container_factory($config_file, $extensions, $passes, $phpbb_root_path, $php_ext);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -199,9 +257,11 @@ function phpbb_create_dumped_container_unless_debug(array $extensions, array $pa
|
||||
*/
|
||||
function phpbb_create_default_container($phpbb_root_path, $php_ext)
|
||||
{
|
||||
$config_file = $phpbb_root_path . 'config.' . $php_ext;
|
||||
return phpbb_create_dumped_container_unless_debug(
|
||||
$config_file,
|
||||
array(
|
||||
new phpbb_di_extension_config($phpbb_root_path . 'config.' . $php_ext),
|
||||
new phpbb_di_extension_config($config_file),
|
||||
new phpbb_di_extension_core($phpbb_root_path . 'config'),
|
||||
),
|
||||
array(
|
||||
|
Reference in New Issue
Block a user