Restore the RRD backup before attempting a migration as this bites the nanobsd users.

We immediately backup the new databases to a new rrd.tgz file. The old database will be moved to /root
Fix for ticket #1758
This commit is contained in:
smos 2011-10-13 14:12:39 +02:00
parent 3f57df7582
commit eb5e790f09

View File

@ -1936,6 +1936,17 @@ function upgrade_054_to_055() {
$rrddbpath = "/var/db/rrd/";
$rrdtool = "/usr/bin/nice -n20 /usr/local/bin/rrdtool";
if ($g['platform'] != "pfSense") {
/* restore the databases, if we have one */
if (file_exists("{$g['cf_conf_path']}/rrd.tgz")) {
exec("cd /;LANG=C /usr/bin/tar -xzf {$g['cf_conf_path']}/rrd.tgz 2>&1", $rrdrestore, $rrdreturn); $rrdrestore = implode(" ", $rrdrestore);
if($rrdreturn <> 0) {
log_error("RRD restore failed exited with $rrdreturn, the error is: $rrdrestore\n");
}
/* Make sure to move the rrd backup out of the way. We will make a new one after converting. */
exec("/bin/mv {$g['cf_conf_path']}/rrd.tgz /root/");
}
}
$rrdinterval = 60;
$valid = $rrdinterval * 2;
@ -2049,6 +2060,9 @@ function upgrade_054_to_055() {
}
enable_rrd_graphing();
/* Let's save the RRD graphs after we run enable RRD graphing */
/* The function will restore the rrd.tgz so we will save it after */
exec("cd /;LANG=C /usr/bin/tar -czf {$g['cf_conf_path']}/rrd.tgz -C / var/db/rrd/*.rrd");
if ($g['booting'])
echo "Updating configuration...";
}