Example #1
0
 /**
  * Runs conversion process
  *
  * @param mixed $step Table name
  * @param integer $start_at A row number from which we start processing table
  */
 function convert($step = null, $start_at = 0)
 {
     global $session;
     $steps = array_keys($this->forum->steps);
     // Start from beginning
     if (!isset($step)) {
         conv_log();
         conv_message('Converting', 'start');
         $session['start_time'] = get_microtime();
         // Validate only first time we run converter (check whether database configuration is valid)
         $this->validate();
         $session['count'] = $this->forum->fetch_item_count();
         // Drop the FluxBB database tables (when there is no NO_DB_CLEANUP constant defined for forum)
         if (!defined(get_class($this->forum) . '::NO_DB_CLEANUP')) {
             $this->cleanup_database();
         }
         conv_message('Done in', round(get_microtime() - $session['start_time'], 6));
         $step = $steps[0];
         return array($step);
     }
     $start = get_microtime();
     $redirect_to = null;
     conv_message('Converting', $step);
     if (is_callable(array($this->forum, 'convert_' . $step))) {
         $redirect_to = call_user_func(array($this->forum, 'convert_' . $step), $start_at);
     } else {
         if (is_callable(array($this, $step))) {
             $redirect_to = call_user_func(array($this, $step));
         } else {
             conv_message('Not implemented', $step);
         }
     }
     conv_message('Done in', round(get_microtime() - $start, 6));
     // Process same step starting from $start_at
     if ($redirect_to != null) {
         return array($step, $redirect_to);
     }
     // Are we done?
     if ($step == 'finish') {
         return false;
     }
     $current_step = array_search($step, $steps);
     // Basically should never happen
     if ($current_step === false) {
         return false;
     }
     // No more tables to process?
     if (!isset($steps[++$current_step])) {
         return array('finish');
     }
     // Redirect to the next step
     return array($steps[$current_step]);
 }
Example #2
0
/**
 * @copyright (C) 2012-2014 FluxBB (http://fluxbb.org)
 * @license GPL - GNU General Public License (http://www.gnu.org/licenses/gpl.html)
 * @package FluxBB
 */
function conv_processing_message($table, $num_rows = null, $start_at = null)
{
    global $session, $lang_convert;
    if (isset($num_rows)) {
        if (isset($start_at)) {
            if (!isset($session['num_done'][$table])) {
                $session['num_done'][$table] = 0;
            }
            $count = isset($session['forum_item_count'][$table]) ? intval($session['forum_item_count'][$table]) : 0;
            conv_message('Processing range', $table, $num_rows, $start_at, $start_at + PER_PAGE);
            if ($count >= 0) {
                $pages_left = floor(($count - $session['num_done'][$table]) / PER_PAGE);
                conv_message('Pages left', $pages_left);
            }
            $session['num_done'][$table] += $num_rows;
        } else {
            conv_message('Processing num', $table, $num_rows);
        }
    } else {
        conv_message('Processing', $table);
    }
}
Example #3
0
}
// We're done
$alerts = array(sprintf($lang_convert['Rebuild search index note'], $lang_convert['rebuild search index']));
if (!$forum->converts_password) {
    $alerts[] = $lang_convert['Password converter mod'];
}
$fluxbb->close_database();
if (!empty($session['dupe_users'])) {
    conv_message("\n" . '---------------------------' . "\n");
    conv_message($lang_convert['Username dupes head']);
    conv_message($lang_convert['Error info 1']);
    conv_message($lang_convert['Error info 2']);
    foreach ($_SESSION['converter']['dupe_users'] as $id => $cur_user) {
        conv_message("\t" . $lang_convert['was renamed to'], $cur_user['old_username'], $cur_user['username']);
    }
    conv_message();
    conv_message($lang_convert['Convert username dupes question']);
    $handle = fopen('php://stdin', 'r');
    $line = trim(fgets($handle));
    if ($line == 'yes') {
        alert_dupe_users();
    }
}
if (!empty($alerts)) {
    conv_message("\n" . '---------------------------' . "\n");
    conv_message($lang_convert['Notes'] . ':' . "\n" . implode("\n", $alerts));
}
conv_message();
conv_message($lang_convert['Conversion completed in'], round($session['time'], 4));
conv_log('Conversion completed in ' . $session['time'], false, true);
exit(0);
Example #4
0
if (isset($page) && $page != 'settings' || isset($step)) {
    $fdb = new DBLayer($_SESSION['hostname'], $_SESSION['username'], $_SESSION['password'], $_SESSION['php_db'], $_SESSION['php_prefix'], false);
    if ($_SESSION['old_charset'] != '' && $_SESSION['old_charset'] != 'UTF-8') {
        $fdb->query('SET NAMES \'latin1\'') or myerror("Unable to set names", __FILE__, __LINE__, $fdb->error());
    }
}
// Header
require 'header.php';
?>

	<table class="punmain" cellspacing="1" cellpadding="4">

<?php 
//	Check for the lock-file
if (file_exists('LOCKED') && (!isset($page) || $page != 'done')) {
    conv_message('This converter is locked to prevent other users to alter the databases.<br><br>Please remove the file \'LOCKED\' in the converter directory and reload this page to run the converter again. If you are done with the converter, it\'s okay to remove the entire directory instead.');
    exit;
}
// Load the proper page
if (isset($step) && file_exists('./' . $_SESSION['forum'] . '/_config.php')) {
    // Load converter config
    include './' . $_SESSION['forum'] . '/_config.php';
    // Load the page from the array
    if (in_array($step, $parts)) {
        // Set start value
        $start = isset($_GET['start']) ? (int) $_GET['start'] : 0;
        ?>
			<tr class="punhead">
				<th class="punhead" colspan="1">Converting: <b><?php 
        echo $settings['Forum'];
        ?>
Example #5
0
 function convert_forum_subscriptions()
 {
     conv_message('No forum subscriptions');
 }