File: libapache2-mod-php5.postinst

package info (click to toggle)
php5 5.2.6.dfsg.1-1%2Blenny16
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 81,956 kB
  • ctags: 45,717
  • sloc: ansic: 545,818; sh: 18,463; php: 12,555; xml: 4,362; yacc: 2,430; lex: 2,294; makefile: 1,193; tcl: 1,128; awk: 693; cpp: 682; perl: 71; pascal: 24; sql: 22
file content (63 lines) | stat: -rw-r--r-- 1,621 bytes parent folder | download
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
61
62
63
#!/bin/sh

set -e

#DEBHELPER#

if [ "$1" != "configure" ]; then
    exit 0
fi

phpini="/etc/php5/apache2/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 "5.1.6-4"; then
	# if the SAPI config file already exists and is unmodified
	if [ -f "$phpini" ]; then
		oldmd5=`md5sum $phpini | cut -d' ' -f1`
		if [ "$oldmd5" = "c85605baab79fbcd3c289e442eb3caa2" ]; then
			# then silently update it before registering via ucf
			cp /usr/share/php5/php.ini-dist $phpini
		fi
	fi
fi
# END LEGACY SUPPORT

ucf /usr/share/php5/php.ini-dist $phpini

reload_apache()
{
	if apache2ctl configtest 2>/dev/null; then
		invoke-rc.d apache2 force-reload || true
	else
		echo "Your apache2 configuration is broken, so we're not restarting it for you."
	fi
}

if [ -n "$2" ]; then
	# recover the previous state
	if [ -e /etc/php5/apache2/.start ]; then
	    a2enmod php5 >/dev/null || true
      rm -f /etc/php5/apache2/.start
	fi
# we're upgrading. test if we're enabled, and if so, restart to reload the module.
	if [ -e /etc/apache2/mods-enabled/php5.load ]; then
		reload_apache
	fi
        exit 0
fi

if [ -e /etc/apache2/apache2.conf ]; then
# Enable the module, but hide a2enmod's misleading message about apachectl
# and force-reload the thing ourselves.
        a2enmod php5 >/dev/null || true
	reload_apache
fi

exit 0