function jump($converter, $jump, $last_statement)
{
/** @var \phpbb\db\driver\driver_interface $src_db */
/** @var \phpbb\cache\driver\driver_interface $cache */
global $user, $src_db, $same_db, $db, $phpbb_root_path, $phpEx, $config, $cache;
global $convert;
include_once $phpbb_root_path . 'includes/functions_admin.' . $phpEx;
$this->template->assign_block_vars('checks', array('S_LEGEND' => true, 'LEGEND' => $user->lang['PROCESS_LAST']));
if ($jump == 1) {
// Execute 'last' statements/queries
if (!empty($convert->convertor['execute_last'])) {
if (!is_array($convert->convertor['execute_last'])) {
// @codingStandardsIgnoreStart
eval($convert->convertor['execute_last']);
// @codingStandardsIgnoreEnd
} else {
while ($last_statement < sizeof($convert->convertor['execute_last'])) {
// @codingStandardsIgnoreStart
eval($convert->convertor['execute_last'][$last_statement]);
// @codingStandardsIgnoreEnd
$this->template->assign_block_vars('checks', array('TITLE' => $convert->convertor['execute_last'][$last_statement], 'RESULT' => $user->lang['DONE']));
$last_statement++;
$url = $this->save_convert_progress($converter, 'jump=1&last=' . $last_statement);
$percentage = $last_statement == 0 ? 0 : floor(100 / (sizeof($convert->convertor['execute_last']) / $last_statement));
$msg = sprintf($user->lang['STEP_PERCENT_COMPLETED'], $last_statement, sizeof($convert->convertor['execute_last']), $percentage);
$this->template->assign_vars(array('L_SUBMIT' => $user->lang['CONTINUE_LAST'], 'BODY' => $msg, 'U_ACTION' => $url));
$this->meta_refresh($url);
return;
}
}
}
if (!empty($convert->convertor['query_last'])) {
if (!is_array($convert->convertor['query_last'])) {
$convert->convertor['query_last'] = array('target', array($convert->convertor['query_last']));
} else {
if (!is_array($convert->convertor['query_last'][0])) {
$convert->convertor['query_last'] = array(array($convert->convertor['query_last'][0], $convert->convertor['query_last'][1]));
}
}
foreach ($convert->convertor['query_last'] as $query_last) {
if ($query_last[0] == 'src') {
if ($convert->mysql_convert && $same_db) {
$src_db->sql_query("SET NAMES 'binary'");
}
$src_db->sql_query($query_last[1]);
if ($convert->mysql_convert && $same_db) {
$src_db->sql_query("SET NAMES 'utf8'");
}
} else {
$db->sql_query($query_last[1]);
}
}
}
// Sanity check
$db->sql_return_on_error(false);
$src_db->sql_return_on_error(false);
fix_empty_primary_groups();
$sql = 'SELECT MIN(user_regdate) AS board_startdate
FROM ' . USERS_TABLE;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!isset($config['board_startdate']) || $row['board_startdate'] < $config['board_startdate'] && $row['board_startdate'] > 0) {
$config->set('board_startdate', $row['board_startdate']);
$db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_regdate = ' . $row['board_startdate'] . ' WHERE user_id = ' . ANONYMOUS);
}
update_dynamic_config();
$this->template->assign_block_vars('checks', array('TITLE' => $user->lang['CLEAN_VERIFY'], 'RESULT' => $user->lang['DONE']));
$url = $this->save_convert_progress($converter, 'jump=2');
$this->template->assign_vars(array('L_SUBMIT' => $user->lang['CONTINUE_CONVERT'], 'U_ACTION' => $url));
$this->meta_refresh($url);
return;
}
if ($jump == 2) {
$db->sql_query('UPDATE ' . USERS_TABLE . " SET user_permissions = ''");
// TODO: sync() is likely going to bomb out on forums with a considerable amount of topics.
// TODO: the sync function is able to handle FROM-TO values, we should use them here (batch processing)
sync('forum', '', '', false, true);
$cache->destroy('sql', FORUMS_TABLE);
$this->template->assign_block_vars('checks', array('TITLE' => $user->lang['SYNC_FORUMS'], 'RESULT' => $user->lang['DONE']));
// Continue with synchronizing the forums...
$url = $this->save_convert_progress($converter, 'sync_batch=0');
$this->template->assign_vars(array('L_SUBMIT' => $user->lang['CONTINUE_CONVERT'], 'U_ACTION' => $url));
$this->meta_refresh($url);
return;
}
}