<?php
define('WP_INSTALLING', true);
require_once('../wpj-wizard.php');
if (!file_exists('../wp-config.php')) die ($wpj_head2 . _LANG_UPG_STEP_INFO . $wpj_foot);
require('../wp-config.php');
timer_start();
require_once(ABSPATH . '/wp-admin/upgrade-functions.php');

$step = $_GET['step'];
if (!$step) $step = 0;
echo $wpj_head3;
switch($step) {

	case 0:
	$goback = clean_url(stripslashes(wp_get_referer()));
?> 
<p><?php _e('This file upgrades you from any previous version of WordPress to the latest. It may take a while though, so be patient.'); ?></p> 
	<h2 class="step"><a href="upgrade.php?step=1&amp;backto=<?php echo $goback; ?>"><?php _e('Upgrade WordPress &raquo;'); ?></a></h2>
<?php
	break;
	
	case 1:
	$wp_current_db_version = __get_option('db_version');
	if ( $wp_db_version != $wp_current_db_version ) {
	wp_cache_flush();
	make_db_current_silent();
	upgrade_all();
	wp_cache_flush();
	}

	if ( empty( $_GET['backto'] ) )
		$backto = __get_option('home');
	else
		$backto = $backto = clean_url(stripslashes($_GET['backto']));
?> 
<h2><?php _e('Step 1'); ?></h2> 
	<p><?php printf(__("There's actually only one step. So if you see this, you're done. <a href='%s'>Have fun</a>!"),  $backto); ?></p>

<!--
<pre>
<?php printf(__('%s queries'), $wpdb->num_queries); ?>

<?php printf(__('%s seconds'), timer_stop(0)); ?>
</pre>
-->

<?php
	break;
}
?> 
</body>
</html>
