trying to fix 1.0 broken upgrade path

This commit is contained in:
Benjamin Sonntag 2011-06-14 16:00:15 +00:00
parent 1afa18a361
commit 1e3edb9bed
4 changed files with 40 additions and 1 deletions

1
.gitattributes vendored
View File

@ -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

5
debian/changelog vendored
View File

@ -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 <benjamin@alternc.org> Thu, 14 Jun 2011 17:59:50 +0200
alternc (1.0) stable; urgency=low
* Major patch
* Web & DNS file generation rebuild from scratch

View File

@ -0,0 +1,32 @@
#!/usr/bin/php
<?php
// We check that mysql php module is loaded
if(!function_exists('mysql_connect')) {
if(!dl("mysql.so"))
exit(1);
}
// we don't check our AlternC session
if(!chdir("/var/alternc/bureau"))
exit(1);
require("/var/alternc/bureau/class/config_nochk.php");
// we go super-admin
$admin->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"]);
}
}
?>

View File

@ -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 ...