6 . /usr/share/debconf/confmodule
8 if [ "$1" != reconfigure ]; then
12 for SAPI in apache2 cli; do
13 db_fget php5-cn/${SAPI} seen
14 if [ "$RET" != "true" ]; then
20 test $php5_done -eq 1 && exit 0
27 # Calculate memory size for PHP memory_limit option.
31 local memtotal memlimit
32 memtotal=`awk 'tolower($1) == "memtotal:" { printf("%i", $2/1024); }' /proc/meminfo`
34 if [ $memtotal -lt 512 ]; then memlimit=16; fi
35 if [ $memtotal -ge 512 ]; then memlimit=32; fi
36 if [ $memtotal -gt 1024 ]; then memlimit=64; fi
42 # Check for PHP5 SAPI configuration.
44 for SAPI in apache2 cli; do
47 ini_file="$PHP5DIR/$SAPI/php.ini"
54 phplimit="$(phpmemlimit)M"
56 if [ -f "$ini_file" ]; then
58 if egrep -q "^[[:space:]]*(upload_max_filesize|post_max_size|memory_limit|error_reporting)[[:space:]]*=" $ini_file; then
60 upload_max_filesize=`awk '$1 == "upload_max_filesize" { print $3; exit(0) }' $ini_file`
61 post_max_size=`awk '$1 == "post_max_size" { print $3; exit(0) }' $ini_file`
62 memory_limit=`awk '$1 == "memory_limit" { print $3; exit(0) }' $ini_file`
63 error_reporting=`awk '$1 == "error_reporting" { print $3; exit(0) }' $ini_file`
65 if [ "$upload_max_filesize" != "256M" ]; then ini_diff=1; fi
66 if [ "$post_max_size" != "$phplimit" ]; then ini_diff=1; fi
67 if [ "$memory_limit" != "$phplimit" ]; then ini_diff=1; fi
68 if [ "$error_reporting" != "E_ERROR" ]; then ini_diff=1; fi
78 if [ $ini_diff -eq 1 ]; then
80 # Configurations are not the same - ask user what to do.
81 test -z "$upload_max_filesize" && upload_max_filesize="2M"
82 test -z "$post_max_size" && post_max_size="8M"
83 test -z "$memory_limit" && memory_limit="16M"
84 test -z "$error_reporting" && error_reporting="E_ALL & ~E_DEPRECATED"
86 db_title php5-cn - konfiguracija za $(echo ${SAPI} | sed 's/a/A/;s/cli/CLI/')
87 db_subst php5-cn/${SAPI} ini_file "$ini_file"
89 db_subst php5-cn/${SAPI} upload_max_filesize "$upload_max_filesize"
90 db_subst php5-cn/${SAPI} post_max_size "$post_max_size"
91 db_subst php5-cn/${SAPI} memory_limit "$memory_limit"
93 db_subst php5-cn/${SAPI} new_phplimit "$phplimit"
95 db_subst php5-cn/${SAPI} error_reporting "$error_reporting"
96 db_subst php5-cn/${SAPI} new_error_reporting "E_ERROR"
98 db_input critical php5-cn/${SAPI} || true
102 db_set php5-cn/${SAPI} false || true
103 db_fset php5-cn/${SAPI} seen true