Paket za buduci prelazak na Debian Lenny.
[php5-cn.git] / debian / postinst
index af35ec5..8229fc3 100755 (executable)
@@ -31,6 +31,7 @@ A2MODEDIR="/etc/apache2/mods-enabled"
 EXTENSIONS="mysql"
 PHP5DIR="/etc/php5"
 PHP5CONFD="/etc/php5/conf.d"
+PHP4DIR="/etc/php4"
 
 need_restart=0
 
@@ -253,6 +254,48 @@ for SAPI in apache2 cli; do
 done
 
 
+# Compare active PHP5 extensions with PHP4 ones, if PHP4 configuration still exists.
+#
+db_fget php5-cn/extensions seen
+if [ "$RET" != "true" ]; then
+
+    if [ -d "${PHP4DIR}" ] && [ -f "${PHP4DIR}/apache2/php.ini" ]; then
+
+        phpext_re='^[[:space:]]*extension[[:space:]]*=[[:space:]]*["]{0,1}(.*)\.so["]{0,1}'
+
+        # Get all active PHP4 extensions.
+        php4_ext="$(find ${PHP4DIR} -type f -name *.ini | 
+                 egrep "\/(conf\.d|apache2|cli)\/" | 
+                 xargs sed -rn 's/'$phpext_re'/\1/Ip')" || true
+
+        # Get all active PHP5 extensions.
+        php5_ext=""
+        if [ -d "${PHP5DIR}" ]; then
+            php5_ext="$(find ${PHP5DIR} -type f -name *.ini | 
+                     egrep "\/(conf\.d|apache2|cli)\/" | 
+                     xargs sed -rn 's/'$phpext_re'/\1/Ip')" || true
+        fi
+
+        # Compare PHP5 <-> PHP4 extensions.
+        php5_ext_mis=""
+        for ext in $php4_ext; do
+            if [ "$(echo $php5_ext | egrep $ext)" = "" ]; then
+                php5_ext_mis="\n${ext}${php5_ext_mis}"
+            if
+        done
+
+        # Some PHP5 extensions are not active.
+        if [ -n "$php5_ext_mis" ]; then
+            db_fset php5-cn/extensions seen false
+            db_title php5-cn - konfiguracija
+            db_subst php5-cn/extensions php5_extensions "${php5_ext_mis}"
+            db_input critical php5-cn/extensions || true
+            db_go || true
+        fi
+    fi
+fi
+
+
 db_stop || true