summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErmal LUÇI <eri@pfsense.org>2014-11-28 21:50:48 +0100
committerErmal LUÇI <eri@pfsense.org>2014-11-28 21:50:48 +0100
commit7966b0dff9985cca43912e53b0770f9a1c981b9a (patch)
tree0c18d9b0845545e31882e757c0732d0217a942b5
parentc1819b48708ca8d712e1a3b9b8f7b2c4ed4e056b (diff)
downloadpfsense-7966b0dff9985cca43912e53b0770f9a1c981b9a.zip
pfsense-7966b0dff9985cca43912e53b0770f9a1c981b9a.tar.gz
Make restore one by one to help https://forum.pfsense.org/index.php?topic=84693.0
-rw-r--r--etc/inc/rrd.inc20
1 files changed, 12 insertions, 8 deletions
diff --git a/etc/inc/rrd.inc b/etc/inc/rrd.inc
index e88105e..e058926 100644
--- a/etc/inc/rrd.inc
+++ b/etc/inc/rrd.inc
@@ -58,20 +58,24 @@ function restore_rrd() {
foreach (glob("{$rrddbpath}/*.xml") as $xml_file) {
@unlink($xml_file);
}
- $_gb = exec("cd /;LANG=C /usr/bin/tar -xzf {$g['cf_conf_path']}/rrd.tgz 2>&1", $rrdrestore, $rrdreturn);
- $rrdrestore = implode(" ", $rrdrestore);
+ unset($rrdrestore);
+ $_gb = exec("cd /;LANG=C /usr/bin/tar -tf {$g['cf_conf_path']}/rrd.tgz", $rrdrestore, $rrdreturn);
if($rrdreturn != 0) {
log_error("RRD restore failed exited with $rrdreturn, the error is: $rrdrestore\n");
+ return;
}
unset($rrdrestore);
- foreach (glob("{$rrddbpath}/*.xml") as $xml_file) {
- $rrd_file = preg_replace('/\.xml$/', ".rrd", $xml_file);
- if (file_exists("{$rrd_file}")) {
+ foreach ($rrdrestore as $xml_file) {
+ $rrd_file = '/' . substr($xml_file, 0, -4) . '.rrd';
+ if (file_exists("{$rrd_file}"))
@unlink($rrd_file);
+ file_put_contents("{$g['tmp_path']}/rrd_restore", $xml_file);
+ $_gb = exec("cd /;LANG=C /usr/bin/tar -xf {$g['cf_conf_path']}/rrd.tgz -T {$g['tmp_path']}/rrd_restore");
+ if (!file_exists("/{$xml_file}")) {
+ log_error("Could not extract {$xml_file} RRD xml file from archive!");
+ continue;
}
- $output = array();
- $status = null;
- $_gb = exec("$rrdtool restore -f '{$xml_file}' '{$rrd_file}'", $output, $status);
+ $_gb = exec("$rrdtool restore -f '/{$xml_file}' '{$rrd_file}'", $output, $status);
if ($status) {
log_error("rrdtool restore -f '{$xml_file}' '{$rrd_file}' failed returning {$status}.");
continue;
OpenPOWER on IntegriCloud