Commit b306aaae authored by Franco Fichtner's avatar Franco Fichtner

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

parent 983b11f3
...@@ -80,13 +80,8 @@ function load_config_from_file($filename) ...@@ -80,13 +80,8 @@ function load_config_from_file($filename)
* RESULT * RESULT
* $config - array containing all configuration variables * $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(); $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) // 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) ...@@ -95,10 +90,6 @@ function parse_config($verbose = false)
/* make alias table (for faster lookups) */ /* make alias table (for faster lookups) */
alias_make_table($config); alias_make_table($config);
if ($verbose) {
echo "done.\n";
}
return $config; return $config;
} }
...@@ -151,6 +142,10 @@ function convert_config($verbose = false) ...@@ -151,6 +142,10 @@ function convert_config($verbose = false)
} else { } else {
mwexecf($mvc_migration); 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 /****f* config/write_config
......
...@@ -56,9 +56,7 @@ foreach ($inc_files as $inc_file) { ...@@ -56,9 +56,7 @@ foreach ($inc_files as $inc_file) {
echo "done.\n"; echo "done.\n";
global $config; convert_config(true);
$config = parse_config(true);
convert_config();
/* /*
* Now mute console messages from kernel for this script, it * Now mute console messages from kernel for this script, it
......
...@@ -39,9 +39,6 @@ require_once("interfaces.inc"); ...@@ -39,9 +39,6 @@ require_once("interfaces.inc");
system_console_mute(); system_console_mute();
if (set_networking_interfaces_ports()) { if (set_networking_interfaces_ports()) {
global $config;
$config = parse_config(true);
/* need to stop local dhcp servers to avoid wrong leases */ /* need to stop local dhcp servers to avoid wrong leases */
killbypid('/var/dhcpd/var/run/dhcpd.pid', 'TERM', true); killbypid('/var/dhcpd/var/run/dhcpd.pid', 'TERM', true);
killbypid('/var/dhcpd/var/run/dhcpdv6.pid', 'TERM', true); killbypid('/var/dhcpd/var/run/dhcpdv6.pid', 'TERM', true);
......
...@@ -37,10 +37,6 @@ require_once("system.inc"); ...@@ -37,10 +37,6 @@ require_once("system.inc");
require_once("services.inc"); require_once("services.inc");
require_once("interfaces.inc"); require_once("interfaces.inc");
global $config;
$config = parse_config(true);
if (count($argv) > 1 && is_numeric($argv[1])) { if (count($argv) > 1 && is_numeric($argv[1])) {
// starting delayed. // starting delayed.
sleep($argv[1]); sleep($argv[1]);
......
...@@ -34,9 +34,8 @@ ...@@ -34,9 +34,8 @@
require_once("config.inc"); require_once("config.inc");
require_once("certs.inc"); require_once("certs.inc");
require_once("legacy_bindings.inc"); require_once("legacy_bindings.inc");
use OPNsense\Core\Config;
global $config; use OPNsense\Core\Config;
// traverse captive portal zones // traverse captive portal zones
$configObj = Config::getInstance()->object(); $configObj = Config::getInstance()->object();
......
...@@ -33,9 +33,8 @@ ...@@ -33,9 +33,8 @@
require_once("config.inc"); require_once("config.inc");
require_once("certs.inc"); require_once("certs.inc");
require_once("legacy_bindings.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 // 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) // Which makes it easier for the setup script to detect cert changes (which should flush the stored cache)
......
...@@ -58,7 +58,6 @@ function add_local_user($username, $userdn, $userfullname) ...@@ -58,7 +58,6 @@ function add_local_user($username, $userdn, $userfullname)
local_user_set($new_user); local_user_set($new_user);
} }
global $config;
// attributes used in page // attributes used in page
$ldap_users= array(); $ldap_users= array();
$ldap_is_connected = false; $ldap_is_connected = false;
......
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