Revision 1e45d13f
Added by Christian McDonald over 2 years ago
src/etc/inc/upgrade_config.inc | ||
---|---|---|
191 | 191 |
function upgrade_011_to_012() { |
192 | 192 |
global $config; |
193 | 193 |
/* move LAN DHCP server config */ |
194 |
$tmp = $config['dhcpd'];
|
|
194 |
$tmp = config_get_path('dhcpd');
|
|
195 | 195 |
$config['dhcpd'] = array(); |
196 | 196 |
$config['dhcpd']['lan'] = $tmp; |
197 | 197 |
|
... | ... | |
252 | 252 |
/* Default route moved */ |
253 | 253 |
if (isset($config['interfaces']['wan']['gateway'])) { |
254 | 254 |
if ($config['interfaces']['wan']['gateway'] <> "") { |
255 |
$config['system']['gateway'] = $config['interfaces']['wan']['gateway'];
|
|
255 |
$config['system']['gateway'] = config_get_path('interfaces/wan/gateway');
|
|
256 | 256 |
} |
257 | 257 |
config_del_path('interfaces/wan/gateway'); |
258 | 258 |
} |
... | ... | |
279 | 279 |
if (isset($config['system']['firmwareurl']) && isset($config['system']['firmwarename'])) { // Only convert if *both* are defined. |
280 | 280 |
$config['system']['alt_firmware_url'] = array(); |
281 | 281 |
$config['system']['alt_firmware_url']['enabled'] = ""; |
282 |
$config['system']['alt_firmware_url']['firmware_base_url'] = $config['system']['firmwareurl'];
|
|
283 |
$config['system']['alt_firmware_url']['firmware_filename'] = $config['system']['firmwarename'];
|
|
282 |
$config['system']['alt_firmware_url']['firmware_base_url'] = config_get_path('system/firmwareurl');
|
|
283 |
$config['system']['alt_firmware_url']['firmware_filename'] = config_get_path('system/firmwarename');
|
|
284 | 284 |
} |
285 | 285 |
if (isset($config['system']['firmwareurl'])) { |
286 | 286 |
config_del_path('system/firmwareurl'); |
... | ... | |
395 | 395 |
global $config; |
396 | 396 |
/* shaper scheduler moved */ |
397 | 397 |
if (isset($config['system']['schedulertype'])) { |
398 |
$config['shaper']['schedulertype'] = $config['system']['schedulertype'];
|
|
398 |
$config['shaper']['schedulertype'] = config_get_path('system/schedulertype');
|
|
399 | 399 |
config_del_path('system/schedulertype'); |
400 | 400 |
} |
401 | 401 |
} |
... | ... | |
404 | 404 |
function upgrade_021_to_022() { |
405 | 405 |
global $config; |
406 | 406 |
/* move gateway to wan interface */ |
407 |
$config['interfaces']['wan']['gateway'] = $config['system']['gateway'];
|
|
407 |
$config['interfaces']['wan']['gateway'] = config_get_path('system/gateway');
|
|
408 | 408 |
} |
409 | 409 |
|
410 | 410 |
function upgrade_022_to_023() { |
... | ... | |
422 | 422 |
|
423 | 423 |
function upgrade_024_to_025() { |
424 | 424 |
global $config; |
425 |
$config['interfaces']['wan']['use_rrd_gateway'] = $config['system']['use_rrd_gateway'];
|
|
425 |
$config['interfaces']['wan']['use_rrd_gateway'] = config_get_path('system/use_rrd_gateway');
|
|
426 | 426 |
if (isset($config['system']['use_rrd_gateway'])) { |
427 | 427 |
config_del_path('system/use_rrd_gateway'); |
428 | 428 |
} |
... | ... | |
1180 | 1180 |
$config['ipsec']['client']['group_source'] = 'system'; |
1181 | 1181 |
} |
1182 | 1182 |
|
1183 |
$mobilecfg = $config['ipsec']['mobileclients'];
|
|
1183 |
$mobilecfg = config_get_path('ipsec/mobileclients');
|
|
1184 | 1184 |
|
1185 | 1185 |
$ph1ent = array(); |
1186 | 1186 |
$ph1ent['ikeid'] = ++$ikeid; |
... | ... | |
1320 | 1320 |
if (isset($config['dyndns'][0]['host'])) { |
1321 | 1321 |
$tempdyn = array(); |
1322 | 1322 |
$tempdyn['enable'] = isset($config['dyndns'][0]['enable']); |
1323 |
$tempdyn['type'] = $config['dyndns'][0]['type'];
|
|
1323 |
$tempdyn['type'] = config_get_path('dyndns/0/type');
|
|
1324 | 1324 |
$tempdyn['wildcard'] = isset($config['dyndns'][0]['wildcard']); |
1325 |
$tempdyn['username'] = $config['dyndns'][0]['username'];
|
|
1326 |
$tempdyn['password'] = $config['dyndns'][0]['password'];
|
|
1327 |
$tempdyn['host'] = $config['dyndns'][0]['host'];
|
|
1328 |
$tempdyn['mx'] = $config['dyndns'][0]['mx'];
|
|
1325 |
$tempdyn['username'] = config_get_path('dyndns/0/username');
|
|
1326 |
$tempdyn['password'] = config_get_path('dyndns/0/password');
|
|
1327 |
$tempdyn['host'] = config_get_path('dyndns/0/host');
|
|
1328 |
$tempdyn['mx'] = config_get_path('dyndns/0/mx');
|
|
1329 | 1329 |
$tempdyn['interface'] = "wan"; |
1330 | 1330 |
$tempdyn['descr'] = sprintf(gettext("Upgraded Dyndns %s"), $tempdyn['type']); |
1331 | 1331 |
$config['dyndnses']['dyndns'][] = $tempdyn; |
... | ... | |
1333 | 1333 |
config_del_path('dyndns'); |
1334 | 1334 |
} |
1335 | 1335 |
if (!empty($config['dnsupdate'])) { |
1336 |
$pconfig = $config['dnsupdate'][0];
|
|
1336 |
$pconfig = config_get_path('dnsupdate/0');
|
|
1337 | 1337 |
if (!$pconfig['ttl']) { |
1338 | 1338 |
$pconfig['ttl'] = 60; |
1339 | 1339 |
} |
... | ... | |
1347 | 1347 |
|
1348 | 1348 |
if (is_array($config['pppoe']) && is_array($config['pppoe'][0])) { |
1349 | 1349 |
$pconfig = array(); |
1350 |
$pconfig['username'] = $config['pppoe'][0]['username'];
|
|
1351 |
$pconfig['password'] = $config['pppoe'][0]['password'];
|
|
1352 |
$pconfig['provider'] = $config['pppoe'][0]['provider'];
|
|
1350 |
$pconfig['username'] = config_get_path('pppoe/0/username');
|
|
1351 |
$pconfig['password'] = config_get_path('pppoe/0/password');
|
|
1352 |
$pconfig['provider'] = config_get_path('pppoe/0/provider');
|
|
1353 | 1353 |
$pconfig['ondemand'] = isset($config['pppoe'][0]['ondemand']); |
1354 |
$pconfig['timeout'] = $config['pppoe'][0]['timeout'];
|
|
1354 |
$pconfig['timeout'] = config_get_path('pppoe/0/timeout');
|
|
1355 | 1355 |
config_del_path('pppoe'); |
1356 | 1356 |
$config['interfaces']['wan']['pppoe_username'] = $pconfig['username']; |
1357 | 1357 |
$config['interfaces']['wan']['pppoe_password'] = $pconfig['password']; |
... | ... | |
1361 | 1361 |
} |
1362 | 1362 |
if (is_array($config['pptp'])) { |
1363 | 1363 |
$pconfig = array(); |
1364 |
$pconfig['username'] = $config['pptp']['username'];
|
|
1365 |
$pconfig['password'] = $config['pptp']['password'];
|
|
1366 |
$pconfig['provider'] = $config['pptp']['provider'];
|
|
1364 |
$pconfig['username'] = config_get_path('pptp/username');
|
|
1365 |
$pconfig['password'] = config_get_path('pptp/password');
|
|
1366 |
$pconfig['provider'] = config_get_path('pptp/provider');
|
|
1367 | 1367 |
$pconfig['ondemand'] = isset($config['pptp']['ondemand']); |
1368 |
$pconfig['timeout'] = $config['pptp']['timeout'];
|
|
1368 |
$pconfig['timeout'] = config_get_path('pptp/timeout');
|
|
1369 | 1369 |
config_del_path('pptp'); |
1370 | 1370 |
$config['interfaces']['wan']['pptp_username'] = $pconfig['username']; |
1371 | 1371 |
$config['interfaces']['wan']['pptp_password'] = $pconfig['password']; |
... | ... | |
1950 | 1950 |
$cert = array(); |
1951 | 1951 |
$cert['refid'] = uniqid(); |
1952 | 1952 |
$cert['descr'] = "webConfigurator SSL/TLS Certificate"; |
1953 |
$cert['crt'] = $config['system']['webgui']['certificate'];
|
|
1954 |
$cert['prv'] = $config['system']['webgui']['private-key'];
|
|
1953 |
$cert['crt'] = config_get_path('system/webgui/certificate');
|
|
1954 |
$cert['prv'] = config_get_path('system/webgui/private-key');
|
|
1955 | 1955 |
$config['cert'][] = $cert; |
1956 | 1956 |
|
1957 | 1957 |
config_del_path('system/webgui/certificate'); |
... | ... | |
1962 | 1962 |
/* migrate advanced admin page ssh keys to user manager */ |
1963 | 1963 |
if ($config['system']['ssh']['authorizedkeys']) { |
1964 | 1964 |
$admin_user =& getUserEntryByUID(0); |
1965 |
$admin_user['authorizedkeys'] = $config['system']['ssh']['authorizedkeys'];
|
|
1965 |
$admin_user['authorizedkeys'] = config_get_path('system/ssh/authorizedkeys');
|
|
1966 | 1966 |
config_del_path('system/ssh/authorizedkeys'); |
1967 | 1967 |
} |
1968 | 1968 |
} |
... | ... | |
1971 | 1971 |
function upgrade_053_to_054() { |
1972 | 1972 |
global $config; |
1973 | 1973 |
if (is_array($config['load_balancer']['lbpool'])) { |
1974 |
$lbpool_arr = $config['load_balancer']['lbpool'];
|
|
1974 |
$lbpool_arr = config_get_path('load_balancer/lbpool');
|
|
1975 | 1975 |
$lbpool_srv_arr = array(); |
1976 | 1976 |
$gateway_group_arr = array(); |
1977 | 1977 |
$gateways = return_gateways_array(); |
... | ... | |
2539 | 2539 |
function upgrade_066_to_067() { |
2540 | 2540 |
global $config; |
2541 | 2541 |
if (isset($config['system']['ca'])) { |
2542 |
$config['ca'] = $config['system']['ca'];
|
|
2542 |
$config['ca'] = config_get_path('system/ca');
|
|
2543 | 2543 |
config_del_path('system/ca'); |
2544 | 2544 |
} |
2545 | 2545 |
if (isset($config['system']['cert'])) { |
2546 |
$config['cert'] = $config['system']['cert'];
|
|
2546 |
$config['cert'] = config_get_path('system/cert');
|
|
2547 | 2547 |
config_del_path('system/cert'); |
2548 | 2548 |
} |
2549 | 2549 |
} |
... | ... | |
2554 | 2554 |
if (!empty($config['pppoe'])) { |
2555 | 2555 |
$config['pppoes'] = array(); |
2556 | 2556 |
$config['pppoes']['pppoe'] = array(); |
2557 |
$config['pppoes']['pppoe'][] = $config['pppoe'][0];
|
|
2557 |
$config['pppoes']['pppoe'][] = config_get_path('pppoe/0');
|
|
2558 | 2558 |
|
2559 | 2559 |
if (is_array($config['pppoe']['user'])) { |
2560 | 2560 |
$username = array(); |
... | ... | |
2724 | 2724 |
!is_array($config['pptpd']['radius']['server'])) { |
2725 | 2725 |
$radarr = array(); |
2726 | 2726 |
$radsvr = array(); |
2727 |
$radsvr['ip'] = $config['pptpd']['radius']['server'];
|
|
2728 |
$radsvr['secret'] = $config['pptpd']['radius']['secret'];
|
|
2727 |
$radsvr['ip'] = config_get_path('pptpd/radius/server');
|
|
2728 |
$radsvr['secret'] = config_get_path('pptpd/radius/secret');
|
|
2729 | 2729 |
$radsvr['port'] = 1812; |
2730 | 2730 |
$radsvr['acctport'] = 1813; |
2731 | 2731 |
$radsvr['enable'] = isset($config['pptpd']['radius']['enable']); |
... | ... | |
2752 | 2752 |
/* Upgrade config in 1.2.3 specifying a username other than admin for syncing. */ |
2753 | 2753 |
if (!empty($config['system']['username']) && is_array($config['installedpackages']['carpsettings']) && |
2754 | 2754 |
is_array($config['installedpackages']['carpsettings']['config'])) { |
2755 |
$config['installedpackages']['carpsettings']['config'][0]['username'] = $config['system']['username'];
|
|
2755 |
$config['installedpackages']['carpsettings']['config'][0]['username'] = config_get_path('system/username');
|
|
2756 | 2756 |
config_del_path('system/username'); |
2757 | 2757 |
} |
2758 | 2758 |
} |
... | ... | |
2936 | 2936 |
|
2937 | 2937 |
/* Upgrade captiveportal config */ |
2938 | 2938 |
if (!empty($config['captiveportal'])) { |
2939 |
$tmpcp = $config['captiveportal'];
|
|
2939 |
$tmpcp = config_get_path('captiveportal');
|
|
2940 | 2940 |
$config['captiveportal'] = array(); |
2941 | 2941 |
$config['captiveportal']['cpzone'] = array(); |
2942 | 2942 |
$config['captiveportal']['cpzone'] = $tmpcp; |
... | ... | |
2947 | 2947 |
} |
2948 | 2948 |
} |
2949 | 2949 |
if (!empty($config['voucher'])) { |
2950 |
$tmpcp = $config['voucher'];
|
|
2950 |
$tmpcp = config_get_path('voucher');
|
|
2951 | 2951 |
$config['voucher'] = array(); |
2952 | 2952 |
$config['voucher']['cpzone'] = array(); |
2953 | 2953 |
$config['voucher']['cpzone'] = $tmpcp; |
... | ... | |
2960 | 2960 |
if (!empty($config['installedpackages']) && |
2961 | 2961 |
!empty($config['installedpackages']['carpsettings']) && |
2962 | 2962 |
!empty($config['installedpackages']['carpsettings']['config'])) { |
2963 |
$config['hasync'] = $config['installedpackages']['carpsettings']['config'][0];
|
|
2963 |
$config['hasync'] = config_get_path('installedpackages/carpsettings/config/0');
|
|
2964 | 2964 |
config_del_path('installedpackages/carpsettings'); |
2965 | 2965 |
} |
2966 | 2966 |
if (empty($config['installedpackages']['carpsettings']) && isset($config['installedpackages']['carpsettings'])) { |
... | ... | |
3213 | 3213 |
global $config; |
3214 | 3214 |
|
3215 | 3215 |
if (isset($config['system']['powerd_mode'])) { |
3216 |
$config['system']['powerd_ac_mode'] = $config['system']['powerd_mode'];
|
|
3217 |
$config['system']['powerd_battery_mode'] = $config['system']['powerd_mode'];
|
|
3216 |
$config['system']['powerd_ac_mode'] = config_get_path('system/powerd_mode');
|
|
3217 |
$config['system']['powerd_battery_mode'] = config_get_path('system/powerd_mode');
|
|
3218 | 3218 |
config_del_path('system/powerd_mode'); |
3219 | 3219 |
} |
3220 | 3220 |
} |
... | ... | |
3368 | 3368 |
$config['nat']['advancedoutbound']['mode'] = "automatic"; |
3369 | 3369 |
} |
3370 | 3370 |
|
3371 |
$config['nat']['outbound'] = $config['nat']['advancedoutbound'];
|
|
3371 |
$config['nat']['outbound'] = config_get_path('nat/advancedoutbound');
|
|
3372 | 3372 |
|
3373 | 3373 |
if (isset($config['nat']['ipsecpassthru'])) { |
3374 | 3374 |
config_del_path('nat/ipsecpassthru'); |
... | ... | |
3551 | 3551 |
return; |
3552 | 3552 |
} |
3553 | 3553 |
|
3554 |
$pkg = $config['installedpackages']['unbound']['config'][0];
|
|
3554 |
$pkg = config_get_path('installedpackages/unbound/config/0');
|
|
3555 | 3555 |
|
3556 | 3556 |
if (isset($config['installedpackages']['unboundadvanced']['config'][0])) { |
3557 | 3557 |
$pkg = array_merge($pkg, $config['installedpackages']['unboundadvanced']['config'][0]); |
... | ... | |
6310 | 6310 |
function upgrade_211_to_212() { |
6311 | 6311 |
global $config; |
6312 | 6312 |
if (isset($config['unbound']['sslport'])) { |
6313 |
$config['unbound']['tlsport'] = $config['unbound']['sslport'];
|
|
6313 |
$config['unbound']['tlsport'] = config_get_path('unbound/sslport');
|
|
6314 | 6314 |
config_del_path('unbound/sslport'); |
6315 | 6315 |
} |
6316 | 6316 |
} |
Also available in: Unified diff
Rector some direct config gets with pure scalar paths.