Skip to content

Commit

Permalink
Move to is_platform_booting()
Browse files Browse the repository at this point in the history
The function platform_booting() is deprecated.
  • Loading branch information
marcos-ng committed May 23, 2024
1 parent 134a870 commit 816fef2
Show file tree
Hide file tree
Showing 29 changed files with 181 additions and 181 deletions.
4 changes: 2 additions & 2 deletions src/etc/inc/acb.inc
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function test_connection($post) {
global $savemsg, $config, $g;

// Do nothing when booting or when not enabled
if (platform_booting() || !acb_enabled()) {
if (is_platform_booting() || !acb_enabled()) {
return;
}

Expand Down Expand Up @@ -193,7 +193,7 @@ function upload_config($manual = false) {
}

// Do nothing when booting or when not enabled
if (platform_booting() || !acb_enabled()) {
if (is_platform_booting() || !acb_enabled()) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/etc/inc/authgui.inc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ include_once("auth.inc");
include_once("config.inc");
include_once("config.lib.inc");
include_once("priv.inc");
if (!function_exists('platform_booting')) {
if (!function_exists('is_platform_booting')) {
require_once('globals.inc');
}
require_once('pfsense-utils.inc');
Expand Down
4 changes: 2 additions & 2 deletions src/etc/inc/captiveportal.inc
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ function captiveportal_configure_zone($cpcfg, $reload_rules = false) {

if (isset($cpcfg['enable'])) {

if (platform_booting()) {
if (is_platform_booting()) {
echo "Starting captive portal({$cpcfg['zone']})... ";
} else {
captiveportal_syslog("Reconfiguring captive portal({$cpcfg['zone']}).");
Expand Down Expand Up @@ -372,7 +372,7 @@ EOD;
/* delete outdated radius server database if exist */
unlink_if_exists("{$g['vardb_path']}/captiveportal_radius_{$cpzone}.db");

if (platform_booting() || $reload_rules) {
if (is_platform_booting() || $reload_rules) {
/* send Accounting-On to server */
captiveportal_send_server_accounting('on');
echo "done\n";
Expand Down
2 changes: 1 addition & 1 deletion src/etc/inc/config.console.inc
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ EOD;
}
$config['interfaces']['lan']['if'] = $lanif;
$config['interfaces']['lan']['enable'] = true;
} elseif (!platform_booting()) {
} elseif (!is_platform_booting()) {

echo "\n" . gettext("You have chosen to remove the LAN interface.") . "\n";
echo "\n" . gettext("Would you like to remove the LAN IP address and \nunload the interface now [y|n]?") . " ";
Expand Down
6 changes: 3 additions & 3 deletions src/etc/inc/config.inc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* limitations under the License.
*/

if (!function_exists('platform_booting')) {
if (!function_exists('is_platform_booting')) {
require_once('globals.inc');
}

Expand Down Expand Up @@ -58,7 +58,7 @@ if (file_exists("/debugging")) {
$g['debug'] = true;
}

if (platform_booting(true) &&
if (is_platform_booting() && is_cli_sapi() &&
!file_exists(g_get('cf_conf_path') . "/config.xml")) {
echo ".";
/* find the device where config.xml resides and write out an fstab */
Expand Down Expand Up @@ -90,7 +90,7 @@ if (platform_booting(true) &&
}
}
if (mwexec("/sbin/mount -r /dev/{$mountdisk}d {$g['cf_path']}") == 0) {
if (platform_booting()) {
if (is_platform_booting()) {
echo ".";
}
if (file_exists("{$g['cf_conf_path']}/config.xml")) {
Expand Down
22 changes: 11 additions & 11 deletions src/etc/inc/config.lib.inc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function encrypted_configxml() {
return;
}

if (!platform_booting()) {
if (!is_platform_booting()) {
return;
}

Expand Down Expand Up @@ -100,7 +100,7 @@ function parse_config($parse = false) {
}
}

if (platform_booting(true)) {
if (is_platform_booting() && is_cli_sapi()) {
echo ".";
}

Expand All @@ -119,7 +119,7 @@ function parse_config($parse = false) {
}
if ($parse == true) {
if (!file_exists(g_get('conf_path') . "/config.xml")) {
if (platform_booting(true)) {
if (is_platform_booting() && is_cli_sapi()) {
echo ".";
}
log_error("No config.xml found, attempting last known config restore.");
Expand Down Expand Up @@ -147,7 +147,7 @@ function parse_config($parse = false) {
generate_config_cache($config);
}

if (platform_booting(true)) {
if (is_platform_booting() && is_cli_sapi()) {
echo ".";
}

Expand Down Expand Up @@ -379,13 +379,13 @@ function restore_sshdata($conf = false) {
function parse_config_bootup() {
global $config, $g;

if (platform_booting()) {
if (is_platform_booting()) {
echo ".";
}

$lockkey = lock('config');
if (!file_exists("{$g['conf_path']}/config.xml")) {
if (platform_booting()) {
if (is_platform_booting()) {
$last_backup = discover_last_backup();
if ($last_backup) {
log_error("No config.xml found, attempting last known config restore.");
Expand Down Expand Up @@ -536,7 +536,7 @@ function convert_config() {
}
}
$config['version'] = sprintf('%.1f', $next / 10);
if (platform_booting()) {
if (is_platform_booting()) {
echo ".";
}
}
Expand Down Expand Up @@ -710,7 +710,7 @@ function write_config($desc="Unknown", $backup = true, $write_config_only = fals
if ($last_backup) {
restore_backup("/cf/conf/backup/{$last_backup}");
$config = parse_xml_config("{$g['conf_path']}/config.xml", g_get('xml_rootobj'));
if (platform_booting()) {
if (is_platform_booting()) {
echo "\n\n ************** WARNING **************";
echo "\n\n Configuration could not be validated. A previous configuration was restored. \n";
echo "\n The failed configuration file has been saved as {$g['conf_path']}/config.xml.bad \n\n";
Expand Down Expand Up @@ -856,7 +856,7 @@ function config_install($conffile) {
return 1;
}

if (platform_booting()) {
if (is_platform_booting()) {
echo gettext("Installing configuration...") . "\n";
} else {
log_error(gettext("Installing configuration ...."));
Expand Down Expand Up @@ -964,7 +964,7 @@ function cleanup_backupcache($lock = false) {
unset($backupexp);
if (!in_array($tocheck, $baktimes)) {
$i = true;
if (platform_booting()) {
if (is_platform_booting()) {
echo ".";
}
try {
Expand Down Expand Up @@ -993,7 +993,7 @@ function cleanup_backupcache($lock = false) {
$newbaks[] = $checkbak;
} else {
$i = true;
if (platform_booting()) print " " . $tocheck . "r";
if (is_platform_booting()) print " " . $tocheck . "r";
}
}
foreach ($newbaks as $todo) {
Expand Down
26 changes: 13 additions & 13 deletions src/etc/inc/filter.inc
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ function filter_configure() {
* NOTE: Check here for bootup status since this should not be triggered during bootup.
* The reason is that rc.bootup calls filter_configure_sync directly which does this too.
*/
if (!platform_booting()) {
if (!is_platform_booting()) {
send_event("filter reload");
}
}
Expand Down Expand Up @@ -335,19 +335,19 @@ function filter_configure_sync($delete_states_if_needed = true) {
}
/* Get interface list to work with. */
filter_generate_optcfg_array();
if (platform_booting() == true) {
if (is_platform_booting()) {
echo gettext("Configuring firewall");
}

/* generate aliases */
if (platform_booting() == true) {
if (is_platform_booting()) {
echo ".";
}
update_filter_reload_status(gettext("Creating aliases"));
$vpns_list = filter_get_vpns_list();
$aliases = filter_generate_aliases();
$gateways = filter_generate_gateways();
if (platform_booting() == true) {
if (is_platform_booting()) {
echo ".";
}
update_filter_reload_status(gettext("Generating Limiter rules"));
Expand All @@ -356,19 +356,19 @@ function filter_configure_sync($delete_states_if_needed = true) {
update_filter_reload_status(gettext("Generating NAT rules"));
/* generate nat rules */
$natrules = filter_nat_rules_generate();
if (platform_booting() == true) {
if (is_platform_booting()) {
echo ".";
}
update_filter_reload_status(gettext("Generating filter rules"));
/* generate pfctl rules */
$pfrules = filter_rules_generate();
/* generate altq, limiter */
if (platform_booting() == true) {
if (is_platform_booting()) {
echo ".";
}
update_filter_reload_status(gettext("Generating ALTQ queues"));
$altq_queues = filter_generate_altq_queues();
if (platform_booting() == true) {
if (is_platform_booting()) {
echo ".";
}
update_filter_reload_status(gettext("Loading filter rules"));
Expand All @@ -379,7 +379,7 @@ function filter_configure_sync($delete_states_if_needed = true) {
mwexec("/sbin/pfctl -d", true);
unlink_if_exists("{$g['tmp_path']}/filter_loading");
update_filter_reload_status(gettext("Filter is disabled. Not loading rules."));
if (platform_booting() == true) {
if (is_platform_booting()) {
echo gettext("done.") . "\n";
}
unlock($filterlck);
Expand Down Expand Up @@ -598,7 +598,7 @@ function filter_configure_sync($delete_states_if_needed = true) {
$_grbg = exec("/sbin/pfctl -t " . escapeshellarg($alias) . " -T kill 2>/dev/null");
}

if (!platform_booting()) {
if (!is_platform_booting()) {
if (!empty($filterdns)) {
@file_put_contents("{$g['varetc_path']}/filterdns.conf", implode("", $filterdns));
unset($filterdns);
Expand Down Expand Up @@ -656,7 +656,7 @@ function filter_configure_sync($delete_states_if_needed = true) {
filter_tdr_install_cron(false);
}

if (platform_booting() == true) {
if (is_platform_booting()) {
echo ".";
}

Expand All @@ -675,11 +675,11 @@ function filter_configure_sync($delete_states_if_needed = true) {
}

update_filter_reload_status(gettext("Done"));
if (platform_booting() == true) {
if (is_platform_booting()) {
echo gettext("done.") . "\n";
}

if (!platform_booting() && !$rules_loading) {
if (!is_platform_booting() && !$rules_loading) {
remove_failover_states();
}

Expand Down Expand Up @@ -4458,7 +4458,7 @@ function filter_rules_spoofcheck_generate($ifname, $ifcfg, $log) {
* none
******/
function filter_tdr_install_cron($should_install) {
if (platform_booting() == true) {
if (is_platform_booting()) {
return;
}

Expand Down
6 changes: 3 additions & 3 deletions src/etc/inc/gwlb.inc
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ function setup_gateways_monitor() {
stop_dpinger();
return;
}
if (platform_booting()) {
if (is_platform_booting()) {
echo "Setting up gateway monitors...";
}
$monitor_ips = array();
Expand Down Expand Up @@ -425,7 +425,7 @@ function setup_gateways_monitor() {
log_error(sprintf(gettext("Error starting gateway monitor for %s"), $gateway['name']));
}
}
if (platform_booting()) {
if (is_platform_booting()) {
echo "done.\n";
}

Expand Down Expand Up @@ -1601,7 +1601,7 @@ function get_gwgroup_members_inner($group, $gateways_status, $gateways_arr, $vip
$tiers_count = count($tiers);
if ($tiers_count == 0) {
/* Oh dear, we have no members! Engage Plan B */
if (config_path_enabled('system', 'gw-debug') && (!platform_booting())) {
if (config_path_enabled('system', 'gw-debug') && (!is_platform_booting())) {
$msg = sprintf(gettext('Gateways status could not be determined, considering all as up/active. (Group: %s)'), $group['name']);
log_error($msg);
}
Expand Down
Loading

0 comments on commit 816fef2

Please sign in to comment.