commit c2fd47f2430f6e1c9de8df01d4fbd81610086238
Author: Elan Ruusamäe <[email protected]>
Date:   Thu Dec 11 15:20:48 2014 +0200

    move gc lookup to function, add php56

 php-session.sh | 32 ++++++++++++++++++--------------
 1 file changed, 18 insertions(+), 14 deletions(-)
---
diff --git a/php-session.sh b/php-session.sh
index 81f90bc..1d2befc 100755
--- a/php-session.sh
+++ b/php-session.sh
@@ -18,21 +18,25 @@ cleanup_dir() {
 }
 
 # 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
+find_gc_time() {
+       gc_time=0
+       local gc php
+       for php in php php4 php52 php53 php54 php55 php56; 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
+}
 
+find_gc_time
 [ $gc_time -gt 0 ] || exit 0
 
 for session_dir in $session_dirs; do
================================================================

---- gitweb:

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

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to