]> git.pld-linux.org Git - packages/php-dirs.git/commitdiff
- rel 6; more frequent and partially configurable garbage collecting
authorArkadiusz Miśkiewicz <arekm@maven.pl>
Mon, 17 Aug 2009 22:03:52 +0000 (22:03 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    php-dirs.spec -> 1.16
    php-session.sh -> 1.1

php-dirs.spec
php-session.sh [new file with mode: 0644]

index 44864882ca5b4bf10ca7a01c976ae26e83b6ec59..5d3b05ab675d2f35b15167d2aff5dcf5fb4f424d 100644 (file)
@@ -2,9 +2,10 @@ Summary:       Common dirs for different PHP versions
 Summary(pl.UTF-8):     Wspólne katalogi dla różnych wersji PHP
 Name:          php-dirs
 Version:       1.1
-Release:       5
+Release:       6
 License:       GPL
 Group:         Base
+Source0:       php-session.sh
 BuildRequires: rpmbuild(macros) >= 1.461
 Requires(postun):      /usr/sbin/groupdel
 Requires(pre): /usr/bin/getgid
@@ -13,8 +14,6 @@ Provides:     group(http)
 BuildArch:     noarch
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
-%define                _tmpwatchdir    /etc/tmpwatch
-
 %description
 Common directories for PHP version 4 and version 5.
 
@@ -25,11 +24,10 @@ Wspólne katalogi dla PHP w wersji 4 oraz 5.
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{php_data_dir}/tests,/var/run/php}
+install -d $RPM_BUILD_ROOT{%{php_data_dir}/tests,/etc/cron.hourly,/var/run/php}
 install -d $RPM_BUILD_ROOT%{_docdir}/phpdoc
 
-install -d $RPM_BUILD_ROOT%{_tmpwatchdir}
-echo '/var/run/php 720' > $RPM_BUILD_ROOT%{_tmpwatchdir}/php.conf
+install %{SOURCE0} $RPM_BUILD_ROOT/etc/cron.hourly
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -50,4 +48,4 @@ fi
 # http needs only x for directory (otherwise it knows session file
 # names and can read it contents)
 %attr(730,root,http) %dir %verify(not group mode) /var/run/php
-%config(noreplace) %verify(not md5 mtime size) %{_tmpwatchdir}/php.conf
+%attr(755,root,root) %{_sysconfdir}/cron.hourly/php-session.sh
diff --git a/php-session.sh b/php-session.sh
new file mode 100644 (file)
index 0000000..5617608
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+if [ -x /usr/bin/php.cli ] ; then
+       RUNTIME5=$(/usr/bin/php.cli -r 'echo 1+(int)(ini_get("session.gc_maxlifetime")/3600);' 2> /dev/null)
+elif [ -r /etc/php/php.ini ]; then
+       RUNTIME5=$(awk -F"=" '/^session.gc_maxlifetime[[:space:]]*=/ { t=sprintf("%d", 1+($2/3600)); print t;}' /etc/php/php.ini)
+fi
+
+if [ -x /usr/bin/php4.cli ] ; then
+       RUNTIME4=$(/usr/bin/php4.cli -r 'echo 1+(int)(ini_get("session.gc_maxlifetime")/3600);' 2> /dev/null)
+elif [ -r /etc/php4/php.ini ]; then
+       RUNTIME4=$(awk -F"=" '/^session.gc_maxlifetime[[:space:]]*=/ { t=sprintf("%d", 1+($2/3600)); print t;}' /etc/php4/php.ini)
+fi
+
+[ -z "$RUNTIME5" ] && RUNTIME5="1h"
+
+if [ -n "$RUNTIME5" ]; then
+       /usr/sbin/tmpwatch ${RUNTIME5} /var/run/php
+fi
+
+if [ -n "$RUNTIME4" -a "$RUNTIME5" != "$RUNTIME4" ]; then
+       /usr/sbin/tmpwatch ${RUNTIME4} /var/run/php
+fi
This page took 0.037752 seconds and 4 git commands to generate.