config: migration could be stripped, global vars are always global

This commit is contained in:
Franco Fichtner 2017-05-11 13:24:15 +02:00
parent 983b11f3e3
commit b306aaae5b
7 changed files with 8 additions and 25 deletions

View File

@ -80,13 +80,8 @@ function load_config_from_file($filename)
* RESULT
* $config - array containing all configuration variables
******/
function parse_config($verbose = false)
function parse_config()
{
if ($verbose) {
echo 'Loading configuration...';
flush();
}
$cnf = OPNsense\Core\Config::getInstance();
// return config data as array, use old "listags" construction to mark certain elements as array (even if they're not recurring)
@ -95,10 +90,6 @@ function parse_config($verbose = false)
/* make alias table (for faster lookups) */
alias_make_table($config);
if ($verbose) {
echo "done.\n";
}
return $config;
}
@ -151,6 +142,10 @@ function convert_config($verbose = false)
} else {
mwexecf($mvc_migration);
}
/* reload the config as it was rewritten and saved in the script context */
OPNsense\Core\Config::getInstance()->forceReload();
$config = parse_config();
}
/****f* config/write_config

View File

@ -56,9 +56,7 @@ foreach ($inc_files as $inc_file) {
echo "done.\n";
global $config;
$config = parse_config(true);
convert_config();
convert_config(true);
/*
* Now mute console messages from kernel for this script, it

View File

@ -39,9 +39,6 @@ require_once("interfaces.inc");
system_console_mute();
if (set_networking_interfaces_ports()) {
global $config;
$config = parse_config(true);
/* need to stop local dhcp servers to avoid wrong leases */
killbypid('/var/dhcpd/var/run/dhcpd.pid', 'TERM', true);
killbypid('/var/dhcpd/var/run/dhcpdv6.pid', 'TERM', true);

View File

@ -37,10 +37,6 @@ require_once("system.inc");
require_once("services.inc");
require_once("interfaces.inc");
global $config;
$config = parse_config(true);
if (count($argv) > 1 && is_numeric($argv[1])) {
// starting delayed.
sleep($argv[1]);

View File

@ -34,9 +34,8 @@
require_once("config.inc");
require_once("certs.inc");
require_once("legacy_bindings.inc");
use OPNsense\Core\Config;
global $config;
use OPNsense\Core\Config;
// traverse captive portal zones
$configObj = Config::getInstance()->object();

View File

@ -33,9 +33,8 @@
require_once("config.inc");
require_once("certs.inc");
require_once("legacy_bindings.inc");
use OPNsense\Core\Config;
global $config;
use OPNsense\Core\Config;
// Our template systems stores the ca certid into /usr/local/etc/squid/ca.pem.id
// Which makes it easier for the setup script to detect cert changes (which should flush the stored cache)

View File

@ -58,7 +58,6 @@ function add_local_user($username, $userdn, $userfullname)
local_user_set($new_user);
}
global $config;
// attributes used in page
$ldap_users= array();
$ldap_is_connected = false;