[ticket/11574] Require new files in database_update.php and add a class loader

PHPBB3-11574
This commit is contained in:
Joas Schilling 2013-06-10 13:51:55 +02:00
parent 8aca9635f5
commit e12fd2fdda

View file

@ -41,6 +41,26 @@ if (!function_exists('phpbb_require_updated'))
} }
} }
if (!function_exists('phpbb_include_updated'))
{
function phpbb_include_updated($path, $optional = false)
{
global $phpbb_root_path;
$new_path = $phpbb_root_path . 'install/update/new/' . $path;
$old_path = $phpbb_root_path . $path;
if (file_exists($new_path))
{
include($new_path);
}
else if (!$optional || file_exists($old_path))
{
include($old_path);
}
}
}
function phpbb_end_update($cache, $config) function phpbb_end_update($cache, $config)
{ {
$cache->purge(); $cache->purge();
@ -82,19 +102,21 @@ $phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relati
$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path; $phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path;
// Include files // Include files
require($phpbb_root_path . 'includes/class_loader.' . $phpEx); phpbb_require_updated('includes/class_loader.' . $phpEx);
require($phpbb_root_path . 'includes/functions.' . $phpEx); phpbb_require_updated('includes/functions.' . $phpEx);
require($phpbb_root_path . 'includes/functions_content.' . $phpEx); phpbb_require_updated('includes/functions_content.' . $phpEx);
require($phpbb_root_path . 'includes/functions_container.' . $phpEx); phpbb_require_updated('includes/functions_container.' . $phpEx);
require($phpbb_root_path . 'includes/constants.' . $phpEx); phpbb_require_updated('includes/constants.' . $phpEx);
require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); phpbb_require_updated('includes/utf/utf_tools.' . $phpEx);
// Set PHP error handler to ours // Set PHP error handler to ours
set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
// Setup class loader first // Setup class loader first
$phpbb_class_loader_new = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}install/update/new/includes/", $phpEx);
$phpbb_class_loader_new->register();
$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", $phpEx); $phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", $phpEx);
$phpbb_class_loader->register(); $phpbb_class_loader->register();