From 5556f3a1169545ddbd24a588a6242deb354650cb Mon Sep 17 00:00:00 2001 From: Ermal Date: Wed, 15 Sep 2010 12:37:31 +0000 Subject: Do not use the \ based list for modules because it treats even the comments as modules. Simplify logic and make sure php.ini exists in both paths when needed. --- etc/rc.php_ini_setup | 114 +++++++++++++++++++-------------------------------- 1 file changed, 43 insertions(+), 71 deletions(-) (limited to 'etc') diff --git a/etc/rc.php_ini_setup b/etc/rc.php_ini_setup index 34d89cf..b2b6320 100755 --- a/etc/rc.php_ini_setup +++ b/etc/rc.php_ini_setup @@ -25,13 +25,6 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. -if [ -f /usr/local/etc/php.ini ]; then - rm /usr/local/etc/php.ini -fi -if [ -f /usr/local/lib/php.ini ]; then - rm /usr/local/lib/php.ini -fi - # Set our operating platform PLATFORM=`cat /etc/platform` EXTENSIONSDIR="/usr/local/lib/php/20060613/" @@ -84,48 +77,43 @@ fi # Define php modules. Do not add .so, it will # be done automatically by the script below. -PHPMODULES="apc \ +PHPMODULES="apc" +PHPMODULES="$PHPMODULES standard" # Downloading via HTTP/FTP (pkg mgr, etc) - curl \ - date \ +PHPMODULES="$PHPMODULES curl date" # Internationalization - gettext \ +PHPMODULES="$PHPMODULES gettext" # User manager - ldap \ - openssl \ - pcntl \ +PHPMODULES="$PHPMODULES ldap openssl pcntl" +PHPMODULES="$PHPMODULES mhash" # Regexs, PERL style! - pcre \ +PHPMODULES="$PHPMODULES pcre" # The mighty posix! - posix \ - readline \ +PHPMODULES="$PHPMODULES posix" +PHPMODULES="$PHPMODULES readline" # Login sessions - session \ - standard \ +PHPMODULES="$PHPMODULES session" # Extra sanity seatbelts - suhosin \ - pfSense \ +PHPMODULES="$PHPMODULES suhosin" # Firewall rules edit - ctype \ +PHPMODULES="$PHPMODULES ctype" # Config read/write - xml \ - xmlreader \ - xmlwriter \ - libxml \ -# user manager - mhash \ +PHPMODULES="$PHPMODULES xml xmlreader xmlwriter libxml" +PHPMODULES="$PHPMODULES simplexml" # firewall_rules_edit.php - mbstring \ - shmop \ +PHPMODULES="$PHPMODULES mbstring" +# Synchronization primitives +PHPMODULES="$PHPMODULES shmop" # Page compression - zlib \ -# SQLlite - simplexml \ - spl \ - pdo \ - sqlite \ +PHPMODULES="$PHPMODULES zlib" +# SQLlite & Database +PHPMODULES="$PHPMODULES spl" +PHPMODULES="$PHPMODULES pdo" +PHPMODULES="$PHPMODULES sqlite" # ZeroMQ - zmq" +PHPMODULES="$PHPMODULES zmq" +# pfSense extensions +PHPMODULES="$PHPMODULES pfSense" # Modules previously included. # can be turned on by touching @@ -142,15 +130,16 @@ PHPMODULES="apc \ # bz2 \ # json \ -# Get a loaded module list in the stock php +# Clear the .ini file to make sure we are clean if [ -f /usr/local/etc/php.ini ]; then rm /usr/local/etc/php.ini fi if [ -f /usr/local/lib/php.ini ]; then rm /usr/local/lib/php.ini fi -LOADED_MODULES=`php -m | grep -v "\["` +LOADED_MODULES=`/usr/local/bin/php -m | grep -v "\["` +# Get a loaded module list in the stock php # Populate a dummy php.ini to avoid # the file being clobbered and the firewall # not being able to boot back up. @@ -178,6 +167,9 @@ extension_dir=${EXTENSIONSDIR} EOF +# Copy php.ini file to etc/ too (cli) +cp /usr/local/lib/php.ini /usr/local/etc/php.ini + # Ensure directory exists if [ ! -d /etc/php_dynamodules ]; then mkdir /etc/php_dynamodules @@ -211,27 +203,6 @@ done RAM=`sysctl hw.realmem | awk '{print $2/1000000}' | awk -F '.' '{print $1}'` export RAM export LOWMEM -if [ "$RAM" -lt "97" ]; then - LOWMEM="TRUE" - cat >>/usr/local/lib/php.ini <>/usr/local/lib/php.ini <>> WARNING! under 128 megabytes of ram detected. Not enabling APC." + echo ">>> WARNING! under 128 megabytes of ram detected. Not enabling APC." | logger -p daemon.info -i -t rc.php_ini_setup +fi + + cat >>/usr/local/lib/php.ini <>> WARNING! under 128 megabytes of ram detected. Not enabling APC." - echo ">>> WARNING! under 128 megabytes of ram detected. Not enabling APC." | logger -p daemon.info -i -t rc.php_ini_setup - -fi # Copy php.ini file to etc/ too (cli) cp /usr/local/lib/php.ini /usr/local/etc/php.ini @@ -277,7 +252,7 @@ for EXT in $PHPMODULES; do done # Check loaded modules and remove anything that did not load correctly -LOADED_MODULES=`php -m | tr '[:upper:]' '[:lower:]' 2>/dev/null | grep -v "\["` +LOADED_MODULES=`/usr/local/bin/php -m | tr '[:upper:]' '[:lower:]' 2>/dev/null | grep -v "\["` for EXT in $PHPMODULESLC; do SHOULDREMOVE="true" for LM in $LOADED_MODULES; do @@ -298,6 +273,7 @@ for EXT in $PHPMODULESLC; do if [ -f "${EXTENSIONSDIR}${EXT}.so" ]; then echo ">>> ${EXT} did not load correctly. Removing from php.ini..." >> /var/run/php_modules_load_errors.txt cat /usr/local/lib/php.ini | grep -v $EXT > /tmp/php.ini + rm -f /usr/local/lib/php.ini mv /tmp/php.ini /usr/local/lib/php.ini fi fi @@ -305,7 +281,3 @@ done # Copy php.ini file to etc/ too (cli) cp /usr/local/lib/php.ini /usr/local/etc/php.ini - - - - -- cgit v1.1 From 3befe730ffeec38b37ed087e7c36c59d11840b83 Mon Sep 17 00:00:00 2001 From: Ermal Date: Wed, 15 Sep 2010 18:45:48 +0000 Subject: Cleanup code. --- etc/inc/gwlb.inc | 1 - 1 file changed, 1 deletion(-) (limited to 'etc') diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc index eb00826..3f9a974 100644 --- a/etc/inc/gwlb.inc +++ b/etc/inc/gwlb.inc @@ -286,7 +286,6 @@ function return_gateways_array($disabled = false) { /* no IP address found, set to dynamic */ if(! is_ipaddr($gateway['gateway'])) $gateway['gateway'] = "dynamic"; - $gateway['dynamic'] = true; } if(empty($gateway['monitor'])) -- cgit v1.1 From d8bf779be2910026e44ca9f493c02df960b94408 Mon Sep 17 00:00:00 2001 From: Ermal Date: Wed, 15 Sep 2010 18:49:33 +0000 Subject: Oops this is meant to add members not override them. --- etc/inc/gwlb.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'etc') diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc index 3f9a974..bef1546 100644 --- a/etc/inc/gwlb.inc +++ b/etc/inc/gwlb.inc @@ -365,7 +365,7 @@ function return_gateway_groups_array() { $gwname = $itemsplit[0]; /* Do it here rather than reiterating again the group in case no member is up. */ - $backupplan[$tier] = $gwname; + $backupplan[$tier][] = $gwname; /* check if the gateway is available before adding it to the array */ if (!empty($gateway_status[$gwname])) { -- cgit v1.1 From 739c9efddfe6994f2bcb88f6adccff6e2a601d21 Mon Sep 17 00:00:00 2001 From: Ermal Date: Wed, 15 Sep 2010 20:11:15 +0000 Subject: Send a log entry when openvpn resync is called. --- etc/inc/openvpn.inc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'etc') diff --git a/etc/inc/openvpn.inc b/etc/inc/openvpn.inc index 1fcb77a..a71a9ba 100644 --- a/etc/inc/openvpn.inc +++ b/etc/inc/openvpn.inc @@ -688,10 +688,14 @@ function openvpn_resync_all($interface = "") { file_put_contents($path_ovdh, $dh_parameters); } */ + if ($interface <> "") + log_error("Resyncing openvpn instances configurations for interface " . convert_friendly_interface_to_friendly_descr($interface) . "."); + else + log_error("Resyncing openvpn instances configurations."); if (is_array($config['openvpn']['openvpn-server'])) { foreach ($config['openvpn']['openvpn-server'] as & $settings) { - if (!empty($interface) && $interface != $settings['interface']) + if ($interface <> "" && $interface != $settings['interface']) continue; openvpn_resync('server', $settings); } @@ -699,7 +703,7 @@ function openvpn_resync_all($interface = "") { if (is_array($config['openvpn']['openvpn-client'])) { foreach ($config['openvpn']['openvpn-client'] as & $settings) { - if (!empty($interface) && $interface != $settings['interface']) + if ($interface <> "" && $interface != $settings['interface']) continue; openvpn_resync('client', $settings); } -- cgit v1.1 From ecb08c6a826c5e3ebeac47f9e1bff20554471816 Mon Sep 17 00:00:00 2001 From: Ermal Date: Wed, 15 Sep 2010 21:38:02 +0000 Subject: Write status file every 5seconds. --- etc/inc/gwlb.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'etc') diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc index bef1546..66014ff 100644 --- a/etc/inc/gwlb.inc +++ b/etc/inc/gwlb.inc @@ -75,7 +75,7 @@ status { file "{$g['tmp_path']}/apinger.status" ## Interval between file updates ## when 0 or not set, file is written only when SIGUSR1 is received - interval 10s + interval 5s } ######################################## -- cgit v1.1