diff options
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r-- | phpBB/phpbb/db/tools/tools.php | 5 | ||||
-rw-r--r-- | phpBB/phpbb/di/container_builder.php | 128 | ||||
-rw-r--r-- | phpBB/phpbb/install/module/obtain_data/task/obtain_database_data.php | 4 | ||||
-rw-r--r-- | phpBB/phpbb/log/log.php | 4 |
4 files changed, 88 insertions, 53 deletions
diff --git a/phpBB/phpbb/db/tools/tools.php b/phpBB/phpbb/db/tools/tools.php index e00683dd46..37ac0d0468 100644 --- a/phpBB/phpbb/db/tools/tools.php +++ b/phpBB/phpbb/db/tools/tools.php @@ -1166,6 +1166,11 @@ class tools implements tools_interface } } + if (isset($column_data['after'])) + { + $return_array['after'] = $column_data['after']; + } + break; case 'oracle': diff --git a/phpBB/phpbb/di/container_builder.php b/phpBB/phpbb/di/container_builder.php index 8f175c966c..433847b285 100644 --- a/phpBB/phpbb/di/container_builder.php +++ b/phpBB/phpbb/di/container_builder.php @@ -90,7 +90,7 @@ class container_builder * * @var array */ - protected $custom_parameters = null; + protected $custom_parameters = []; /** * @var \phpbb\config_php_file @@ -107,13 +107,16 @@ class container_builder */ private $container_extensions; + /** @var \Exception */ + private $build_exception; + /** * Constructor * * @param string $phpbb_root_path Path to the phpbb includes directory. * @param string $php_ext php file extension */ - function __construct($phpbb_root_path, $php_ext) + public function __construct($phpbb_root_path, $php_ext) { $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; @@ -126,67 +129,96 @@ class container_builder */ public function get_container() { - $container_filename = $this->get_container_filename(); - $config_cache = new ConfigCache($container_filename, defined('DEBUG')); - if ($this->use_cache && $config_cache->isFresh()) - { - require($config_cache->getPath()); - $this->container = new \phpbb_cache_container(); - } - else + try { - $this->container_extensions = array(new extension\core($this->get_config_path())); - - if ($this->use_extensions) + $container_filename = $this->get_container_filename(); + $config_cache = new ConfigCache($container_filename, defined('DEBUG')); + if ($this->use_cache && $config_cache->isFresh()) { - $this->load_extensions(); + require($config_cache->getPath()); + $this->container = new \phpbb_cache_container(); } - - // Inject the config - if ($this->config_php_file) + else { - $this->container_extensions[] = new extension\config($this->config_php_file); - } + $this->container_extensions = array(new extension\core($this->get_config_path())); + + if ($this->use_extensions) + { + $this->load_extensions(); + } - $this->container = $this->create_container($this->container_extensions); + // Inject the config + if ($this->config_php_file) + { + $this->container_extensions[] = new extension\config($this->config_php_file); + } - // Easy collections through tags - $this->container->addCompilerPass(new pass\collection_pass()); + $this->container = $this->create_container($this->container_extensions); - // Event listeners "phpBB style" - $this->container->addCompilerPass(new RegisterListenersPass('dispatcher', 'event.listener_listener', 'event.listener')); + // Easy collections through tags + $this->container->addCompilerPass(new pass\collection_pass()); - // Event listeners "Symfony style" - $this->container->addCompilerPass(new RegisterListenersPass('dispatcher')); + // Event listeners "phpBB style" + $this->container->addCompilerPass(new RegisterListenersPass('dispatcher', 'event.listener_listener', 'event.listener')); - if ($this->use_extensions) - { - $this->register_ext_compiler_pass(); - } + // Event listeners "Symfony style" + $this->container->addCompilerPass(new RegisterListenersPass('dispatcher')); - $filesystem = new filesystem(); - $loader = new YamlFileLoader($this->container, new FileLocator($filesystem->realpath($this->get_config_path()))); - $loader->load($this->container->getParameter('core.environment') . '/config.yml'); + if ($this->use_extensions) + { + $this->register_ext_compiler_pass(); + } - $this->inject_custom_parameters(); + $filesystem = new filesystem(); + $loader = new YamlFileLoader($this->container, new FileLocator($filesystem->realpath($this->get_config_path()))); + $loader->load($this->container->getParameter('core.environment') . '/config.yml'); - if ($this->compile_container) - { - $this->container->compile(); + $this->inject_custom_parameters(); - if ($this->use_cache) + if ($this->compile_container) { - $this->dump_container($config_cache); + $this->container->compile(); + + if ($this->use_cache) + { + $this->dump_container($config_cache); + } } } - } - if ($this->compile_container && $this->config_php_file) - { - $this->container->set('config.php', $this->config_php_file); + if ($this->compile_container && $this->config_php_file) + { + $this->container->set('config.php', $this->config_php_file); + } + + return $this->container; } + catch (\Exception $e) + { + // Don't try to recover if we are in the development environment + if ($this->get_environment() === 'development') + { + throw $e; + } - return $this->container; + if ($this->build_exception === null) + { + $this->build_exception = $e; + + return $this + ->without_extensions() + ->without_cache() + ->with_custom_parameters(array_merge($this->custom_parameters, [ + 'container_exception' => $e, + ])) + ->get_container(); + } + else + { + // Rethrow the original exception if it's still failing + throw $this->build_exception; + } + } } /** @@ -451,13 +483,11 @@ class container_builder */ protected function inject_custom_parameters() { - if ($this->custom_parameters !== null) + foreach ($this->custom_parameters as $key => $value) { - foreach ($this->custom_parameters as $key => $value) - { - $this->container->setParameter($key, $value); - } + $this->container->setParameter($key, $value); } + } /** diff --git a/phpBB/phpbb/install/module/obtain_data/task/obtain_database_data.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_database_data.php index f0e7f1f686..3458aab63e 100644 --- a/phpBB/phpbb/install/module/obtain_data/task/obtain_database_data.php +++ b/phpBB/phpbb/install/module/obtain_data/task/obtain_database_data.php @@ -76,7 +76,7 @@ class obtain_database_data extends \phpbb\install\task_base implements \phpbb\in { // Collect database data $dbms = $this->io_handler->get_input('dbms', ''); - $dbhost = $this->io_handler->get_input('dbhost', ''); + $dbhost = $this->io_handler->get_input('dbhost', '', true); $dbport = $this->io_handler->get_input('dbport', ''); $dbuser = $this->io_handler->get_input('dbuser', ''); $dbpasswd = $this->io_handler->get_input('dbpasswd', '', true); @@ -115,7 +115,7 @@ class obtain_database_data extends \phpbb\install\task_base implements \phpbb\in if ($use_request_data) { $dbms = $this->io_handler->get_input('dbms', ''); - $dbhost = $this->io_handler->get_input('dbhost', ''); + $dbhost = $this->io_handler->get_input('dbhost', '', true); $dbport = $this->io_handler->get_input('dbport', ''); $dbuser = $this->io_handler->get_input('dbuser', ''); $dbname = $this->io_handler->get_input('dbname', ''); diff --git a/phpBB/phpbb/log/log.php b/phpBB/phpbb/log/log.php index 436c21bdad..ee002c560a 100644 --- a/phpBB/phpbb/log/log.php +++ b/phpBB/phpbb/log/log.php @@ -229,8 +229,8 @@ class log implements \phpbb\log\log_interface } $sql_ary = array( - 'user_id' => $user_id ? (int) $user_id : ANONYMOUS, - 'log_ip' => empty($log_ip) ? '' : $log_ip, + 'user_id' => !empty($user_id) ? $user_id : ANONYMOUS, + 'log_ip' => !empty($log_ip) ? $log_ip : '', 'log_time' => $log_time, 'log_operation' => $log_operation, ); |