diff options
author | Renato Botelho <renato@netgate.com> | 2015-10-01 10:21:43 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2015-10-01 10:21:43 -0300 |
commit | a5c36eb22154a2f17bba4329ee85627eeb64b664 (patch) | |
tree | c3bfe52067f1af8586dd85c2118cb66f55d2b227 /src/etc/rc.php_ini_setup | |
parent | 339b88930513dec2bc986df7c0cd7255b6815d56 (diff) | |
download | pfsense-a5c36eb22154a2f17bba4329ee85627eeb64b664.zip pfsense-a5c36eb22154a2f17bba4329ee85627eeb64b664.tar.gz |
Introduce read_xml_tag.sh
Create /usr/local/sbin/read_xml_tag.sh, that will read a xml tag from
config file using xmllint. Replace all direct read using cat, grep, sed,
... by this script
Diffstat (limited to 'src/etc/rc.php_ini_setup')
-rwxr-xr-x | src/etc/rc.php_ini_setup | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/etc/rc.php_ini_setup b/src/etc/rc.php_ini_setup index f456e6b..2fd5add 100755 --- a/src/etc/rc.php_ini_setup +++ b/src/etc/rc.php_ini_setup @@ -165,16 +165,19 @@ if [ -f /usr/local/lib/php.ini ]; then fi LOADED_MODULES=`/usr/local/bin/php-cgi -m | /usr/bin/grep -v "\["` +unset TIMEZONE # Fetch the timezone from /var/db/zoneinfo if present if [ -f /var/db/zoneinfo ]; then TIMEZONE=$(cat /var/db/zoneinfo) -# Second option is from config.xml -elif grep -q '<timezone>' /cf/conf/config.xml; then - TIMEZONE=$(/usr/bin/sed -E \ - '/<timezone>/!d; s,^.*<timezone>,,; s,<.*,,' \ - /cf/conf/config.xml) -# Last option, use default value -else +fi + +if [ -z "${TIMEZONE}" ]; then + # Second option is from config.xml + TIMEZONE=$(/usr/local/sbin/read_xml_tag.sh string system/timezone) +fi + +if [ -z "${TIMEZONE}" ]; then + # Last option, use default value globals_inc="/etc/inc/globals.inc" if [ -f /etc/inc/globals_override.inc ]; then globals_inc="/etc/inc/globals_override.inc ${globals_inc}" @@ -185,6 +188,11 @@ else sed 's/^.*=>* *//; s/["\;,]*//g') fi +if [ -z "${TIMEZONE}" ]; then + # It it's still blank, lets avoid PHP errors + TIMEZONE="Etc/UTC" +fi + # Get a loaded module list in the stock php # Populate a dummy php.ini to avoid # the file being clobbered and the firewall |