phpbb\convert\convertor::sync_forums PHP Method

sync_forums() public method

Sync function being executed at the middle, some functions need to be executed after a successful sync.
public sync_forums ( $converter, $sync_batch )
    function sync_forums($converter, $sync_batch)
    {
        global $user, $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['SYNC_TOPICS']));
        $batch_size = $convert->batch_size;
        $sql = 'SELECT MIN(topic_id) as min_value, MAX(topic_id) AS max_value
			FROM ' . TOPICS_TABLE;
        $result = $db->sql_query($sql);
        $row = $db->sql_fetchrow($result);
        $db->sql_freeresult($result);
        // Set values of minimum/maximum primary value for this table.
        $primary_min = $row['min_value'];
        $primary_max = $row['max_value'];
        if ($sync_batch == 0) {
            $sync_batch = (int) $primary_min;
        }
        if ($sync_batch == 0) {
            $sync_batch = 1;
        }
        // Fetch a batch of rows, process and insert them.
        while ($sync_batch <= $primary_max && still_on_time()) {
            $end = $sync_batch + $batch_size - 1;
            // Sync all topics in batch mode...
            sync('topic', 'range', 'topic_id BETWEEN ' . $sync_batch . ' AND ' . $end, true, true);
            $this->template->assign_block_vars('checks', array('TITLE' => sprintf($user->lang['SYNC_TOPIC_ID'], $sync_batch, $sync_batch + $batch_size) . (defined('DEBUG') && function_exists('memory_get_usage') ? ' [' . ceil(memory_get_usage() / 1024) . ' ' . $user->lang['KIB'] . ']' : ''), 'RESULT' => $user->lang['DONE']));
            $sync_batch += $batch_size;
        }
        if ($sync_batch >= $primary_max) {
            $url = $this->save_convert_progress($converter, 'final_jump=1');
            $this->template->assign_vars(array('L_SUBMIT' => $user->lang['CONTINUE_CONVERT'], 'U_ACTION' => $url));
            $this->meta_refresh($url);
            return;
        } else {
            $sync_batch--;
        }
        $url = $this->save_convert_progress($converter, 'sync_batch=' . $sync_batch);
        $this->template->assign_vars(array('L_SUBMIT' => $user->lang['CONTINUE_CONVERT'], 'U_ACTION' => $url));
        $this->meta_refresh($url);
        return;
    }