diff -r 66732bd4532c -r bb3e6c3bd4f4 install/upgrade.php --- a/install/upgrade.php Sat Jan 26 11:51:19 2008 -0500 +++ b/install/upgrade.php Sat Jan 26 15:42:32 2008 -0500 @@ -16,6 +16,16 @@ define('IN_ENANO', 1); +// Turn on every imaginable API hack to make common load on older databases +define('IN_ENANO_UPGRADE', 1); +define('IN_ENANO_MIGRATION', 1); +define('ENANO_ALLOW_LOAD_NOLANG', 1); +@ini_set('display_errors', 'on'); + +require('includes/sql_parse.php'); + +require_once('includes/common.php'); +// when the installer's common is loaded, it runs chdir() to the ENANO_ROOT, thus making this Enano's common.php require_once('includes/common.php'); @ini_set('display_errors', 'on'); @@ -70,6 +80,83 @@ exit(0); } +// Version check +if ( enano_version() == installer_enano_version() ) +{ + $ui->show_header(); + echo '

Already upgraded

' . '

You don\'t need to migrate, you\'re already on crack the 1.1 platform.

'; + $ui->show_footer(); + exit(); +} + +// Start session manager +$session->start(); +if ( !$session->user_logged_in || ( $session->user_logged_in && $session->auth_level < USER_LEVEL_ADMIN ) ) +{ + if ( isset($_POST['do_login']) ) + { + if ( !$session->user_logged_in ) + { + $result = $session->login_without_crypto($_POST['username'], $_POST['password'], false, USER_LEVEL_MEMBER); + } + $result = $session->login_without_crypto($_POST['username'], $_POST['password'], false, USER_LEVEL_ADMIN); + if ( $result['success'] ) + { + header('HTTP/1.1 302 Some kind of redirect with implied no content'); + header('Location: ' . scriptPath . '/install/' . $session->append_sid('upgrade.php')); + exit(); + } + } + + $ui->show_header(); + + ?> +

Authentication needed

+ '; + + if ( isset($result) ) + { + echo 'Session manager returned error: ' . $result['error'] . ''; + } + + ?> +

You need an active admin session to continue.

+

+ Username:   
+ Password:   
+ +

+ '; + + $ui->show_footer(); + exit(); +} + +// The real migration code $ui->show_header(); + +if ( isset($_GET['stage']) && @$_GET['stage'] == 'pimpmyenano' ) +{ + require('install/schemas/upgrade/migration/1.0-1.1.php'); + if ( MIGRATE() ) + { + echo '

Enano survived the migration. Congratulations, you\'re one of the lucky ones, check out the alpha.

'; + } + else + { + echo '

Something went wrong, you should have gotten an error message.

'; + } +} +else +{ + ?> +

Nothing's really implemented for now except the actual migration code, which is not very smart. Just do the upgrade and get it over with.

+ show_footer();