[ticket/16530] Ensure global $config exists before user setup

PHPBB3-16530
This commit is contained in:
Marc Alexander 2020-06-14 15:46:02 +02:00
parent a7bfe9afed
commit 8a54793ede
No known key found for this signature in database
GPG key ID: 50E0D2423696F995
3 changed files with 19 additions and 8 deletions

View file

@ -13,6 +13,7 @@
namespace phpbb\install\module\install_finish\task;
use phpbb\config\db;
use phpbb\install\exception\resource_limit_reached_exception;
/**
@ -31,7 +32,7 @@ class install_extensions extends \phpbb\install\task_base
protected $iohandler;
/**
* @var \phpbb\config\db
* @var db
*/
protected $config;
@ -74,7 +75,6 @@ class install_extensions extends \phpbb\install\task_base
$this->log = $container->get('log');
$this->user = $container->get('user');
$this->extension_manager = $container->get('ext.manager');
$this->config = $container->get('config');
$this->db = $container->get('dbal.conn');
$this->finder = new \Symfony\Component\Finder\Finder();
$this->finder->in($phpbb_root_path . 'ext/')
@ -83,6 +83,19 @@ class install_extensions extends \phpbb\install\task_base
->files()
->name('composer.json');
/** @var \phpbb\cache\driver\driver_interface $cache */
$cache = $container->get('cache.driver');
$cache->destroy('config');
$this->config = new db(
$this->db,
$cache,
$container->get_parameter('tables.config')
);
global $config;
$config = $this->config;
// Make sure asset version exists in config. Otherwise we might try to
// insert the assets_version setting into the database and cause a
// duplicate entry error.

View file

@ -97,6 +97,9 @@ class notify_user extends \phpbb\install\task_base
$container->get_parameter('tables.config')
);
global $config;
$config = $this->config;
parent::__construct(true);
}
@ -112,11 +115,6 @@ class notify_user extends \phpbb\install\task_base
{
include ($this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext);
// functions_messenger.php uses config to determine language paths
// Remove when able
global $config;
$config = $this->config;
$messenger = new \messenger(false);
$messenger->template('installed', $this->install_config->get('user_language', 'en'));
$messenger->to($this->config['board_email'], $this->install_config->get('admin_name'));

View file

@ -641,7 +641,7 @@ class user extends \phpbb\session
* Create a DateTimeZone object in the context of the current user
*
* @param string $user_timezone Time zone of the current user.
* @return DateTimeZone DateTimeZone object linked to the current users locale
* @return \DateTimeZone DateTimeZone object linked to the current users locale
*/
public function create_timezone($user_timezone = null)
{