From: Dragan Dosen Date: Tue, 2 Sep 2008 19:40:00 +0000 (+0200) Subject: debian/postinst: X-Git-Tag: v5.3.3+3~10 X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=commitdiff_plain;h=d443845d6ce091d56ff5e8b56c7d54511e5a268c;p=php5-cn.git debian/postinst: + validate php.ini configuration. (ticket #3938) + debconf-escape for error reporting. debian/control: + added a dependency on debconf (>= 1.4.72). --- diff --git a/debian/changelog b/debian/changelog index f04024e..227201a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,19 @@ +php5-cn (5.2.0-6) stable; urgency=low + + * debian/postinst datoteka: + + provjera ispravnosti za postavke unutar php.ini + konfiguracijske datoteke - vrijednosti za postavke kao sto + su upload_max_filesize, post_max_size, memory_limit, ne + smiju zavrsavati sa 'B'; dozvoljene oznake su 'K' (kilo), + 'M' (mega) i 'G' (giga), npr. 16K, 32M, 1G. U protivnom, + kao mjerna jedinica koristit ce se 'byte' - korisnik je + informiran da provjeri konfiguraciju. (rijeseno: #3938) + + koristi se debconf-escape za ispis pogresno podesenih + postavki unutar php.ini datoteke. + * debian/control - ovisnost o debconf (>= 1.4.72). + + -- Dragan Dosen Tue, 2 Sep 2008 21:29:03 +0200 + php5-cn (5.2.0-5) stable; urgency=medium * dodana config skripta: diff --git a/debian/control b/debian/control index fae7f90..d5f5746 100644 --- a/debian/control +++ b/debian/control @@ -8,7 +8,7 @@ Standards-Version: 3.6.1 Package: php5-cn Architecture: all -Depends: libapache2-mod-php5, php5-cli, php5-mysql, debconf, carnet-tools-cn (>= 2.4) +Depends: libapache2-mod-php5, php5-cli, php5-mysql, debconf (>= 1.4.72), carnet-tools-cn (>= 2.4) Conflicts: php4-cn Description: server-side, HTML-embedded scripting language (CARNet configuration) This package is a meta-package that, when installed, guarantees that you diff --git a/debian/postinst b/debian/postinst index 17d1c41..af35ec5 100755 --- a/debian/postinst +++ b/debian/postinst @@ -51,6 +51,20 @@ phpmemlimit () { echo $memlimit } +# phpinivalidate () +# +# Validate php.ini values. +# +phpinivalidate () { + + local ini_file + ini_file="$1" + + awk -F'[[:space:]]*=[[:space:]]*' \ + '/^[[:space:]]*[[:alpha:]_]+[[:space:]]*=[[:space:]]*[[:digit:]]+[MGK]B/ {print $1" = "$2}' \ + "$ini_file" +} + # Disable PHP4 module and enable Apache2 PHP5 module. # @@ -173,12 +187,11 @@ for SAPI in apache2 cli; do if [ ! -d "$PHP5DIR/$SAPI" ]; then continue fi - + + ini_file="$PHP5DIR/$SAPI/php.ini" db_get php5-cn/${SAPI} || true if [ "$RET" = "true" ]; then - ini_file="$PHP5DIR/$SAPI/php.ini" - cp_echo "CN: Checking and enabling some specific parameters in file $ini_file" phplimit="$(phpmemlimit)M" @@ -222,6 +235,21 @@ for SAPI in apache2 cli; do 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 diff --git a/debian/templates b/debian/templates index 1df1088..d99e08f 100644 --- a/debian/templates +++ b/debian/templates @@ -30,3 +30,17 @@ Description: Zelite li aktivirati preporucene PHP5 postavke za CLI? upload_max_filesize = 256M post_max_size = ${new_phplimit} memory_limit = ${new_phplimit} + +Template: php5-cn/inivalues +Type: note +Description: + Provjerom trenutne PHP5 konfiguracije za ${php5_sapi} (konfiguracijska + datoteka ${ini_file}), ustanovljeno je da sljedece postavke nisu ispravne: + . + ${php5_inivalues} + . + Vrijednosti za navedene postavke ne smiju zavrsavati sa 'B'. Dozvoljene + oznake su 'K' (kilo), 'M' (mega) i 'G' (giga), npr. 16K, 32M, 1G. U protivnom, + kao mjerna jedinica koristit ce se 'byte'. Molimo, svakako provjerite postavke + unutar navedene datoteke kako bi aplikacije (kao sto je Squirrelmail) mogle + normalno funkcionirati.