aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorTristan Darricau <github@nicofuma.fr>2014-05-30 15:29:09 +0200
committerTristan Darricau <github@nicofuma.fr>2014-11-20 19:00:34 +0100
commit873260589eaa7ac2d7e520ebe321cb8bb2609ce0 (patch)
tree31c0bfed5170ab604052d5e5b0d757bc099e051e /phpBB
parent1a6e1ecf6f96acb7eb3fc0cc6233773ecb5125a8 (diff)
downloadforums-873260589eaa7ac2d7e520ebe321cb8bb2609ce0.tar
forums-873260589eaa7ac2d7e520ebe321cb8bb2609ce0.tar.gz
forums-873260589eaa7ac2d7e520ebe321cb8bb2609ce0.tar.bz2
forums-873260589eaa7ac2d7e520ebe321cb8bb2609ce0.tar.xz
forums-873260589eaa7ac2d7e520ebe321cb8bb2609ce0.zip
[ticket/12620] Display error message when the environment isn't available
PHPBB3-12620
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/common.php23
-rw-r--r--phpBB/config/environment_debug.yml (renamed from phpBB/config/config_debug.yml)0
-rw-r--r--phpBB/config/environment_productive.yml (renamed from phpBB/config/config_productive.yml)0
-rw-r--r--phpBB/phpbb/di/extension/core.php2
4 files changed, 22 insertions, 3 deletions
diff --git a/phpBB/common.php b/phpBB/common.php
index d4549dc2d4..586c2f080f 100644
--- a/phpBB/common.php
+++ b/phpBB/common.php
@@ -96,11 +96,30 @@ set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handle
$phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx);
$phpbb_class_loader_ext->register();
+if (ENVIRONMENT == 'debug' && !class_exists('Goutte\Client', true))
+{
+ trigger_error(
+ 'Composer dependencies have not been set up for the development environment yet, run ' .
+ "'php ../composer.phar install --dev' from the phpBB directory to do so.",
+ E_USER_ERROR
+ );
+}
phpbb_load_extensions_autoloaders($phpbb_root_path);
// Set up container
-$phpbb_container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx);
-$phpbb_container = $phpbb_container_builder->get_container();
+$phpbb_container = phpbb_create_default_container($phpbb_root_path, $phpEx);
+try
+{
+ $phpbb_container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx);
+ $phpbb_container = $phpbb_container_builder->get_container();
+}
+catch (InvalidArgumentException $e)
+{
+ trigger_error(
+ 'The requested environment ' . ENVIRONMENT . ' is not available.',
+ E_USER_ERROR
+ );
+}
$phpbb_class_loader->set_cache($phpbb_container->get('cache.driver'));
$phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver'));
diff --git a/phpBB/config/config_debug.yml b/phpBB/config/environment_debug.yml
index 6982aa4f83..6982aa4f83 100644
--- a/phpBB/config/config_debug.yml
+++ b/phpBB/config/environment_debug.yml
diff --git a/phpBB/config/config_productive.yml b/phpBB/config/environment_productive.yml
index 6982aa4f83..6982aa4f83 100644
--- a/phpBB/config/config_productive.yml
+++ b/phpBB/config/environment_productive.yml
diff --git a/phpBB/phpbb/di/extension/core.php b/phpBB/phpbb/di/extension/core.php
index d203cc7049..5fb8d9ad34 100644
--- a/phpBB/phpbb/di/extension/core.php
+++ b/phpBB/phpbb/di/extension/core.php
@@ -50,7 +50,7 @@ class core extends Extension
public function load(array $config, ContainerBuilder $container)
{
$loader = new YamlFileLoader($container, new FileLocator(phpbb_realpath($this->config_path)));
- $loader->load('config_' . ENVIRONMENT . '.yml');
+ $loader->load('environment_' . ENVIRONMENT . '.yml');
}
/**