From f02b3743b6b6bc3f362aa4a645ca88798d6414f1 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Sun, 16 Jan 2011 01:56:12 +0000
Subject: [PATCH] Fix: Works with mysql 5.5

---
 htdocs/install/etape2.php                      | 6 ++----
 htdocs/install/mysql/migration/2.9.0-3.0.0.sql | 2 +-
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/htdocs/install/etape2.php b/htdocs/install/etape2.php
index cf035eb30dd..645b5484325 100644
--- a/htdocs/install/etape2.php
+++ b/htdocs/install/etape2.php
@@ -143,7 +143,6 @@ if ($_POST["action"] == "set")
 	{
 		// We always choose in mysql directory (Conversion is done by driver to translate SQL syntax)
 		$dir = "mysql/tables/";
-		$versionmysql550=explode('.','5.5.0');
 
 		$ok = 0;
 		$handle=opendir($dir);
@@ -184,10 +183,9 @@ if ($_POST["action"] == "set")
 				fclose($fp);
 
 				$buffer=trim($buffer);
-				// For Mysql 5.5+, we must removed type=innodb
-				if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli')
+				if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli')	// For Mysql 5.5+, we must replace type=innodb
 				{
-					if (sizeof($versionarray) && versioncompare($versionarray,$versionmysql550) >= 0) $buffer=preg_replace('/type=innodb/i','',$buffer);
+					$buffer=preg_replace('/type=innodb/i','ENGINE=innodb',$buffer);
 				}
 
 				//print "<tr><td>Creation de la table $name/td>";
diff --git a/htdocs/install/mysql/migration/2.9.0-3.0.0.sql b/htdocs/install/mysql/migration/2.9.0-3.0.0.sql
index 893a9e129ce..4184a5fa6fb 100644
--- a/htdocs/install/mysql/migration/2.9.0-3.0.0.sql
+++ b/htdocs/install/mysql/migration/2.9.0-3.0.0.sql
@@ -88,7 +88,7 @@ CREATE TABLE llx_c_ziptown
   zip	 			varchar(10) NOT NULL,
   town				varchar(255) NOT NULL,
   active 			tinyint NOT NULL DEFAULT 1
-)type=innodb;
+) ENGINE=innodb;
 
 ALTER TABLE llx_c_ziptown ADD INDEX idx_c_ziptown_fk_county (fk_county);
 ALTER TABLE llx_c_ziptown ADD CONSTRAINT fk_c_ziptown_fk_county		FOREIGN KEY (fk_county)   REFERENCES llx_c_departements (rowid);
-- 
GitLab