diff options
-rw-r--r-- | etc/inc/config.inc | 16 | ||||
-rw-r--r-- | etc/inc/filter.inc | 25 | ||||
-rw-r--r-- | etc/inc/pfsense-utils.inc | 24 |
3 files changed, 44 insertions, 21 deletions
diff --git a/etc/inc/config.inc b/etc/inc/config.inc index afa8c69..d4d0717 100644 --- a/etc/inc/config.inc +++ b/etc/inc/config.inc @@ -272,6 +272,13 @@ function parse_config($parse = false) { alias_make_table($config); config_unlock(); + /* process packager manager custom rules */ + if(is_dir("/usr/local/pkg/config_parse/")) { + update_filter_reload_status("Running plugins (config_parse)"); + run_plugins("/usr/local/pkg/config_parse/"); + update_filter_reload_status("Plugins completed."); + } + /* override some global configuration parms if they exist * instead of hard coding these checks into the codebase */ @@ -1094,6 +1101,13 @@ function write_config($desc="Unknown", $backup = true) { config_unlock(); + if(is_dir("/usr/local/pkg/write_config/")) { + /* process packager manager custom rules */ + update_filter_reload_status("Running plugins"); + run_plugins("/usr/local/pkg/write_config/"); + update_filter_reload_status("Plugins completed."); + } + return $config; } @@ -1862,4 +1876,4 @@ function set_device_perms() { if($g['booting']) echo "."; $config = parse_config(); -?> +?>
\ No newline at end of file diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 1e24a2b..6e8c740 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -259,27 +259,12 @@ function filter_configure_sync() { update_filter_reload_status("Running plugins"); - /* process packager manager custom rules */ - $files = return_dir_as_array("/usr/local/pkg/pf/"); - if($files <> "") { - foreach ($files as $file) { - if($file) { - $text = file_get_contents("/usr/local/pkg/pf/" . $file); - if($text) { - if(stristr($file, ".sh") == true) { - mwexec("/usr/local/pkg/pf/" . $file . " start"); - } else { - if(!stristr($file,"CVS")) { - if($g['booting'] == true) - echo "\t{$file}... "; - require_once("/usr/local/pkg/pf/" . $file); - } - } - } - } - } + if(is_dir("/usr/local/pkg/pf/")) { + /* process packager manager custom rules */ + update_filter_reload_status("Running plugins (pf)"); + run_plugins("/usr/local/pkg/pf/"); + update_filter_reload_status("Plugins completed."); } - update_filter_reload_status("Plugins completed."); system_start_ftp_helpers(); diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 91b604d..dccfdad 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -2151,6 +2151,30 @@ function get_disk_info() { // $size, $used, $avail, $cap } +function run_plugins($directory) { + global $config, $g; + /* process packager manager custom rules */ + $files = return_dir_as_array($directory); + if($files <> "") { + foreach ($files as $file) { + if($file) { + $text = file_get_contents($directory . $file); + if($text) { + if(stristr($file, ".sh") == true) { + mwexec($directory . $file . " start"); + } else { + if(!stristr($file,"CVS")) { + if($g['booting'] == true) + echo "\t{$file}... "; + require_once($directory . $file); + } + } + } + } + } + } +} + /****f* pfsense-utils/display_top_tabs * NAME * display_top_tabs - display tabs with rounded edges |