Upgrade YOURLS
Upgrade not required. Go back to play!';
} else {
/*
step 1: create new tables and populate them, update old tables structure,
step 2: convert each row of outdated tables if needed
step 3: - if applicable finish updating outdated tables (indexes etc)
- update version & db_version in options, this is all done!
*/
// From what are we upgrading?
if ( isset( $_GET['oldver'] ) && isset( $_GET['oldsql'] ) ) {
$oldver = yourls_sanitize_version( $_GET['oldver'] );
$oldsql = yourls_sanitize_version( $_GET['oldsql'] );
} else {
list( $oldver, $oldsql ) = yourls_get_current_version_from_sql();
}
// To what are we upgrading ?
$newver = YOURLS_VERSION;
$newsql = YOURLS_DB_VERSION;
// Verbose & ugly details
$ydb->show_errors = true;
// Let's go
$step = ( isset( $_GET['step'] ) ? intval( $_GET['step'] ) : 0 );
switch( $step ) {
default:
case 0:
echo "
Your current installation needs to be upgraded.
Please, pretty please, it is recommended that
you backup your database
(you should do this regularly anyway)
Nothing awful should happen, but this doesn't mean it won't happen, right? ;)
On every step, if something goes wrong, you'll see a message and hopefully a way to fix
If everything goes too fast and you cannot read, good for you, let it go :)
Once you are ready, press Upgrade!
";
break;
case 1:
case 2:
$upgrade = yourls_upgrade( $step, $oldver, $newver, $oldsql, $newsql );
break;
case 3:
$upgrade = yourls_upgrade( 3, $oldver, $newver, $oldsql, $newsql );
$admin = yourls_admin_url('index.php');
echo "
Your installation is now up to date !
Go back to the admin interface
";
}
}
?>