[packages/php-dirs] - rel 2; process /var/run/php-ug for itk, too

arekm arekm at pld-linux.org
Thu Dec 11 13:15:47 CET 2014


commit 37fa3e25514f1b367d92c7bdd424893cfcb7394b
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Thu Dec 11 13:15:39 2014 +0100

    - rel 2; process /var/run/php-ug for itk, too

 php-dirs.spec  |  2 +-
 php-session.sh | 49 ++++++++++++++++++++++++++-----------------------
 2 files changed, 27 insertions(+), 24 deletions(-)
---
diff --git a/php-dirs.spec b/php-dirs.spec
index 8998813..cf0b01c 100644
--- a/php-dirs.spec
+++ b/php-dirs.spec
@@ -5,7 +5,7 @@ Summary:	Common dirs for different PHP versions
 Summary(pl.UTF-8):	Wspólne katalogi dla różnych wersji PHP
 Name:		php-dirs
 Version:	1.5
-Release:	1
+Release:	2
 License:	GPL
 Group:		Base
 Source0:	php-session.sh
diff --git a/php-session.sh b/php-session.sh
index c5d99a2..a12c1a6 100755
--- a/php-session.sh
+++ b/php-session.sh
@@ -2,30 +2,33 @@
 
 [ -x /usr/sbin/tmpwatch ] || exit 0
 
-session_dir=/var/run/php
-# find minimum gc time from any of the php engines
-gc_time=0
-for php in php php4 php52 php53 php54 php55; do
-	gc=
-	if [ -x /usr/bin/$php ]; then
-		gc=$($php -r 'echo max(round(ini_get("session.gc_maxlifetime")/3600), 1);' 2> /dev/null)
-	elif [ -r /etc/$php/php.ini ]; then
-		gc=$(awk -F"=" '/^session.gc_maxlifetime[ \t]*=/ { t=sprintf("%d", ($2/3600)); if (t<1) { t=1; }; print t; exit;}' /etc/$php/php.ini)
-	fi
-	[ -n "$gc" ] || continue
+for session_dir in /var/run/php /var/run/php-ug; do
+	[ ! -d "$session_dir" ] && continue
 
-	if [ "$gc" -lt "$gc_time" ] || [ $gc_time -eq 0 ]; then
-		gc_time=$gc
-	fi
-done
+	# find minimum gc time from any of the php engines
+	gc_time=0
+	for php in php php4 php52 php53 php54 php55; do
+		gc=
+		if [ -x /usr/bin/$php ]; then
+			gc=$($php -r 'echo max(round(ini_get("session.gc_maxlifetime")/3600), 1);' 2> /dev/null)
+		elif [ -r /etc/$php/php.ini ]; then
+			gc=$(awk -F"=" '/^session.gc_maxlifetime[ \t]*=/ { t=sprintf("%d", ($2/3600)); if (t<1) { t=1; }; print t; exit;}' /etc/$php/php.ini)
+		fi
+		[ -n "$gc" ] || continue
+
+		if [ "$gc" -lt "$gc_time" ] || [ $gc_time -eq 0 ]; then
+			gc_time=$gc
+		fi
+	done
 
-[ $gc_time -gt 0 ] || exit 0
+	[ $gc_time -gt 0 ] || continue
 
-# use tmpwatch with --test to remove only files matching to 'sess_*' pattern
-/usr/sbin/tmpwatch $gc_time $session_dir --test | while read action type file; do
-	case "$action $type $file" in
-	'removing file '*/sess_*)
-		rm "$file"
-		;;
-	esac
+	# use tmpwatch with --test to remove only files matching to 'sess_*' pattern
+	/usr/sbin/tmpwatch $gc_time $session_dir --test | while read action type file; do
+		case "$action $type $file" in
+		'removing file '*/sess_*)
+			rm "$file"
+			;;
+		esac
+	done
 done
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/php-dirs.git/commitdiff/37fa3e25514f1b367d92c7bdd424893cfcb7394b



More information about the pld-cvs-commit mailing list