]> git.pld-linux.org Git - packages/php-dirs.git/blob - php-session.sh
- rel 6; more frequent and partially configurable garbage collecting
[packages/php-dirs.git] / php-session.sh
1 #!/bin/sh
2 if [ -x /usr/bin/php.cli ] ; then
3         RUNTIME5=$(/usr/bin/php.cli -r 'echo 1+(int)(ini_get("session.gc_maxlifetime")/3600);' 2> /dev/null)
4 elif [ -r /etc/php/php.ini ]; then
5         RUNTIME5=$(awk -F"=" '/^session.gc_maxlifetime[[:space:]]*=/ { t=sprintf("%d", 1+($2/3600)); print t;}' /etc/php/php.ini)
6 fi
7
8 if [ -x /usr/bin/php4.cli ] ; then
9         RUNTIME4=$(/usr/bin/php4.cli -r 'echo 1+(int)(ini_get("session.gc_maxlifetime")/3600);' 2> /dev/null)
10 elif [ -r /etc/php4/php.ini ]; then
11         RUNTIME4=$(awk -F"=" '/^session.gc_maxlifetime[[:space:]]*=/ { t=sprintf("%d", 1+($2/3600)); print t;}' /etc/php4/php.ini)
12 fi
13
14 [ -z "$RUNTIME5" ] && RUNTIME5="1h"
15
16 if [ -n "$RUNTIME5" ]; then
17         /usr/sbin/tmpwatch ${RUNTIME5} /var/run/php
18 fi
19
20 if [ -n "$RUNTIME4" -a "$RUNTIME5" != "$RUNTIME4" ]; then
21         /usr/sbin/tmpwatch ${RUNTIME4} /var/run/php
22 fi
This page took 0.525643 seconds and 3 git commands to generate.