IPB UPGRADE 1.x -> 2.0! | > Script written by Matt Mecham | > Date started: 21st April 2004 | > Interesting fact: Radiohead rock (Rain down, Rain down, come on rain down. On me. From a great height) +-------------------------------------------------------------------------- */ //----------------------------------------------- // USER CONFIGURABLE ELEMENTS //----------------------------------------------- define( 'THIS_PATH' , './' ); define( 'ROOT_PATH' , "../" ); define( 'KERNEL_PATH', ROOT_PATH.'ips_kernel/' ); define( 'CACHE_PATH' , ROOT_PATH ); //----------------------------------------------- // NO USER EDITABLE SECTIONS BELOW //----------------------------------------------- define ( 'IN_IPB', 0 ); define ( 'IN_DEV', 0 ); define ( 'SAFE_MODE_ON', 0 ); define ( 'THIS_SCRIPT' , 'upgrade.php' ); error_reporting (E_ERROR | E_WARNING | E_PARSE); set_magic_quotes_runtime(0); @set_time_limit(0); //=========================================================================== // MAIN PROGRAM //=========================================================================== //-------------------------------- // Import $INFO, now! //-------------------------------- $INFO = array(); require ROOT_PATH."conf_global.php"; //-------------------------------- // The clocks a' tickin' //-------------------------------- $Debug = new Debug; $Debug->startTimer(); //-------------------------------- // Load the DB driver and such //-------------------------------- $INFO['sql_driver'] = !$INFO['sql_driver'] ? 'mysql' : $INFO['sql_driver']; $INFO['sql_driver'] = strtolower($INFO['sql_driver']); if ( ! @file_exists( ROOT_PATH.'sources/sql/'.strtolower($INFO['sql_driver']).'_admin_queries.php' ) ) { print "Cannot find the file: ".ROOT_PATH.'sources/sql/'.strtolower($INFO['sql_driver'])."_admin_queries.php - make sure the file exists before continuing."; exit(); } require ( KERNEL_PATH.'class_db_'.strtolower($INFO['sql_driver']).".php" ); $DB = new db_driver; $DB->obj['sql_database'] = $INFO['sql_database']; $DB->obj['sql_user'] = $INFO['sql_user']; $DB->obj['sql_pass'] = $INFO['sql_pass']; $DB->obj['sql_host'] = $INFO['sql_host']; $DB->obj['sql_tbl_prefix'] = $INFO['sql_tbl_prefix']; $DB->obj['query_cache_file'] = ROOT_PATH.'sources/sql/'.strtolower($INFO['sql_driver']).'_admin_queries.php'; $DB->obj['use_shutdown'] = 0; $DB->obj['debug'] = 0; //-------------------------------- // Get a DB connection //-------------------------------- $DB->connect(); define ( 'SQL_DRIVER', strtolower($INFO['sql_driver']) ); //-------------------------------- // Wrap it all up in a nice easy to // transport super class //-------------------------------- $ibforums = new info(); //-------------------------------- // Require our global functions //-------------------------------- require ROOT_PATH."sources/functions.php"; require KERNEL_PATH."class_converge.php"; require THIS_PATH."core/functions.php"; require THIS_PATH."core/template.php"; $std = new FUNC; //-------------------------------- // Set up our vars //-------------------------------- $ibforums->input = $std->parse_incoming(); $ibforums->core = new core_functions(); $ibforums->template = new template(); $ibforums->base_url = THIS_SCRIPT.'?'; $ibforums->next_step = intval($ibforums->input['step']) + 1; //-------------------------------- // GET QUERIES FILE (1.2 or 1.3)? // If we have subs table, it's 1.3 //-------------------------------- if ( ! $ibforums->input['version'] ) { if ( _check_for_two() ) { $ibforums->input['version'] = '200'; print "You appear to be running IPB 2.0.0 already and no upgrade is required."; exit(); } else if ( $DB->field_exists( 'sub_id', SQL_PREFIX.'subscriptions' ) ) { $ibforums->input['version'] = '103'; } else if ( $DB->field_exists( 'perm_id', SQL_PREFIX.'forum_perms' ) ) { $ibforums->input['version'] = '102'; } else { $ibforums->input['version'] = '101'; } } switch( $ibforums->input['version'] ) { case '103': define( 'UPGRADE_FROM', '1.3' ); require_once( THIS_PATH.'pre_20000/10003_'.strtolower($INFO['sql_driver']).'_queries.php' ); break; case '102': define( 'UPGRADE_FROM', '1.2' ); require_once( THIS_PATH.'pre_20000/10002_'.strtolower($INFO['sql_driver']).'_queries.php' ); break; case '101': define( 'UPGRADE_FROM', '1.1' ); require_once( THIS_PATH.'pre_20000/10001_'.strtolower($INFO['sql_driver']).'_queries.php' ); break; } $ibforums->sql = new upgrade_sql(); //-------------------------------- // Quitting on this step? //-------------------------------- if ( $ibforums->input['dieafterstep'] ) { if ( $ibforums->input['step'] - 1 == $ibforums->input['dieafterstep'] ) { $ibforums->template->content .= "