From 1e3edb9bed3668090aa95514bbd5af12083e7a7d Mon Sep 17 00:00:00 2001 From: Benjamin Sonntag Date: Tue, 14 Jun 2011 16:00:15 +0000 Subject: [PATCH] trying to fix 1.0 broken upgrade path --- .gitattributes | 1 + debian/changelog | 5 +++++ install/upgrades/1.0.1.php | 32 ++++++++++++++++++++++++++++++++ install/upgrades/1.0.sql | 3 ++- 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 install/upgrades/1.0.1.php diff --git a/.gitattributes b/.gitattributes index fe561408..72209945 100644 --- a/.gitattributes +++ b/.gitattributes @@ -425,6 +425,7 @@ install/upgrades/0.9.5.sql -text install/upgrades/0.9.6.sql -text install/upgrades/0.9.7.sql -text install/upgrades/0.9.9.sql -text +install/upgrades/1.0.1.php -text install/upgrades/1.0.sql -text install/upgrades/README -text man/alternc-admintools.8 -text diff --git a/debian/changelog b/debian/changelog index 72ab95d9..797c61fd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,8 @@ +alternc (1.0.1) stable; urgency=high + * Bugfix : upgrades from 0.* to 1.0 was not working for MX fields, Fixed. + + -- Benjamin Sonntag Thu, 14 Jun 2011 17:59:50 +0200 + alternc (1.0) stable; urgency=low * Major patch * Web & DNS file generation rebuild from scratch diff --git a/install/upgrades/1.0.1.php b/install/upgrades/1.0.1.php new file mode 100644 index 00000000..b533ac47 --- /dev/null +++ b/install/upgrades/1.0.1.php @@ -0,0 +1,32 @@ +#!/usr/bin/php +enabled=1; + +// And we process the database changes : +$db->query("SELECT * FROM domaines WHERE gesmx=1;"); +$domains=array(); +while ($db->next_record()) { + $domains[]=array("dom"=>$db->Record["domaine"],"gesmx"=>$db->Record["gesmx"],"mx"=>$db->Record["mx"]); +} +foreach($domains as $v) { + if ($v["gesmx"]) { + $dom->alternc_add_mx_domain($v["dom"]); + } else { + $dom->set_sub_domain($v["dom"],"","mx",$v["mx"]); + } +} + +?> \ No newline at end of file diff --git a/install/upgrades/1.0.sql b/install/upgrades/1.0.sql index cebaf920..a22db4cf 100644 --- a/install/upgrades/1.0.sql +++ b/install/upgrades/1.0.sql @@ -107,5 +107,6 @@ UPDATE sub_domaines SET type='TXT' WHERE type='6'; UPDATE sub_domaines SET web_action='UPDATE'; -- not needed : it's now a subdomain with defmx and/or defmx2 type (this type is admin-only) : -ALTER TABLE `domaines` DROP `mx` ; +-- ALTER TABLE `domaines` DROP `mx` ; +-- BUT we will remove it in a distant future version : we need it for the migration to take place fluently ...