:: sql_layer; ?>
::
get('dbal.tools');
if (!$db_tools->sql_table_exists(MIGRATIONS_TABLE))
{
$migrations_installer = new phpbb_db_migration_install();
$migrations_installer->install($db, $db_tools, $table_prefix, $config['version']);
unset($migrations_installer);
}
$migrator = $phpbb_container->get('migrator');
$migrator->load_migrations($phpbb_root_path . 'includes/db/migration/data/');
// What is a safe limit of execution time? Half the max execution time should be safe.
$safe_time_limit = (ini_get('max_execution_time') / 2);
while (!$migrator->finished())
{
try
{
$migrator->update();
}
catch (phpbb_db_migration_exception $e)
{
echo $e;
phpbb_end_update($cache);
}
echo $migrator->last_run_migration['name'] . '
';
// Are we approaching the time limit? If so we want to pause the update and continue after refreshing
if ((time() - $update_start_time) >= $safe_time_limit)
{
//echo '';
echo $lang['DATABASE_UPDATE_NOT_COMPLETED'] . '
';
echo '' . $lang['DATABASE_UPDATE_CONTINUE'] . '';
phpbb_end_update($cache);
}
}
if ($orig_version != $config['version'])
{
add_log('admin', 'LOG_UPDATE_DATABASE', $orig_version, $config['version']);
}
echo $lang['DATABASE_UPDATE_COMPLETE'];
phpbb_end_update($cache);
if (!function_exists('phpbb_require_updated'))
{
function phpbb_require_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))
{
require($new_path);
}
else if (!$optional || file_exists($old_path))
{
require($old_path);
}
}
}
function phpbb_end_update($cache)
{
$cache->purge();
?>