diff --git a/phpBB/phpbb/install/module/install_finish/task/install_extensions.php b/phpBB/phpbb/install/module/install_finish/task/install_extensions.php index 47ea156c66..c398323bc4 100644 --- a/phpBB/phpbb/install/module/install_finish/task/install_extensions.php +++ b/phpBB/phpbb/install/module/install_finish/task/install_extensions.php @@ -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. diff --git a/phpBB/phpbb/install/module/install_finish/task/notify_user.php b/phpBB/phpbb/install/module/install_finish/task/notify_user.php index 292be57f5f..b045b708db 100644 --- a/phpBB/phpbb/install/module/install_finish/task/notify_user.php +++ b/phpBB/phpbb/install/module/install_finish/task/notify_user.php @@ -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')); diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index 58d56ff3f3..b7bb364ec9 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -25,7 +25,6 @@ class session var $forwarded_for = ''; var $host = ''; var $session_id = ''; - public $id = ANONYMOUS; var $ip = ''; var $load = 0; var $time_now = 0; @@ -363,8 +362,6 @@ class session // Did the session exist in the DB? if (isset($this->data['user_id'])) { - $this->id = (int) $this->data['user_id']; - // Validate IP length according to admin ... enforces an IP // check on bots if admin requires this // $quadcheck = ($config['ip_check_bot'] && $this->data['user_type'] & USER_BOT) ? 4 : $config['ip_check']; @@ -650,7 +647,7 @@ class session } // Force user id to be integer... - $this->id = $this->data['user_id'] = (int) $this->data['user_id']; + $this->data['user_id'] = (int) $this->data['user_id']; // At this stage we should have a filled data array, defined cookie u and k data. // data array should contain recent session info if we're a real user and a recent @@ -1667,4 +1664,14 @@ class session } } } + + /** + * Get user ID + * + * @return int User ID + */ + public function id() : int + { + return isset($this->data['user_id']) ? (int) $this->data['user_id'] : ANONYMOUS; + } } diff --git a/phpBB/phpbb/user.php b/phpBB/phpbb/user.php index e02563a7cc..1288ddf524 100644 --- a/phpBB/phpbb/user.php +++ b/phpBB/phpbb/user.php @@ -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) {