Fixed a few more upgrader glitches and polished things a bit more.
authorDan
Sat, 12 Jul 2008 00:31:44 -0400
changeset 627 460e483987ab
parent 626 be0e904eec17
child 628 ab6f55abb17e
Fixed a few more upgrader glitches and polished things a bit more.
install/includes/libenanoinstall.php
install/includes/payload.php
install/upgrade.php
language/english/install.json
--- a/install/includes/libenanoinstall.php	Sat Jul 12 00:07:53 2008 -0400
+++ b/install/includes/libenanoinstall.php	Sat Jul 12 00:31:44 2008 -0400
@@ -126,11 +126,21 @@
   global $ui;
   // This is needed for upgrade abstraction
   global $dbdriver;
+  
+  // see if we're actually supposed to be in post-upgrade
+  if ( getConfig('enano_version') == 'upg-' . installer_enano_version() )
+  {
+    // yep, fall out here to avoid errors
+    return true;
+  }
+  
   // Main upgrade stage
   
   // Init vars
   list($major_version, $minor_version) = explode('.', installer_enano_version());
   $installer_branch = "$major_version.$minor_version";
+  $installer_branch = preg_replace('/^upg-/', '', $installer_branch);
+  $target_branch = preg_replace('/^upg-/', '', $target_branch);
   
   $version_flipped = array_flip($enano_versions[$target_branch]);
   $version_curr = enano_version();
--- a/install/includes/payload.php	Sat Jul 12 00:07:53 2008 -0400
+++ b/install/includes/payload.php	Sat Jul 12 00:31:44 2008 -0400
@@ -474,10 +474,10 @@
 
 function stg_set_version()
 {
-  global $db;
+  global $db, $session, $paths, $template, $plugins; // Common objects
   // log the upgrade
   $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,date_string,author,page_text,edit_summary) VALUES'
-         . '(\'security\', \'upgrade_enano\', ' . time() . ', \'[DEPRECATED]\', \'' . $db->escape($session->username) . '\', \'' . $db->escape($this_version) . '\', \'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\');');
+         . '(\'security\', \'upgrade_enano\', ' . time() . ', \'[DEPRECATED]\', \'' . $db->escape($session->username) . '\', \'' . $db->escape(installer_enano_version()) . '\', \'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\');');
   if ( !$q )
   {
     $db->_die();
--- a/install/upgrade.php	Sat Jul 12 00:07:53 2008 -0400
+++ b/install/upgrade.php	Sat Jul 12 00:31:44 2008 -0400
@@ -59,7 +59,10 @@
 if ( enano_version() == installer_enano_version() )
 {
   $ui->show_header();
-  echo '<h3>Already upgraded</h3>' . '<p>You don\'t need to migrate, you\'re already on <del>crack</del> the 1.1 platform.</p>';
+  $link_home = makeUrl(getConfig('main_page'), false, true);
+  echo '<h3>' . $lang->get('upgrade_err_current_title') . '</h3>' .
+       '<p>' . $lang->get('upgrade_err_current_body', array('mainpage_link' => $link_home)) . '</p>' .
+       '<p>' . $lang->get('upgrade_err_current_body_para2', array('mainpage_link' => $link_home)) . '</p>';
   $ui->show_footer();
   exit();
 }
@@ -175,7 +178,7 @@
    */
   
   // Do we need to run the migration first?
-  list($major_version, $minor_version) = explode('.', enano_version());
+  list($major_version, $minor_version) = explode('.', preg_replace('/^upg-/', '', enano_version()));
   $current_branch = "$major_version.$minor_version";
   
   list($major_version, $minor_version) = explode('.', installer_enano_version());
@@ -213,8 +216,8 @@
   <form action="upgrade.php" method="get" style="text-align: center;">
     <input type="hidden" name="auth" value="<?php echo $session->sid_super; ?>" />
     <p style="text-align: center;">
-      <button name="stage" value="postpimp">
-        <?php echo $lang->get('etc_continue'); ?>
+      <button name="stage" value="postpimp" class="submit">
+        <?php echo $lang->get('upgrade_btn_continue'); ?>
       </button>
     </p>
   </form>
@@ -249,6 +252,9 @@
   run_installer_stage('setversion', $lang->get('upgrade_stg_setversion_title'), 'stg_set_version', $lang->get('upgrade_stg_setversion_body'));
   close_install_table();
   
+  // demote privileges
+  $session->logout(USER_LEVEL_ADMIN);
+  
   $link_home = makeUrl(getConfig('main_page'), false, true);
   echo '<h3>' . $lang->get('upgrade_post_status_finish_title') . '</h3>';
   echo '<p>' . $lang->get('upgrade_post_status_finish_body', array('mainpage_link' => $link_home)) . '</p>';
--- a/language/english/install.json	Sat Jul 12 00:07:53 2008 -0400
+++ b/language/english/install.json	Sat Jul 12 00:31:44 2008 -0400
@@ -374,12 +374,19 @@
       confirm_objective_backup_db: 'Back up Enano database, including non-Enano tables if any (<b>%dbname%</b>)',
       confirm_btn_upgrade: 'Pimp my Enano!',
       
+      msg_schema_complete_title: 'Database upgrades complete',
+      msg_schema_complete_body: 'You\'re past the hard part - all of the modifications to your database were successful. We need to perform a few final steps to finish the upgrade; just click the button below to finish everything up.',
+      btn_continue: 'Finish upgrade',
+      
+      err_current_title: 'Already running current version',
+      err_current_body: 'No database upgrades are needed right now, you\'re already running the Enano version set in this installer. Try <a href="%mainpage_link%">heading back to your site</a>. Think there\'s a mistake somewhere? <a href="http://forum.enanocms.org/">Let the Enano team know about it</a>.',
+      err_current_body_para2: 'You might also want to use the administration panel to check for updates, or <a href="http://enanocms.org/download">download the latest release</a> of Enano.',
       err_post_not_available: 'You\'re trying to run the post-upgrade process, but your site isn\'t in the correct state for this.',
       
       post_status_title: 'Finishing upgrade',
       post_status_body: 'Enano is cleaning up some data and finalizing the upgrade.',
       post_status_finish_title: 'All done!',
-      post_status_finish_body: 'That\'s it - Enano has been upgraded. You should <a href="%mainpage_link%">go back to your site</a> now and make sure that everything works right. If you find a problem, be sure to report it to the <a href="http://forum.enanocms.org/">Enano development team</a>. (Make sure you disable any plugins first, since we can\'t easily tell if your problem is caused by the Enano core or by a plugin.)',
+      post_status_finish_body: 'That\'s it - Enano has been upgraded. You should <a href="%mainpage_link%">go back to your site</a> now and make sure that everything works right. If you find a problem, be sure to report it to the <a href="http://forum.enanocms.org/">Enano development team</a>. (Make sure you disable any plugins first, since we can\'t easily tell if your problem is caused by the Enano core or by a plugin, unless all of your non-system plugins are disabled.)',
       
       stg_flushcache_title: 'Flush caches',
       stg_flushcache_body: 'The upgrader failed to delete some cached data. You may experience some problems with file corruption or badly drawn pages until the caches expire, which is often no longer than 20 minutes.',