Fixed the (rather expected) 1.0.x migration issues db revision system
authorDan Fuhry <dan@enanocms.org>
Thu, 01 Jul 2010 20:51:53 -0400
changeset 1260 cd72bcd83401
parent 1259 49db7495f6b8
child 1261 beb0da036222
Fixed the (rather expected) 1.0.x migration issues db revision system
includes/common.php
includes/sessions.php
install/includes/libenanoinstall.php
language/english/install.json
--- a/includes/common.php	Thu Jul 01 20:24:19 2010 -0400
+++ b/includes/common.php	Thu Jul 01 20:51:53 2010 -0400
@@ -288,7 +288,7 @@
 }
 
 // If we made it here, DB is up to date.
-if ( getConfig('enano_version') !== $version && !preg_match('/^upg-/', getConfig('enano_version')) )
+if ( getConfig('enano_version') !== $version && !preg_match('/^upg-/', getConfig('enano_version')) && !defined('IN_ENANO_UPGRADE') )
 {
 	setConfig('enano_version', $version);
 	setConfig('newly_upgraded', 1);
--- a/includes/sessions.php	Thu Jul 01 20:24:19 2010 -0400
+++ b/includes/sessions.php	Thu Jul 01 20:51:53 2010 -0400
@@ -833,10 +833,20 @@
 			
 			if($sess)
 			{
-				if($level > USER_LEVEL_MEMBER)
-					$this->sql('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,date_string,author,author_uid,edit_summary,page_text) VALUES(\'security\', \'admin_auth_good\', '.time().', \''.enano_date(ED_DATE | ED_TIME).'\', \''.$db->escape($username).'\', ' . $row['user_id'] . ', \''.$db->escape($_SERVER['REMOTE_ADDR']).'\', ' . intval($level) . ')');
+				if ( getConfig('db_version') >= 1125 )
+				{
+					if($level > USER_LEVEL_MEMBER)
+						$this->sql('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,date_string,author,author_uid,edit_summary,page_text) VALUES(\'security\', \'admin_auth_good\', '.time().', \''.enano_date(ED_DATE | ED_TIME).'\', \''.$db->escape($username).'\', ' . $row['user_id'] . ', \''.$db->escape($_SERVER['REMOTE_ADDR']).'\', ' . intval($level) . ')');
+					else
+						$this->sql('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,date_string,author,author_uid,edit_summary) VALUES(\'security\', \'auth_good\', '.time().', \''.enano_date(ED_DATE | ED_TIME).'\', \''.$db->escape($username).'\', ' . $row['user_id'] . ', \''.$db->escape($_SERVER['REMOTE_ADDR']).'\')');
+				}
 				else
-					$this->sql('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,date_string,author,author_uid,edit_summary) VALUES(\'security\', \'auth_good\', '.time().', \''.enano_date(ED_DATE | ED_TIME).'\', \''.$db->escape($username).'\', ' . $row['user_id'] . ', \''.$db->escape($_SERVER['REMOTE_ADDR']).'\')');
+				{
+					if($level > USER_LEVEL_MEMBER)
+						$this->sql('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,date_string,author,edit_summary,page_text) VALUES(\'security\', \'admin_auth_good\', '.time().', \''.enano_date(ED_DATE | ED_TIME).'\', \''.$db->escape($username).'\', \''.$db->escape($_SERVER['REMOTE_ADDR']).'\', ' . intval($level) . ')');
+					else
+						$this->sql('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,date_string,author,edit_summary) VALUES(\'security\', \'auth_good\', '.time().', \''.enano_date(ED_DATE | ED_TIME).'\', \''.$db->escape($username).'\', \''.$db->escape($_SERVER['REMOTE_ADDR']).'\')');
+				}
 				
 				$code = $plugins->setHook('login_success');
 				foreach ( $code as $cmd )
--- a/install/includes/libenanoinstall.php	Thu Jul 01 20:24:19 2010 -0400
+++ b/install/includes/libenanoinstall.php	Thu Jul 01 20:51:53 2010 -0400
@@ -174,6 +174,13 @@
 		}
 	}
 	
+	// cap to target rev
+	foreach ( $upg_queue as $i => $ver )
+	{
+		if ( $ver > $target_rev )
+			unset($upg_queue[$i]);
+	}
+	
 	// Perform upgrade
 	foreach ( $upg_queue as $version )
 	{
--- a/language/english/install.json	Thu Jul 01 20:24:19 2010 -0400
+++ b/language/english/install.json	Thu Jul 01 20:51:53 2010 -0400
@@ -422,7 +422,7 @@
 			
 			welcome_banshee_heading: 'Welcome to Enano %enano_version%.',
 			welcome_banshee_para1: 'Enano 1.2 features support for multiple languages, better security, faster page loading, more tools, a revamped page editor, and much more. This migration tool will automatically make the changes to your database required for Enano 1.2.',
-			welcome_banshee_para2: 'The migration tool has been tested under many different installation scenarios, but isn\'t fully guaranteed to work. The Enano team can\'t be responsible if the migration fails. If you encounted problems, please be sure to post on the <a href="http://forum.enanocms.org/">Enano forums</a>.',
+			welcome_banshee_para2: 'The migration tool has been tested under many different installation scenarios, but isn\'t fully guaranteed to work. The Enano team can\'t be responsible if the migration fails. If you encounter problems, please be sure to post on the <a href="http://forum.enanocms.org/">Enano forums</a>.',
 			welcome_caoineag_heading: 'Welcome to the Enano upgrade tool.',
 			welcome_caoineag_para1: 'To use this version of Enano, some parts of your database need to be upgraded. This tool will automatically perform the upgrade for you.',
 			welcome_btn_continue: 'Start upgrade',