mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
[feature/auto-loading] Added autoloader to common and ensured compatability
The autoloader is registered in install without caching, since caching is set up during installation. This provides the same functionality, performance is not a concern during installation anyway. In common.php the autoloader is instantiated after the cache is initialised and is started with the standard cache backend used for other cached values. A few places in the code using class_exists had to be updated to explicitly avoid autoloading, since they are used to check whether a file needs to be included which does not (yet) follow the naming scheme the autoloader follows. PHPBB3-9682
This commit is contained in:
parent
22c3041e12
commit
dea1d660fb
10 changed files with 27 additions and 19 deletions
|
@ -188,6 +188,7 @@ if (!empty($load_extensions) && function_exists('dl'))
|
|||
}
|
||||
|
||||
// Include files
|
||||
require($phpbb_root_path . 'includes/class_loader.' . $phpEx);
|
||||
require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.' . $phpEx);
|
||||
require($phpbb_root_path . 'includes/cache.' . $phpEx);
|
||||
require($phpbb_root_path . 'includes/template.' . $phpEx);
|
||||
|
@ -211,6 +212,9 @@ $template = new template();
|
|||
$cache = new cache();
|
||||
$db = new $sql_db();
|
||||
|
||||
$class_loader = new phpbb_class_loader($phpbb_root_path, '.' . $phpEx, $cache);
|
||||
$class_loader->register();
|
||||
|
||||
// Connect to DB
|
||||
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined('PHPBB_DB_NEW_LINK') ? PHPBB_DB_NEW_LINK : false);
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ function login_db(&$username, &$password)
|
|||
if ($show_captcha)
|
||||
{
|
||||
// Visual Confirmation handling
|
||||
if (!class_exists('phpbb_captcha_factory'))
|
||||
if (!class_exists('phpbb_captcha_factory', false))
|
||||
{
|
||||
global $phpbb_root_path, $phpEx;
|
||||
include ($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx);
|
||||
|
|
|
@ -19,7 +19,7 @@ if (!defined('IN_PHPBB'))
|
|||
/**
|
||||
* Placeholder for autoload
|
||||
*/
|
||||
if (!class_exists('phpbb_default_captcha'))
|
||||
if (!class_exists('phpbb_default_captcha', false))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/captcha/plugins/captcha_abstract.' . $phpEx);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ if (!defined('IN_PHPBB'))
|
|||
/**
|
||||
* Placeholder for autoload
|
||||
*/
|
||||
if (!class_exists('phpbb_default_captcha'))
|
||||
if (!class_exists('phpbb_default_captcha', false))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/captcha/plugins/captcha_abstract.' . $phpEx);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ if (!defined('IN_PHPBB'))
|
|||
/**
|
||||
* Placeholder for autoload
|
||||
*/
|
||||
if (!class_exists('phpbb_default_captcha'))
|
||||
if (!class_exists('phpbb_default_captcha', false))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/captcha/plugins/captcha_abstract.' . $phpEx);
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ class phpbb_captcha_qa
|
|||
{
|
||||
global $db, $phpbb_root_path, $phpEx;
|
||||
|
||||
if (!class_exists('phpbb_db_tools'))
|
||||
if (!class_exists('phpbb_db_tools', false))
|
||||
{
|
||||
include("$phpbb_root_path/includes/db/db_tools.$phpEx");
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ if (!defined('IN_PHPBB'))
|
|||
exit;
|
||||
}
|
||||
|
||||
if (!class_exists('phpbb_default_captcha'))
|
||||
if (!class_exists('phpbb_default_captcha', false))
|
||||
{
|
||||
// we need the classic captcha code for tracking solutions and attempts
|
||||
include($phpbb_root_path . 'includes/captcha/plugins/captcha_abstract.' . $phpEx);
|
||||
|
|
|
@ -2840,7 +2840,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa
|
|||
{
|
||||
global $db, $user, $template, $auth, $phpEx, $phpbb_root_path, $config;
|
||||
|
||||
if (!class_exists('phpbb_captcha_factory'))
|
||||
if (!class_exists('phpbb_captcha_factory', false))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx);
|
||||
}
|
||||
|
|
|
@ -983,7 +983,7 @@ class session
|
|||
}
|
||||
|
||||
// only called from CRON; should be a safe workaround until the infrastructure gets going
|
||||
if (!class_exists('phpbb_captcha_factory'))
|
||||
if (!class_exists('phpbb_captcha_factory', false))
|
||||
{
|
||||
include($phpbb_root_path . "includes/captcha/captcha_factory." . $phpEx);
|
||||
}
|
||||
|
|
|
@ -152,6 +152,7 @@ else
|
|||
@ini_set('memory_limit', $mem_limit);
|
||||
|
||||
// Include essential scripts
|
||||
require($phpbb_root_path . 'includes/class_loader.' . $phpEx);
|
||||
require($phpbb_root_path . 'includes/functions.' . $phpEx);
|
||||
|
||||
if (file_exists($phpbb_root_path . 'includes/functions_content.' . $phpEx))
|
||||
|
@ -168,6 +169,9 @@ include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
|||
include($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
|
||||
require($phpbb_root_path . 'includes/functions_install.' . $phpEx);
|
||||
|
||||
$class_loader = new phpbb_class_loader($phpbb_root_path, '.' . $phpEx);
|
||||
$class_loader->register();
|
||||
|
||||
// Try and load an appropriate language if required
|
||||
$language = basename(request_var('language', ''));
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue