mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 08:34:39 +00:00
globals: mostly zap cf_conf_path for #1
Also style, license prettify, obvious bugs along the way.
This commit is contained in:
parent
3f8a9f0898
commit
aa3a73bfe7
@ -91,7 +91,7 @@ if($g['booting'] && file_exists("/cf/conf/config.xml")) {
|
||||
}
|
||||
|
||||
/* if our config file exists bail out, we're already set. */
|
||||
else if ($g['booting'] and !file_exists($g['cf_conf_path'] . "/config.xml") ) {
|
||||
else if ($g['booting'] && !file_exists('/cf/conf/config.xml')) {
|
||||
if($g['booting']) echo ".";
|
||||
/* find the device where config.xml resides and write out an fstab */
|
||||
unset($cfgdevice);
|
||||
@ -124,7 +124,7 @@ else if ($g['booting'] and !file_exists($g['cf_conf_path'] . "/config.xml") ) {
|
||||
if (strstr($mountdisk, "md"))
|
||||
continue;
|
||||
if (mwexec("/sbin/mount -r /dev/{$mountdisk}a {$g['cf_path']}") == 0) {
|
||||
if (file_exists("{$g['cf_conf_path']}/config.xml")) {
|
||||
if (file_exists('cf/conf/config.xml')) {
|
||||
/* found it */
|
||||
$cfgdevice = $mountdisk;
|
||||
$cfgpartition = $cfgdevice . "a";
|
||||
@ -139,7 +139,7 @@ else if ($g['booting'] and !file_exists($g['cf_conf_path'] . "/config.xml") ) {
|
||||
}
|
||||
if (mwexec("/sbin/mount -r /dev/{$mountdisk}d {$g['cf_path']}") == 0) {
|
||||
if($g['booting']) echo ".";
|
||||
if (file_exists("{$g['cf_conf_path']}/config.xml")) {
|
||||
if (file_exists('/cf/conf/config.xml')) {
|
||||
/* found it */
|
||||
$cfgdevice = $mountdisk;
|
||||
$cfgpartition = $cfgdevice . "d";
|
||||
|
||||
@ -1,19 +1,8 @@
|
||||
<?php
|
||||
/****h* pfSense/config
|
||||
* NAME
|
||||
* config.lib.inc - Functions to manipulate config.xml
|
||||
* DESCRIPTION
|
||||
* This include contains various config.xml specific functions.
|
||||
* HISTORY
|
||||
* $Id$
|
||||
******
|
||||
|
||||
config.lib.inc
|
||||
/*
|
||||
Ported from config.inc by Erik Kristensen
|
||||
Copyright (C) 2004-2010 Scott Ullrich
|
||||
All rights reserved.
|
||||
|
||||
originally part of m0n0wall (http://m0n0.ch/wall)
|
||||
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
||||
All rights reserved.
|
||||
|
||||
@ -37,10 +26,6 @@
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
pfSense_BUILDER_BINARIES: /sbin/mount /sbin/umount /sbin/halt /sbin/fsck
|
||||
pfSense_MODULE: config
|
||||
*/
|
||||
|
||||
/****f* config/encrypted_configxml
|
||||
@ -520,10 +505,10 @@ function write_config($desc = 'Unknown', $backup = true)
|
||||
$xmlconfig = dump_xml_config($config, $g['xml_rootobj']);
|
||||
|
||||
/* write new configuration */
|
||||
if (!safe_write_file("{$g['cf_conf_path']}/config.xml", $xmlconfig, false)) {
|
||||
if (!safe_write_file('/cf/conf/config.xml', $xmlconfig, false)) {
|
||||
log_error(gettext("WARNING: Config contents could not be save. Could not open file!"));
|
||||
unlock($lockkey);
|
||||
file_notice("config.xml", sprintf(gettext("Unable to open %s/config.xml for writing in write_config()%s"), $g['cf_conf_path'], "\n"));
|
||||
file_notice('config.xml', sprintf("%s\n", gettext('Unable to open /cf/conf/config.xml for writing in write_config()')));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -580,7 +565,7 @@ function reset_factory_defaults($lock = false) {
|
||||
$lockkey = lock('config', LOCK_EX);
|
||||
|
||||
/* create conf directory, if necessary */
|
||||
safe_mkdir("{$g['cf_conf_path']}");
|
||||
safe_mkdir('/cf/conf');
|
||||
|
||||
/* clear out /conf */
|
||||
$dh = opendir($g['conf_path']);
|
||||
@ -619,7 +604,7 @@ function config_restore($conffile) {
|
||||
$lockkey = lock('config', LOCK_EX);
|
||||
|
||||
unlink_if_exists("{$g['tmp_path']}/config.cache");
|
||||
copy($conffile, "{$g['cf_conf_path']}/config.xml");
|
||||
copy($conffile, '/cf/conf/config.xml');
|
||||
|
||||
disable_security_checks();
|
||||
|
||||
@ -736,7 +721,7 @@ function cleanup_backupcache($lock = false) {
|
||||
$baktimes = array();
|
||||
}
|
||||
$newbaks = array();
|
||||
$bakfiles = glob($g['cf_conf_path'] . "/backup/config-*");
|
||||
$bakfiles = glob('/cf/conf/backup/config-*');
|
||||
$tocache = array();
|
||||
|
||||
foreach($bakfiles as $backup) { // Check for backups in the directory not represented in the cache.
|
||||
@ -785,7 +770,7 @@ function cleanup_backupcache($lock = false) {
|
||||
}
|
||||
$tocache = $newcache;
|
||||
}
|
||||
$bakout = fopen($g['cf_conf_path'] . '/backup/backup.cache', "w");
|
||||
$bakout = fopen('/cf/conf/backup/backup.cache', 'w');
|
||||
fwrite($bakout, serialize($tocache));
|
||||
fclose($bakout);
|
||||
conf_mount_ro();
|
||||
@ -794,10 +779,10 @@ function cleanup_backupcache($lock = false) {
|
||||
unlock($lockkey);
|
||||
}
|
||||
|
||||
function get_backups() {
|
||||
global $g;
|
||||
if(file_exists("{$g['cf_conf_path']}/backup/backup.cache")) {
|
||||
$confvers = unserialize(file_get_contents("{$g['cf_conf_path']}/backup/backup.cache"));
|
||||
function get_backups()
|
||||
{
|
||||
if (file_exists('/cf/conf/backup/backup.cache')) {
|
||||
$confvers = unserialize(file_get_contents('/cf/conf/backup/backup.cache'));
|
||||
$bakvers = array_keys($confvers);
|
||||
$toreturn = array();
|
||||
sort($bakvers);
|
||||
@ -811,37 +796,39 @@ function get_backups() {
|
||||
return $toreturn;
|
||||
}
|
||||
|
||||
function backup_config() {
|
||||
global $config, $g;
|
||||
|
||||
function backup_config()
|
||||
{
|
||||
conf_mount_rw();
|
||||
|
||||
/* Create backup directory if needed */
|
||||
safe_mkdir("{$g['cf_conf_path']}/backup");
|
||||
safe_mkdir('/cf/conf/backup');
|
||||
|
||||
if($config['revision']['time'] == "") {
|
||||
$baktime = 0;
|
||||
} else {
|
||||
$baktime = $config['revision']['time'];
|
||||
}
|
||||
if($config['revision']['description'] == "") {
|
||||
$bakdesc = "Unknown";
|
||||
} else {
|
||||
$bakdesc = $config['revision']['description'];
|
||||
}
|
||||
if ($config['revision']['time'] == '') {
|
||||
$baktime = 0;
|
||||
} else {
|
||||
$baktime = $config['revision']['time'];
|
||||
}
|
||||
|
||||
if ($config['revision']['description'] == '') {
|
||||
$bakdesc = 'Unknown';
|
||||
} else {
|
||||
$bakdesc = $config['revision']['description'];
|
||||
}
|
||||
|
||||
$bakver = ($config['version'] == '') ? '?' : $config['version'];
|
||||
$bakfilename = '/cf/conf/backup/config-' . $baktime . '.xml';
|
||||
copy('/cf/conf/config.xml', $bakfilename);
|
||||
|
||||
if (file_exists('/cf/conf/backup/backup.cache')) {
|
||||
$backupcache = unserialize(file_get_contents('/cf/conf/backup/backup.cache'));
|
||||
} else {
|
||||
$backupcache = array();
|
||||
}
|
||||
|
||||
$bakver = ($config['version'] == "") ? "?" : $config['version'];
|
||||
$bakfilename = $g['cf_conf_path'] . '/backup/config-' . $baktime . '.xml';
|
||||
copy($g['cf_conf_path'] . '/config.xml', $bakfilename);
|
||||
if(file_exists($g['cf_conf_path'] . '/backup/backup.cache')) {
|
||||
$backupcache = unserialize(file_get_contents($g['cf_conf_path'] . '/backup/backup.cache'));
|
||||
} else {
|
||||
$backupcache = array();
|
||||
}
|
||||
$backupcache[$baktime] = array('description' => $bakdesc, 'version' => $bakver, 'filesize' => filesize($bakfilename));
|
||||
$bakout = fopen($g['cf_conf_path'] . '/backup/backup.cache', "w");
|
||||
fwrite($bakout, serialize($backupcache));
|
||||
fclose($bakout);
|
||||
$bakout = fopen('/cf/conf/backup/backup.cache', 'w');
|
||||
fwrite($bakout, serialize($backupcache));
|
||||
fclose($bakout);
|
||||
|
||||
conf_mount_ro();
|
||||
|
||||
|
||||
@ -46,7 +46,6 @@ $g = array(
|
||||
"tmp_path" => "/tmp",
|
||||
"conf_path" => "/conf",
|
||||
"cf_path" => "/cf",
|
||||
"cf_conf_path" => "/cf/conf",
|
||||
"xml_rootobj" => "pfsense",
|
||||
"admin_group" => "admins",
|
||||
"product_name" => "OPNsense",
|
||||
|
||||
@ -1,41 +1,35 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
/*
|
||||
Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
pfSense_BUILDER_BINARIES: /bin/rm /usr/bin/nice /usr/local/bin/rrdtool /bin/cd
|
||||
pfSense_MODULE: rrd
|
||||
Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* include all configuration functions */
|
||||
function dump_rrd_to_xml($rrddatabase, $xmldumpfile)
|
||||
{
|
||||
$rrdtool = '/usr/local/bin/rrdtool';
|
||||
|
||||
function dump_rrd_to_xml($rrddatabase, $xmldumpfile) {
|
||||
$rrdtool = "/usr/bin/nice -n20 /usr/local/bin/rrdtool";
|
||||
unlink_if_exists($xmldumpfile);
|
||||
|
||||
exec("$rrdtool dump " . escapeshellarg($rrddatabase) . " {$xmldumpfile} 2>&1", $dumpout, $dumpret);
|
||||
@ -43,22 +37,24 @@ function dump_rrd_to_xml($rrddatabase, $xmldumpfile) {
|
||||
$dumpout = implode(" ", $dumpout);
|
||||
log_error(sprintf(gettext('RRD dump failed exited with %1$s, the error is: %2$s'), $dumpret, $dumpout));
|
||||
}
|
||||
|
||||
return($dumpret);
|
||||
}
|
||||
|
||||
function restore_rrd() {
|
||||
function restore_rrd()
|
||||
{
|
||||
global $g, $config;
|
||||
|
||||
$rrddbpath = "/var/db/rrd/";
|
||||
$rrdtool = "/usr/bin/nice -n20 /usr/local/bin/rrdtool";
|
||||
$rrddbpath = '/var/db/rrd/';
|
||||
$rrdtool = '/usr/local/bin/rrdtool';
|
||||
|
||||
$rrdrestore = "";
|
||||
$rrdreturn = "";
|
||||
if (file_exists("{$g['cf_conf_path']}/rrd.tgz")) {
|
||||
if (file_exists('/cf/conf/rrd.tgz')) {
|
||||
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);
|
||||
$_gb = exec('cd /;LANG=C /usr/bin/tar -xzf /cf/conf/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");
|
||||
@ -81,7 +77,7 @@ function restore_rrd() {
|
||||
}
|
||||
/* 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. */
|
||||
if (($g['platform'] == "pfSense") && !isset($config['system']['use_mfs_tmpvar'])) {
|
||||
unlink_if_exists("{$g['cf_conf_path']}/rrd.tgz");
|
||||
unlink_if_exists('/cf/conf/rrd.tgz');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1,11 +1,8 @@
|
||||
<?php
|
||||
/*
|
||||
services.inc
|
||||
part of the pfSense project (https://www.pfsense.org)
|
||||
|
||||
originally part of m0n0wall (http://m0n0.ch/wall)
|
||||
/*
|
||||
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
||||
Copyright (C) 2010 Ermal Luci
|
||||
Copyright (C) 2010 Ermal Luci
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -30,14 +27,6 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
pfSense_BUILDER_BINARIES: /usr/bin/killall /bin/pgrep /bin/sh /usr/local/sbin/dhcpd /usr/local/sbin/igmpproxy
|
||||
pfSense_BUILDER_BINARIES: /sbin/ifconfig /usr/local/sbin/dnsmasq
|
||||
pfSense_BUILDER_BINARIES: /usr/local/sbin/miniupnpd /usr/sbin/radvd
|
||||
pfSense_BUILDER_BINARIES: /usr/local/sbin/dhcleases6 /usr/sbin/bsnmpd
|
||||
pfSense_MODULE: utils
|
||||
*/
|
||||
|
||||
define('DYNDNS_PROVIDER_VALUES', 'dnsomatic dyndns dyndns-static dyndns-custom dhs dyns easydns noip noip-free ods zoneedit loopia freedns dnsexit opendns namecheap he-net he-net-v6 he-net-tunnelbroker selfhost route53 cloudflare custom custom-v6 eurodns gratisdns ovh-dynhost citynetwork');
|
||||
define('DYNDNS_PROVIDER_DESCRIPTIONS', 'DNS-O-Matic,DynDNS (dynamic),DynDNS (static),DynDNS (custom),DHS,DyNS,easyDNS,No-IP,No-IP (free),ODS.org,ZoneEdit,Loopia,freeDNS,DNSexit,OpenDNS,Namecheap,HE.net,HE.net (v6),HE.net Tunnelbroker,SelfHost,Route 53,CloudFlare,Custom,Custom (v6),Euro Dns,GratisDNS,OVH DynHOST,City Network');
|
||||
|
||||
@ -360,18 +349,18 @@ function services_dhcpdv4_configure()
|
||||
|
||||
if ($g['booting']) {
|
||||
/* restore the leases, if we have them */
|
||||
if (file_exists("{$g['cf_conf_path']}/dhcpleases.tgz")) {
|
||||
$dhcprestore = "";
|
||||
$dhcpreturn = "";
|
||||
exec("cd /;LANG=C /usr/bin/tar -xzf {$g['cf_conf_path']}/dhcpleases.tgz 2>&1", $dhcprestore, $dhcpreturn);
|
||||
$dhcprestore = implode(" ", $dhcprestore);
|
||||
if (file_exists('/cf/conf/dhcpleases.tgz')) {
|
||||
$dhcprestore = '';
|
||||
$dhcpreturn = '';
|
||||
exec('cd /;LANG=C /usr/bin/tar -xzf /cf/conf/dhcpleases.tgz 2>&1', $dhcprestore, $dhcpreturn);
|
||||
$dhcprestore = implode(' ', $dhcprestore);
|
||||
if($dhcpreturn <> 0) {
|
||||
log_error(sprintf(gettext('DHCP leases restore failed exited with %1$s, the error is: %2$s%3$s'), $dhcpreturn, $dhcprestore, "\n"));
|
||||
}
|
||||
}
|
||||
/* 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. */
|
||||
if (($g['platform'] == "pfSense") && !isset($config['system']['use_mfs_tmpvar'])) {
|
||||
unlink_if_exists("{$g['cf_conf_path']}/dhcpleases.tgz");
|
||||
unlink_if_exists('/cf/conf/dhcpleases.tgz');
|
||||
}
|
||||
}
|
||||
|
||||
@ -988,16 +977,21 @@ function services_dhcpdv6_configure($blacklist = array())
|
||||
if ($g['booting']) {
|
||||
if ($g['platform'] != "pfSense") {
|
||||
/* restore the leases, if we have them */
|
||||
if (file_exists("{$g['cf_conf_path']}/dhcp6leases.tgz")) {
|
||||
$dhcprestore = "";
|
||||
$dhcpreturn = "";
|
||||
exec("cd /;LANG=C /usr/bin/tar -xzf {$g['cf_conf_path']}/dhcp6leases.tgz 2>&1", $dhcprestore, $dhcpreturn);
|
||||
$dhcprestore = implode(" ", $dhcprestore);
|
||||
if (file_exists('/cf/conf/dhcp6leases.tgz')) {
|
||||
$dhcprestore = '';
|
||||
$dhcpreturn = '';
|
||||
exec('cd /;LANG=C /usr/bin/tar -xzf /cf/conf/dhcp6leases.tgz 2>&1', $dhcprestore, $dhcpreturn);
|
||||
$dhcprestore = implode(' ', $dhcprestore);
|
||||
if($dhcpreturn <> 0) {
|
||||
log_error("DHCP leases v6 restore failed exited with $dhcpreturn, the error is: $dhcprestore\n");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
/* 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. */
|
||||
if (($g['platform'] == "pfSense") && !isset($config['system']['use_mfs_tmpvar'])) {
|
||||
unlink_if_exists('/cf/conf/dhcp6leases.tgz');
|
||||
}
|
||||
}
|
||||
|
||||
$syscfg = $config['system'];
|
||||
|
||||
@ -1913,7 +1913,7 @@ function upgrade_054_to_055() {
|
||||
/* restore the databases, if we have one */
|
||||
if (restore_rrd()) {
|
||||
/* Make sure to move the rrd backup out of the way. We will make a new one after converting. */
|
||||
rename("{$g['cf_conf_path']}/rrd.tgz", "{$g['cf_conf_path']}/backup");
|
||||
rename('/cf/conf/rrd.tgz', '/cf/conf/backup');
|
||||
}
|
||||
}
|
||||
|
||||
@ -2031,7 +2031,7 @@ 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 NO_REMOUNT=1 RRDDBPATH='{$rrddbpath}' CF_CONF_PATH='{$g['cf_conf_path']}' /usr/local/etc/rc.backup_rrd.sh");
|
||||
exec("cd /; LANG=C NO_REMOUNT=1 RRDDBPATH='{$rrddbpath}' CF_CONF_PATH='/cf/conf' /usr/local/etc/rc.backup_rrd.sh");
|
||||
unlink_if_exists("{$g['vardb_path']}/rrd/*.xml");
|
||||
if ($g['booting'])
|
||||
echo "Updating configuration...";
|
||||
@ -2576,7 +2576,7 @@ function upgrade_080_to_081() {
|
||||
/* restore the databases, if we have one */
|
||||
if (restore_rrd()) {
|
||||
/* Make sure to move the rrd backup out of the way. We will make a new one after converting. */
|
||||
@rename("{$g['cf_conf_path']}/rrd.tgz", "{$g['cf_conf_path']}/backup/rrd.tgz");
|
||||
@rename('/cf/conf/rrd.tgz', '/cf/conf/backup/rrd.tgz');
|
||||
}
|
||||
}
|
||||
|
||||
@ -2713,7 +2713,7 @@ function upgrade_080_to_081() {
|
||||
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 NO_REMOUNT=1 RRDDBPATH='{$rrddbpath}' CF_CONF_PATH='{$g['cf_conf_path']}' /usr/local/etc/rc.backup_rrd.sh");
|
||||
exec("cd /; LANG=C NO_REMOUNT=1 RRDDBPATH='{$rrddbpath}' CF_CONF_PATH='/cf/conf' /usr/local/etc/rc.backup_rrd.sh");
|
||||
if ($g['booting'])
|
||||
echo "Updating configuration...";
|
||||
foreach($config['filter']['rule'] as & $rule) {
|
||||
@ -3023,7 +3023,7 @@ function upgrade_095_to_096() {
|
||||
/* restore the databases, if we have one */
|
||||
if (restore_rrd()) {
|
||||
/* Make sure to move the rrd backup out of the way. We will make a new one after converting. */
|
||||
rename("{$g['cf_conf_path']}/rrd.tgz", "{$g['cf_conf_path']}/backup");
|
||||
rename('/cf/conf/rrd.tgz', '/cf/conf/backup');
|
||||
}
|
||||
}
|
||||
|
||||
@ -3046,7 +3046,7 @@ function upgrade_095_to_096() {
|
||||
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 NO_REMOUNT=1 RRDDBPATH='{$rrddbpath}' CF_CONF_PATH='{$g['cf_conf_path']}' /usr/local/etc/rc.backup_rrd.sh");
|
||||
exec("cd /; LANG=C NO_REMOUNT=1 RRDDBPATH='{$rrddbpath}' CF_CONF_PATH='/cf/conf' /usr/local/etc/rc.backup_rrd.sh");
|
||||
}
|
||||
|
||||
function upgrade_096_to_097() {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
Copyright (C) 2014 Deciso B.V.
|
||||
Copyright (C) 2014 Deciso B.V.
|
||||
Copyright (C) 2004-2009 Scott Ullrich
|
||||
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
||||
All rights reserved.
|
||||
@ -548,7 +548,7 @@ if ($_POST) {
|
||||
} else if ($mode == "restore_ver") {
|
||||
$input_errors[] = gettext("XXX - this feature may hose your config (do NOT backrev configs!) - billm");
|
||||
if ($ver2restore <> "") {
|
||||
$conf_file = "{$g['cf_conf_path']}/bak/config-" . strtotime($ver2restore) . ".xml";
|
||||
$conf_file = '/cf/conf/backup/config-' . strtotime($ver2restore) . ".xml";
|
||||
if (config_install($conf_file) == 0) {
|
||||
mark_subsystem_dirty("restore");
|
||||
} else {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
Copyright (C) 2014 Deciso B.V.
|
||||
Copyright (C) 2005 Colin Smith
|
||||
@ -28,7 +28,7 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
require("guiconfig.inc");
|
||||
require_once("guiconfig.inc");
|
||||
|
||||
if (isset($_POST['backupcount'])) {
|
||||
if (is_numeric($_POST['backupcount']) && ($_POST['backupcount'] >= 0)) {
|
||||
@ -46,7 +46,7 @@ if (isset($_POST['backupcount'])) {
|
||||
}
|
||||
|
||||
conf_mount_rw();
|
||||
$confvers = unserialize(file_get_contents($g['cf_conf_path'] . '/backup/backup.cache'));
|
||||
$confvers = unserialize(file_get_contents('/cf/conf/backup/backup.cache'));
|
||||
if($_POST['newver'] != "") {
|
||||
if(config_restore($g['conf_path'] . '/backup/config-' . $_POST['newver'] . '.xml') == 0)
|
||||
$savemsg = sprintf(gettext('Successfully reverted to timestamp %1$s with description "%2$s".'), date(gettext("n/j/y H:i:s"), $_POST['newver']), $confvers[$_POST['newver']]['description']);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user