diff options
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 |