aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/startup.php
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2012-03-18 00:48:30 -0400
committerOleg Pudeyev <oleg@bsdpower.com>2012-03-18 02:48:55 -0400
commitfbf34f16ab5526669dae5b7eb130aac0803e3aed (patch)
tree67517da653f84d0cf17fd356f2a0d89376e5f23c /phpBB/includes/startup.php
parent0af7d610c08307fbe8df20e0d44e54dcb9429d64 (diff)
downloadforums-fbf34f16ab5526669dae5b7eb130aac0803e3aed.tar
forums-fbf34f16ab5526669dae5b7eb130aac0803e3aed.tar.gz
forums-fbf34f16ab5526669dae5b7eb130aac0803e3aed.tar.bz2
forums-fbf34f16ab5526669dae5b7eb130aac0803e3aed.tar.xz
forums-fbf34f16ab5526669dae5b7eb130aac0803e3aed.zip
[feature/event-dispatcher] Implement configurable autoloader selection.
The code is in startup.php which should be used by all scripts. PHPBB3-9550
Diffstat (limited to 'phpBB/includes/startup.php')
-rw-r--r--phpBB/includes/startup.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/phpBB/includes/startup.php b/phpBB/includes/startup.php
index 2100fbd97e..de55db2960 100644
--- a/phpBB/includes/startup.php
+++ b/phpBB/includes/startup.php
@@ -146,5 +146,26 @@ if (function_exists('date_default_timezone_set') && function_exists('date_defaul
date_default_timezone_set(@date_default_timezone_get());
}
+// 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.
+// /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'))
+{
+ require(getenv('PHPBB_AUTOLOAD'));
+}
+else if (file_exists($phpbb_root_path . 'vendor/.composer/autoload.php'))
+{
+ require($phpbb_root_path . 'vendor/.composer/autoload.php');
+}
+
$starttime = explode(' ', microtime());
$starttime = $starttime[1] + $starttime[0];