[feature/event-dispatcher] Change composer autoloading options

Check if composer's generated autoloader is present, and if not give an error.

PHPBB3-9550
This commit is contained in:
Igor Wiedler 2012-03-24 21:37:45 +01:00
parent ef85ef8ed6
commit a44423baee

View file

@ -149,22 +149,32 @@ if (function_exists('date_default_timezone_set') && function_exists('date_defaul
// Autoloading of dependencies.
// Three options are supported:
// 1. Specify PHPBB_AUTOLOAD=/path/to/autoload.php in the environment.
// This is useful for running CLI scripts and tests.
// 1. If dependencies are installed with Composer, Composer will create a
// vendor/.composer/autoload.php. If this file exists it will be
// automatically used by phpBB. This is the default mode that phpBB
// will use when shipped.
// 2. To disable composer autoloading, PHPBB_NO_AUTOLOAD can be specified.
// Additionally specify PHPBB_AUTOLOAD=/path/to/autoload.php in the
// environment. This is useful for running CLI scripts and tests.
// /path/to/autoload.php should define and register class loaders
// for all of phpBB's dependencies.
// 2. If dependencies are installed with Composer, Composer will create a
// vendor/.composer/autoload.php. If this file exists it will be
// automatically used by phpBB.
// 3. Failing that phpBB assumes that autoloading has been set up in
// some other way. This might be useful in cases when phpBB is integrated
// into a larger program.
if (getenv('PHPBB_AUTOLOAD'))
// 3. You can also set PHPBB_NO_AUTOLOAD without setting PHPBB_AUTOLOAD.
// In this case autoloading needs to be defined before running any phpBB
// script. This might be useful in cases when phpBB is integrated into a
// larger program.
if (getenv('PHPBB_NO_AUTOLOAD'))
{
require(getenv('PHPBB_AUTOLOAD'));
if (getenv('PHPBB_AUTOLOAD'))
{
require(getenv('PHPBB_AUTOLOAD'));
}
}
else if (file_exists($phpbb_root_path . 'vendor/.composer/autoload.php'))
else
{
if (!file_exists($phpbb_root_path . 'vendor/.composer/autoload.php'))
{
trigger_error('You have not set up composer dependencies. See http://getcomposer.org/.', E_USER_ERROR);
}
require($phpbb_root_path . 'vendor/.composer/autoload.php');
}