- if [ ! -d "$PHP5DIR/$SAPI" ]; then
- continue
- fi
-
- ini_file="$PHP5DIR/$SAPI/php.ini"
- db_get php5-cn/${SAPI} || true
- if [ "$RET" = "true" ]; then
-
- cp_echo "CN: Checking and enabling some specific parameters in file $ini_file"
-
- phplimit="$(phpmemlimit)M"
-
- if [ -f "$ini_file" ]; then
-
- cp_check_and_sed "^[[:space:]]*upload_max_filesize[[:space:]]*=" \
- 's/^[[:space:]]*upload_max_filesize[[:space:]]*=.*/upload_max_filesize = 256M/' \
- "$ini_file" && need_restart=1 || true
-
- cp_check_and_sed "^[[:space:]]*post_max_size[[:space:]]*=" \
- "s/^[[:space:]]*post_max_size[[:space:]]*=.*/post_max_size = ${phplimit}/" \
- "$ini_file" && need_restart=1 || true
-
- cp_check_and_sed "^[[:space:]]*memory_limit[[:space:]]*=" \
- "s/^[[:space:]]*memory_limit[[:space:]]*=.*/memory_limit = ${phplimit}/" \
- "$ini_file" && need_restart=1 || true
- fi
-
- ini_file_tmp=`mktemp $ini_file.tmp.XXXXXX`
- if [ -f "$ini_file" ]; then
- cat $ini_file > $ini_file_tmp
- fi
-
- if ! egrep -q "^[[:space:]]*upload_max_filesize[[:space:]]*=" $ini_file_tmp; then
- echo "upload_max_filesize = 256M" >> "$ini_file_tmp"
- need_restart=1
- fi
- if ! egrep -q "^[[:space:]]*post_max_size[[:space:]]*=" $ini_file_tmp; then
- echo "post_max_size = ${phplimit}" >> "$ini_file_tmp"
- need_restart=1
- fi
- if ! egrep -q "^[[:space:]]*memory_limit[[:space:]]*=" $ini_file_tmp; then
- echo "memory_limit = ${phplimit}" >> "$ini_file_tmp"
- need_restart=1
- fi
- cp_mv "$ini_file_tmp" "$ini_file"
- chmod 644 "$ini_file"
-
- if [ -e "$ini_file_tmp" ]; then
- rm -f "$ini_file_tmp"
- fi
- fi
-
- # Validate php.ini values.
- if [ -f "$ini_file" ]; then
- php5_inivalues="$(phpinivalidate "$ini_file")"
- if [ -n "$php5_inivalues" ]; then
- db_fset php5-cn/inivalues seen false
- db_title php5-cn - konfiguracija za $(echo ${SAPI} | sed 's/a/A/;s/cli/CLI/')
- db_subst php5-cn/inivalues php5_sapi $(echo ${SAPI} | sed 's/a/A/;s/cli/CLI/')
- db_subst php5-cn/inivalues ini_file "$ini_file"
- db_capb escape
- db_subst php5-cn/inivalues php5_inivalues "$(echo -n "$php5_inivalues" | debconf-escape -e)"
- db_input critical php5-cn/inivalues || true
- db_go || true
- fi
- fi
-done