1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
#!/bin/sh
set -e
#DEBHELPER#
if [ "$1" != "configure" ]; then
exit 0
fi
phpini="/etc/php4/cgi/php.ini"
# LEGACY SUPPORT
# previous versions of php did not ship $phpini as a conffile nor did
# they use anything like ucf. as a result, we need to help transition
# those files into ucf a little more easily by updating unmodified
# ini files before registering them
#
# if we're upgrading from a pre-ucf version of php:
if dpkg --compare-versions "$2" le-nl "4:4.4.4-3"; then
# if the SAPI config file already exists and is unmodified
if [ -f "$phpini" ]; then
oldmd5=`md5sum $phpini | cut -d' ' -f1`
if [ "$oldmd5" = "c887b67c2c6c77bc49480480d291d22f" ] ||
[ "$oldmd5" = "21d8e6d4734bbb3eb9c2ab0873f4e0b4" ]; then
# then silently update it before registering via ucf
cp /usr/share/php4/php.ini-dist $phpini
fi
fi
fi
# END LEGACY SUPPORT
ucf /usr/share/php4/php.ini-dist $phpini
if dpkg --compare-versions "$2" lt "4:4.3.9-1"; then
if grep -q "^[[:space:]]*session.gc_probability[[:space:]]*=[[:space:]]*[[:digit:]]*" $phpini; then
if grep -q "^[[:space:]]*session.save_path[[:space:]]*=[[:space:]]*/var/lib/php4" $phpini; then
sed -i -e "s/^[[:space:]]*session.save_path.*$/;session.save_path = \\/var\\/lib\\/php4/" $phpini
sed -i -e "s/^[[:space:]]*session.gc_probability.*$/;session.gc_probability = 0/" $phpini
fi
if ! grep -q "^[[:space:]]*session.save_path" $phpini; then
sed -i -e "s/^[[:space:]]*session.gc_probability.*$/;session.gc_probability = 0/" $phpini
fi
fi
if grep -q "^[[:space:]]*session.save_handler[[:space:]]*=[[:space:]]*mm" $phpini; then
sed -i -e "s/^[[:space:]]*session.save_handler.*$/;session.save_handler = files/" $phpini
fi
fi
update-alternatives \
--install /usr/bin/php-cgi php-cgi /usr/bin/php4-cgi 40 \
--slave /usr/share/man/man1/php-cgi.1.gz php-cgi.1.gz /usr/share/man/man1/php4-cgi.1.gz
update-alternatives \
--install /usr/lib/cgi-bin/php php-cgi-bin /usr/lib/cgi-bin/php4 40
if [ ! -L /usr/share/doc/php4-cgi ]; then
rm -rf /usr/share/doc/php4-cgi
ln -s php4-common /usr/share/doc/php4-cgi
fi
exit 0
|