Révision be544b90
Ajouté par Ermal LUÇI il y a plus de 9 ans
etc/inc/rrd.inc | ||
---|---|---|
58 | 58 |
foreach (glob("{$rrddbpath}/*.xml") as $xml_file) { |
59 | 59 |
@unlink($xml_file); |
60 | 60 |
} |
61 |
$_gb = exec("cd /;LANG=C /usr/bin/tar -xzf {$g['cf_conf_path']}/rrd.tgz 2>&1", $rrdrestore, $rrdreturn);
|
|
62 |
$rrdrestore = implode(" ", $rrdrestore);
|
|
61 |
unset($rrdrestore);
|
|
62 |
$_gb = exec("cd /;LANG=C /usr/bin/tar -tf {$g['cf_conf_path']}/rrd.tgz", $rrdrestore, $rrdreturn);
|
|
63 | 63 |
if($rrdreturn != 0) { |
64 | 64 |
log_error("RRD restore failed exited with $rrdreturn, the error is: $rrdrestore\n"); |
65 | 65 |
} |
66 |
unset($rrdrestore); |
|
67 |
foreach (glob("{$rrddbpath}/*.xml") as $xml_file) { |
|
68 |
$rrd_file = preg_replace('/\.xml$/', ".rrd", $xml_file); |
|
69 |
if (file_exists("{$rrd_file}")) { |
|
66 |
foreach ($rrdrestore as $xml_file) { |
|
67 |
$rrd_file = '/' . substr($xml_file, 0, -4) . '.rrd'; |
|
68 |
if (file_exists("{$rrd_file}")) |
|
70 | 69 |
@unlink($rrd_file); |
70 |
file_put_contents("{$g['tmp_path']}/rrd_restore", $xml_file); |
|
71 |
$_gb = exec("cd /;LANG=C /usr/bin/tar -xf {$g['cf_conf_path']}/rrd.tgz -T {$g['tmp_path']}/rrd_restore"); |
|
72 |
if (!file_exists("/{$xml_file}")) { |
|
73 |
log_error("Could not extract {$xml_file} RRD xml file from archive!"); |
|
74 |
continue; |
|
71 | 75 |
} |
72 |
$output = array(); |
|
73 |
$status = null; |
|
74 |
$_gb = exec("$rrdtool restore -f '{$xml_file}' '{$rrd_file}'", $output, $status); |
|
76 |
$_gb = exec("$rrdtool restore -f '/{$xml_file}' '{$rrd_file}'", $output, $status); |
|
75 | 77 |
if ($status) { |
76 | 78 |
log_error("rrdtool restore -f '{$xml_file}' '{$rrd_file}' failed returning {$status}."); |
77 | 79 |
continue; |
78 | 80 |
} |
79 | 81 |
unset($output); |
80 |
@unlink($xml_file);
|
|
82 |
@unlink("/{$xml_file}");
|
|
81 | 83 |
} |
84 |
unset($rrdrestore); |
|
82 | 85 |
/* If this backup is still there on a full install, but we aren't going to use ram disks, remove the archive since this is a transition. */ |
83 | 86 |
if (($g['platform'] == "pfSense") && !isset($config['system']['use_mfs_tmpvar'])) { |
84 | 87 |
unlink_if_exists("{$g['cf_conf_path']}/rrd.tgz"); |
Formats disponibles : Unified diff
Ticket #4053, manually merge improvements on rrd restore handling.