Commit 21086738 authored by Franco Fichtner's avatar Franco Fichtner

inc: shift more functions to their rightful place

parent 21803172
...@@ -93,21 +93,6 @@ function get_carp_interface_status($carpinterface) { ...@@ -93,21 +93,6 @@ function get_carp_interface_status($carpinterface) {
return; return;
} }
/*
* backup_config_section($section): returns as an xml file string of
* the configuration section
*/
function backup_config_section($section_name) {
global $config;
$new_section = &$config[$section_name];
/* generate configuration XML */
$xmlconfig = dump_xml_config($new_section, $section_name);
$xmlconfig = str_replace("<?xml version=\"1.0\"?>", "", $xmlconfig);
return $xmlconfig;
}
/* KEEP THIS: unbreaks syntax highlighting <?php */
/* /*
* restore_config_section($section_name, new_contents): restore a configuration section, * restore_config_section($section_name, new_contents): restore a configuration section,
* and write the configuration out * and write the configuration out
...@@ -149,26 +134,6 @@ function restore_config_section($section_name, $new_contents) ...@@ -149,26 +134,6 @@ function restore_config_section($section_name, $new_contents)
return true; return true;
} }
/*
* host_firmware_version(): Return the versions used in this install
*/
function host_firmware_version()
{
global $config;
return array(
'firmware' => array('version' => file_get_contents('/usr/local/opnsense/version/opnsense')),
'kernel' => array('version' => file_get_contents('/usr/local/opnsense/version/opnsense-update.kernel')),
'base' => array('version' => file_get_contents('/usr/local/opnsense/version/opnsense-update.base')),
'config_version' => $config['version']
);
}
function reload_all()
{
configd_run('service reload all', true);
}
function setup_serial_port($sync = true) function setup_serial_port($sync = true)
{ {
global $config; global $config;
...@@ -250,25 +215,6 @@ function reload_ttys() ...@@ -250,25 +215,6 @@ function reload_ttys()
exec('/bin/kill -HUP 1'); exec('/bin/kill -HUP 1');
} }
/* Any PPPoE servers enabled? */
function is_pppoe_server_enabled()
{
global $config;
$pppoeenable = false;
if (!isset($config['pppoes']['pppoe']) || !is_array($config['pppoes']['pppoe'])) {
return false;
}
foreach ($config['pppoes']['pppoe'] as $pppoes) {
if ($pppoes['mode'] == 'server') {
$pppoeenable = true;
}
}
return $pppoeenable;
}
function add_hostname_to_watch($hostname) { function add_hostname_to_watch($hostname) {
if (!is_dir("/var/db/dnscache")) { if (!is_dir("/var/db/dnscache")) {
mkdir("/var/db/dnscache"); mkdir("/var/db/dnscache");
......
<?php <?php
/* /*
Copyright (C) 2015-2016 Deciso B.V. Copyright (C) 2015-2016 Deciso B.V.
Copyright (C) 2009, 2010 Scott Ullrich Copyright (C) 2004-2010 Scott Ullrich
Copyright (C) 2005 Colin Smith Copyright (C) 2005 Colin Smith
All rights reserved. All rights reserved.
...@@ -100,14 +100,19 @@ function merge_config_attributes(&$cnf_source, &$cnf_dest) ...@@ -100,14 +100,19 @@ function merge_config_attributes(&$cnf_source, &$cnf_dest)
/** /**
* retrieve firmware version * retrieve firmware version
* @return mixed * @return array
*/ */
function firmware_version_xmlrpc() function firmware_version_xmlrpc()
{ {
require_once("pfsense-utils.inc"); global $config;
return host_firmware_version();
}
return array(
'kernel' => array('version' => file_get_contents('/usr/local/opnsense/version/opnsense-update.kernel')),
'base' => array('version' => file_get_contents('/usr/local/opnsense/version/opnsense-update.base')),
'firmware' => array('version' => file_get_contents('/usr/local/opnsense/version/opnsense')),
'config_version' => $config['version'],
);
}
/** /**
* filter reconfigure * filter reconfigure
......
...@@ -632,7 +632,7 @@ ...@@ -632,7 +632,7 @@
</description> </description>
<stepafterformdisplay> <stepafterformdisplay>
<![CDATA[ <![CDATA[
reload_all(); configd_run('service reload all', true);
]]> ]]>
</stepafterformdisplay> </stepafterformdisplay>
</step> </step>
......
...@@ -40,6 +40,21 @@ require_once("rrd.inc"); ...@@ -40,6 +40,21 @@ require_once("rrd.inc");
require_once("system.inc"); require_once("system.inc");
require_once("pfsense-utils.inc"); require_once("pfsense-utils.inc");
/*
* backup_config_section($section): returns as an xml file string of
* the configuration section
*/
function backup_config_section($section_name) {
global $config;
$new_section = &$config[$section_name];
/* generate configuration XML */
$xmlconfig = dump_xml_config($new_section, $section_name);
$xmlconfig = str_replace("<?xml version=\"1.0\"?>", "", $xmlconfig);
return $xmlconfig;
}
/* KEEP THIS: unbreaks syntax highlighting <?php */
function rrd_data_xml() { function rrd_data_xml() {
$rrddbpath = '/var/db/rrd'; $rrddbpath = '/var/db/rrd';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment