install/upgrade.php
changeset 1259 49db7495f6b8
parent 1227 bdac73ed481e
equal deleted inserted replaced
1258:d972b1276d95 1259:49db7495f6b8
    18 // The list of versions in THIS AND PREVIOUS branches, in chronological order.
    18 // The list of versions in THIS AND PREVIOUS branches, in chronological order.
    19 $enano_versions = array();
    19 $enano_versions = array();
    20 $enano_versions['1.0'] = array('1.0', '1.0.1', '1.0.2b1', '1.0.2', '1.0.3', '1.0.4', '1.0.5', '1.0.6', '1.0.6pl1');
    20 $enano_versions['1.0'] = array('1.0', '1.0.1', '1.0.2b1', '1.0.2', '1.0.3', '1.0.4', '1.0.5', '1.0.6', '1.0.6pl1');
    21 $enano_versions['1.1'] = array('1.1.1', '1.1.2', '1.1.3', '1.1.4', '1.1.5', '1.1.6', '1.1.7', '1.1.8');
    21 $enano_versions['1.1'] = array('1.1.1', '1.1.2', '1.1.3', '1.1.4', '1.1.5', '1.1.6', '1.1.7', '1.1.8');
    22 
    22 
       
    23 define('BANSHEE_LATEST_DBREV', 1061);
       
    24 
    23 // If true, this will do a full langimport instead of only adding new strings.
    25 // If true, this will do a full langimport instead of only adding new strings.
    24 // Will probably be left on, but some change probably needs to be made to mark
    26 // Will probably be left on, but some change probably needs to be made to mark
    25 // strings as customized in the DB.
    27 // strings as customized in the DB.
    26 $do_langimport = false;
    28 $do_langimport = false;
    27 
    29 
    69 $stg_confirm = $ui->add_stage($lang->get('upgrade_stg_confirm'), true);
    71 $stg_confirm = $ui->add_stage($lang->get('upgrade_stg_confirm'), true);
    70 $stg_upgrade = $ui->add_stage($lang->get('upgrade_stg_upgrade'), true);
    72 $stg_upgrade = $ui->add_stage($lang->get('upgrade_stg_upgrade'), true);
    71 $stg_finish  = $ui->add_stage($lang->get('upgrade_stg_finish'), true);
    73 $stg_finish  = $ui->add_stage($lang->get('upgrade_stg_finish'), true);
    72 
    74 
    73 // Version check
    75 // Version check
    74 if ( enano_version() == installer_enano_version() )
    76 if ( getConfig('db_version') === $db_version && !preg_match('/^upg-/', getConfig('enano_version')) )
    75 {
    77 {
    76 	$ui->show_header();
    78 	$ui->show_header();
    77 	$link_home = makeUrl(get_main_page(), false, true);
    79 	$link_home = makeUrl(get_main_page(), false, true);
    78 	echo '<h3>' . $lang->get('upgrade_err_current_title') . '</h3>' .
    80 	echo '<h3>' . $lang->get('upgrade_err_current_title') . '</h3>' .
    79  			'<p>' . $lang->get('upgrade_err_current_body', array('mainpage_link' => $link_home)) . '</p>' .
    81  			'<p>' . $lang->get('upgrade_err_current_body', array('mainpage_link' => $link_home)) . '</p>' .
   235 	$target_branch = "$major_version.$minor_version";
   237 	$target_branch = "$major_version.$minor_version";
   236 	
   238 	
   237 	if ( $target_branch != $current_branch )
   239 	if ( $target_branch != $current_branch )
   238 	{
   240 	{
   239 		// First upgrade to the latest revision of the current branch
   241 		// First upgrade to the latest revision of the current branch
   240 		enano_perform_upgrade($current_branch);
   242 		enano_perform_upgrade(BANSHEE_LATEST_DBREV);
   241 		// Branch migration could be tricky and is often highly specific between
   243 		// Branch migration could be tricky and is often highly specific between
   242 		// major branches, so just include a custom migration script.
   244 		// major branches, so just include a custom migration script.
   243 		require(ENANO_ROOT . "/install/schemas/upgrade/migration/{$current_branch}-{$target_branch}.php");
   245 		require(ENANO_ROOT . "/install/schemas/upgrade/migration/{$current_branch}-{$target_branch}.php");
   244 		$result = MIGRATE();
   246 		$result = MIGRATE();
   245 		if ( !$result )
   247 		if ( !$result )
   246 		{
   248 		{
   247 			echo 'Migration failed, there should be an error message above.';
   249 			echo 'Migration failed, there should be an error message above.';
   248 			$ui->show_footer();
   250 			$ui->show_footer();
   249 			exit;
   251 			exit;
   250 		}
   252 		}
       
   253 		setConfig('db_version', BANSHEE_LATEST_DBREV + 1);
   251 	}
   254 	}
   252 	
   255 	
   253 	// Do the actual upgrade
   256 	// Do the actual upgrade
   254 	enano_perform_upgrade($target_branch);
   257 	enano_perform_upgrade($db_version);
   255 	
   258 	
   256 	// Mark as upgrade-in-progress
   259 	// Mark as upgrade-in-progress
   257 	setConfig('enano_version', 'upg-' . installer_enano_version());
   260 	setConfig('enano_version', 'upg-' . installer_enano_version());
   258 	
   261 	
   259 	?>
   262 	?>
   311 }
   314 }
   312 else
   315 else
   313 {
   316 {
   314 	?>
   317 	?>
   315 	<h3><?php echo $lang->get('upgrade_confirm_title'); ?></h3>
   318 	<h3><?php echo $lang->get('upgrade_confirm_title'); ?></h3>
   316 	<p><?php echo $lang->get('upgrade_confirm_body', array('enano_version' => installer_enano_version())); ?></p>
   319 	<p><?php echo $lang->get('upgrade_confirm_body', array('enano_version' => installer_enano_version(), 'db_version' => $db_version)); ?></p>
   317 	<ul>
   320 	<ul>
   318 		<li><?php echo $lang->get('upgrade_confirm_objective_backup_fs', array('dir' => ENANO_ROOT)); ?></li>
   321 		<li><?php echo $lang->get('upgrade_confirm_objective_backup_fs', array('dir' => ENANO_ROOT)); ?></li>
   319 		<li><?php echo $lang->get('upgrade_confirm_objective_backup_db', array('dbname' => $dbname)); ?></li>
   322 		<li><?php echo $lang->get('upgrade_confirm_objective_backup_db', array('dbname' => $dbname)); ?></li>
   320 	</ul>
   323 	</ul>
   321 	<?php
   324 	<?php