0) {
/* Do NOT remove the trailing space after / from $backup_cmd below!!! */
$backup_cmd = "/usr/bin/tar --create --verbose --gzip --file {$backup_path} --directory / ";
foreach ($a_backup as $ent) {
if ($ent['enabled'] == "true") {
$backup_cmd .= htmlspecialchars($ent['path']) . ' ';
}
$i++;
}
system($backup_cmd);
}
session_cache_limiter('public');
$fd = fopen("{$backup_path}", "rb");
header("Content-Type: application/force-download");
header("Content-Type: binary/octet-stream");
header("Content-Type: application/download");
header("Content-Description: File Transfer");
header('Content-Disposition: attachment; filename="' . $backup_filename . '"');
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
header("Content-Length: " . filesize($backup_path));
fpassthru($fd);
conf_mount_ro();
exit;
}
}
if ($_GET['a'] == "other") {
if ($_GET['t'] == "restore") {
// Extract the tgz file
if (file_exists($backup_path)) {
conf_mount_rw();
system("/usr/bin/tar -xpzC / -f {$backup_path}");
header("Location: backup.php?savemsg=Backup+has+been+restored.");
} else {
header("Location: backup.php?savemsg=Restore+failed.+Backup+file+not+found.");
}
conf_mount_ro();
exit;
}
}
if (($_POST['submit'] == "Upload") && is_uploaded_file($_FILES['ulfile']['tmp_name'])) {
conf_mount_rw();
move_uploaded_file($_FILES['ulfile']['tmp_name'], "{$backup_path}");
$savemsg = "Uploaded file to {$backup_dir}" . htmlentities($_FILES['ulfile']['name']);
system("/usr/bin/tar -xpzC / -f {$backup_path}");
conf_mount_ro();
}
$pgtitle = "Backup: Files & Directories";
include("head.inc");
?>
Use this to tool to backup files and directories. The following directories are recommended for backup:
| |
pfSense Config | /cf/conf |
RRD Graph Data Files | /var/db/rrd |
|
|