php add repo

This commit is contained in:
burakerturk
2016-04-17 21:27:55 +03:00
parent bf16a1cc9e
commit 0c00df6983
24 changed files with 78660 additions and 73802 deletions
+2
View File
@@ -0,0 +1,2 @@
; Comment the following line to disable php-zip extension
extension = zip.so
@@ -0,0 +1,2 @@
; Comment the following line to disable php-imap extension
extension = imap.so
@@ -0,0 +1,19 @@
LoadModule php5_module modules/libphp5.so
AddHandler php5-script .php
# Set it to handle the files
<IfModule mod_mime.c>
AddType application/x-httpd-php .php
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4
AddType application/x-httpd-php .php5
AddType application/x-httpd-php-source .phps
</IfModule>
#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php index.phtml
@@ -0,0 +1,62 @@
diff -u --recursive php-5.6.6-vanilla/configure.in php-5.6.6/configure.in
--- php-5.6.6-vanilla/configure.in 2015-02-26 22:10:51.865487530 -0500
+++ php-5.6.6/configure.in 2015-02-26 22:29:59.043102135 -0500
@@ -453,7 +453,10 @@
PHP_CHECK_FUNC(gethostbyaddr, nsl)
PHP_CHECK_FUNC(yp_get_default_domain, nsl)
-PHP_CHECK_FUNC(dlopen, dl)
+PHP_ADD_LIBRARY(dl)
+PHP_DEF_HAVE(dlopen)
+PHP_DEF_HAVE(libdl)
+ac_cv_func_dlopen=yes
if test "$ac_cv_func_dlopen" = "yes"; then
AC_DEFINE(HAVE_LIBDL, 1, [ ])
fi
diff -u --recursive php-5.6.6-vanilla/ext/fileinfo/config.m4 php-5.6.6/ext/fileinfo/config.m4
--- php-5.6.6-vanilla/ext/fileinfo/config.m4 2015-02-26 22:10:51.639487135 -0500
+++ php-5.6.6/ext/fileinfo/config.m4 2015-02-26 22:22:47.645609128 -0500
@@ -46,6 +46,10 @@
AC_MSG_RESULT(no)
AC_MSG_NOTICE(using libmagic strcasestr implementation)
libmagic_sources="$libmagic_sources libmagic/strcasestr.c"
+ ],[
+ dnl cross-compiling; assume not present
+ AC_MSG_NOTICE(using libmagic strcasestr implementation)
+ libmagic_sources="$libmagic_sources libmagic/strcasestr.c"
])
PHP_NEW_EXTENSION(fileinfo, fileinfo.c $libmagic_sources, $ext_shared,,-I@ext_srcdir@/libmagic)
diff -u --recursive php-5.6.6-vanilla/ext/opcache/config.m4 php-5.6.6/ext/opcache/config.m4
--- php-5.6.6-vanilla/ext/opcache/config.m4 2015-02-26 22:10:51.790487399 -0500
+++ php-5.6.6/ext/opcache/config.m4 2015-02-26 22:34:19.240414394 -0500
@@ -341,7 +341,14 @@
flock_type=linux
AC_DEFINE([HAVE_FLOCK_LINUX], [], [Struct flock is Linux-type])
AC_MSG_RESULT("yes")
-], AC_MSG_RESULT("no") )
+], [
+ AC_MSG_RESULT("no")
+], [
+ dnl cross-compiling; assume Linux
+ flock_type=linux
+ AC_DEFINE([HAVE_FLOCK_LINUX], [], [Struct flock is Linux-type])
+ AC_MSG_RESULT("yes")
+])
AC_MSG_CHECKING("whether flock struct is BSD ordered")
AC_TRY_RUN([
@@ -357,7 +364,12 @@
flock_type=bsd
AC_DEFINE([HAVE_FLOCK_BSD], [], [Struct flock is BSD-type])
AC_MSG_RESULT("yes")
-], AC_MSG_RESULT("no") )
+], [
+ AC_MSG_RESULT("no")
+], [
+ dnl cross-compiling; assume Linux
+ AC_MSG_RESULT("no")
+])
if test "$flock_type" == "unknown"; then
AC_MSG_ERROR([Don't know how to define struct flock on this system[,] set --enable-opcache=no])
+59
View File
@@ -0,0 +1,59 @@
--- configure 2013-07-03 08:16:15.000000000 +0200
+++ configure 2013-08-07 19:19:16.797273766 +0200
@@ -42409,7 +42409,7 @@
/* end confdefs.h. */
#include "$THIS_INCLUDE"
-#if DB_VERSION_MAJOR == 4 || (4 == 4 && DB_VERSION_MAJOR == 5)
+#if DB_VERSION_MAJOR == 4 || (4 == 4 && DB_VERSION_MAJOR >= 5)
yes
#endif
@@ -42785,7 +42785,7 @@
/* end confdefs.h. */
#include "$THIS_INCLUDE"
-#if DB_VERSION_MAJOR == 3 || (3 == 4 && DB_VERSION_MAJOR == 5)
+#if DB_VERSION_MAJOR == 3 || (3 == 4 && DB_VERSION_MAJOR >= 5)
yes
#endif
@@ -43161,7 +43161,7 @@
/* end confdefs.h. */
#include "$THIS_INCLUDE"
-#if DB_VERSION_MAJOR == 2 || (2 == 4 && DB_VERSION_MAJOR == 5)
+#if DB_VERSION_MAJOR == 2 || (2 == 4 && DB_VERSION_MAJOR >= 5)
yes
#endif
--- ext/dba/config.m4 2013-07-03 08:10:53.000000000 +0200
+++ ext/dba/config.m4 2013-08-07 19:18:55.774448348 +0200
@@ -245,7 +245,7 @@
],[
AC_EGREP_CPP(yes,[
#include "$THIS_INCLUDE"
-#if DB_VERSION_MAJOR == $1 || ($1 == 4 && DB_VERSION_MAJOR == 5)
+#if DB_VERSION_MAJOR == $1 || ($1 == 4 && DB_VERSION_MAJOR >= 5)
yes
#endif
],[
--- ext/dba/dba_db4.c 2013-07-03 08:10:53.000000000 +0200
+++ ext/dba/dba_db4.c 2013-08-07 19:19:04.827562638 +0200
@@ -44,7 +44,7 @@
{
TSRMLS_FETCH();
-#if (DB_VERSION_MAJOR == 5 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 8))
+#if (DB_VERSION_MAJOR >= 5 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 8))
/* Bug 51086, Berkeley DB 4.8.26 */
/* This code suppresses a BDB 4.8+ error message, thus keeping PHP test compatibility */
{
--- ext/dba/tests/dba_db4_handlers.phpt 2013-07-03 08:10:53.000000000 +0200
+++ ext/dba/tests/dba_db4_handlers.phpt 2013-08-07 20:39:34.640194224 +0200
@@ -47,4 +47,4 @@
Test 1
Success: db4 enabled
Test 2 - full info
-.*Berkeley DB (4|5).*
+.*Berkeley DB (4|5|6).*
@@ -0,0 +1,33 @@
Description: Disable configure parameters on phpinfo() output
.
Patch needs to be discussed with upstream and the issues that lead to
its addition re-checked. Quoting changelog entry:
.
Add [...], which disables the display of our "Configure Command" in
phpinfo(), which was the source of many bogus bug reports over the
years, due to people misinterpreting its meaning.
Origin: vendor
Forwarded: no
Last-Update: 2010-01-18
--- a/ext/standard/info.c
+++ b/ext/standard/info.c
@@ -704,7 +704,7 @@ PHPAPI void php_print_info(int flag TSRM
#ifdef ARCHITECTURE
php_info_print_table_row(2, "Architecture", ARCHITECTURE);
#endif
-#ifdef CONFIGURE_COMMAND
+#if 0
php_info_print_table_row(2, "Configure Command", CONFIGURE_COMMAND );
#endif
--- a/ext/standard/tests/general_functions/phpinfo.phpt
+++ b/ext/standard/tests/general_functions/phpinfo.phpt
@@ -20,7 +20,6 @@ PHP Version => %s
System => %s
Build Date => %s%a
-Configure Command => %s
Server API => Command Line Interface
Virtual Directory Support => %s
Configuration File (php.ini) Path => %s
@@ -0,0 +1,12 @@
--- php-5.2.14.orig/ext/zip/php_zip.c 2011-01-14 16:12:17.886000067 +0200
+++ php-5.2.14/ext/zip/php_zip.c 2011-01-14 16:14:50.233000067 +0200
@@ -1954,6 +1954,9 @@
PHP_ZIP_STAT_INDEX(intern, index, 0, sb);
comment = zip_get_file_comment(intern, index, &comment_len, (int)flags);
+ if(comment==NULL) {
+ RETURN_FALSE;
+ }
RETURN_STRINGL((char *)comment, (long)comment_len, 1);
}
/* }}} */
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,14 @@
--- php-5.2.14.orig/ext/standard/rand.c 2011-02-07 14:44:55.975000003 +0200
+++ php-5.2.14/ext/standard/rand.c 2011-02-07 16:24:24.017000004 +0200
@@ -322,6 +322,11 @@
php_mt_srand(GENERATE_SEED() TSRMLS_CC);
}
+ if (max < min) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "max(%d) is smaller than min(%d)", max, min);
+ RETURN_FALSE;
+ }
+
/*
* Melo: hmms.. randomMT() returns 32 random bits...
* Yet, the previous php_rand only returns 31 at most.
+522
View File
@@ -0,0 +1,522 @@
;;;;;;;;;;;;;;;;;;;;;
; FPM Configuration ;
;;;;;;;;;;;;;;;;;;;;;
; All relative paths in this configuration file are relative to PHP's install
; prefix (/usr). This prefix can be dynamically changed by using the
; '-p' argument from the command line.
; Include one or more files. If glob(3) exists, it is used to include a bunch of
; files from a glob(3) pattern. This directive can be used everywhere in the
; file.
; Relative path can also be used. They will be prefixed by:
; - the global prefix if it's been set (-p argument)
; - /usr otherwise
;include=etc/fpm.d/*.conf
;;;;;;;;;;;;;;;;;;
; Global Options ;
;;;;;;;;;;;;;;;;;;
[global]
; Pid file
; Note: the default prefix is /var
; Default Value: none
pid = /run/php-fpm.pid
; Error log file
; If it's set to "syslog", log is sent to syslogd instead of being written
; in a local file.
; Note: the default prefix is /var
; Default Value: log/php-fpm.log
error_log = /var/log/php-fpm/php-fpm.log
; syslog_facility is used to specify what type of program is logging the
; message. This lets syslogd specify that messages from different facilities
; will be handled differently.
; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON)
; Default Value: daemon
;syslog.facility = daemon
; syslog_ident is prepended to every message. If you have multiple FPM
; instances running on the same server, you can change the default value
; which must suit common needs.
; Default Value: php-fpm
;syslog.ident = php-fpm
; Log level
; Possible Values: alert, error, warning, notice, debug
; Default Value: notice
;log_level = notice
; If this number of child processes exit with SIGSEGV or SIGBUS within the time
; interval set by emergency_restart_interval then FPM will restart. A value
; of '0' means 'Off'.
; Default Value: 0
;emergency_restart_threshold = 0
; Interval of time used by emergency_restart_interval to determine when
; a graceful restart will be initiated. This can be useful to work around
; accidental corruptions in an accelerator's shared memory.
; Available Units: s(econds), m(inutes), h(ours), or d(ays)
; Default Unit: seconds
; Default Value: 0
;emergency_restart_interval = 0
; Time limit for child processes to wait for a reaction on signals from master.
; Available units: s(econds), m(inutes), h(ours), or d(ays)
; Default Unit: seconds
; Default Value: 0
;process_control_timeout = 0
; The maximum number of processes FPM will fork. This has been design to control
; the global number of processes when using dynamic PM within a lot of pools.
; Use it with caution.
; Note: A value of 0 indicates no limit
; Default Value: 0
; process.max = 128
; Specify the nice(2) priority to apply to the master process (only if set)
; The value can vary from -19 (highest priority) to 20 (lower priority)
; Note: - It will only work if the FPM master process is launched as root
; - The pool process will inherit the master process priority
; unless it specified otherwise
; Default Value: no set
; process.priority = -19
; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging.
; Default Value: yes
daemonize = no
; Set open file descriptor rlimit for the master process.
; Default Value: system defined value
;rlimit_files = 1024
; Set max core size rlimit for the master process.
; Possible Values: 'unlimited' or an integer greater or equal to 0
; Default Value: system defined value
;rlimit_core = 0
; Specify the event mechanism FPM will use. The following is available:
; - select (any POSIX os)
; - poll (any POSIX os)
; - epoll (linux >= 2.5.44)
; - kqueue (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0)
; - /dev/poll (Solaris >= 7)
; - port (Solaris >= 10)
; Default Value: not set (auto detection)
;events.mechanism = epoll
; When FPM is build with systemd integration, specify the interval,
; in second, between health report notification to systemd.
; Set to 0 to disable.
; Available Units: s(econds), m(inutes), h(ours)
; Default Unit: seconds
; Default value: 10
;systemd_interval = 10
;;;;;;;;;;;;;;;;;;;;
; Pool Definitions ;
;;;;;;;;;;;;;;;;;;;;
; Multiple pools of child processes may be started with different listening
; ports and different management options. The name of the pool will be
; used in logs and stats. There is no limitation on the number of pools which
; FPM can handle. Your system will tell you anyway :)
; Start a new pool named 'www'.
; the variable $pool can we used in any directive and will be replaced by the
; pool name ('www' here)
[www]
; Per pool prefix
; It only applies on the following directives:
; - 'slowlog'
; - 'listen' (unixsocket)
; - 'chroot'
; - 'chdir'
; - 'php_values'
; - 'php_admin_values'
; When not set, the global prefix (or /usr) applies instead.
; Note: This directive can also be relative to the global prefix.
; Default Value: none
;prefix = /path/to/pools/$pool
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
user = apache
group = apache
; The address on which to accept FastCGI requests.
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses on a
; specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = 127.0.0.1:9000
; Set listen(2) backlog.
; Default Value: 128 (-1 on FreeBSD and OpenBSD)
;listen.backlog = 128
; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many
; BSD-derived systems allow connections regardless of permissions.
; Default Values: user and group are set as the running user
; mode is set to 0666
;listen.owner = apache
;listen.group = apache
;listen.mode = 0666
; List of ipv4 addresses of FastCGI clients which are allowed to connect.
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
; must be separated by a comma. If this value is left blank, connections will be
; accepted from any ip address.
; Default Value: any
;listen.allowed_clients = 127.0.0.1
; Specify the nice(2) priority to apply to the pool processes (only if set)
; The value can vary from -19 (highest priority) to 20 (lower priority)
; Note: - It will only work if the FPM master process is launched as root
; - The pool processes will inherit the master process priority
; unless it specified otherwise
; Default Value: no set
; priority = -19
; Choose how the process manager will control the number of child processes.
; Possible Values:
; static - a fixed number (pm.max_children) of child processes;
; dynamic - the number of child processes are set dynamically based on the
; following directives. With this process management, there will be
; always at least 1 children.
; pm.max_children - the maximum number of children that can
; be alive at the same time.
; pm.start_servers - the number of children created on startup.
; pm.min_spare_servers - the minimum number of children in 'idle'
; state (waiting to process). If the number
; of 'idle' processes is less than this
; number then some children will be created.
; pm.max_spare_servers - the maximum number of children in 'idle'
; state (waiting to process). If the number
; of 'idle' processes is greater than this
; number then some children will be killed.
; ondemand - no children are created at startup. Children will be forked when
; new requests will connect. The following parameter are used:
; pm.max_children - the maximum number of children that
; can be alive at the same time.
; pm.process_idle_timeout - The number of seconds after which
; an idle process will be killed.
; Note: This value is mandatory.
pm = dynamic
; The number of child processes to be created when pm is set to 'static' and the
; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
; This value sets the limit on the number of simultaneous requests that will be
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
; CGI. The below defaults are based on a server without much resources. Don't
; forget to tweak pm.* to fit your needs.
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
; Note: This value is mandatory.
pm.max_children = 5
; The number of child processes created on startup.
; Note: Used only when pm is set to 'dynamic'
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
pm.start_servers = 2
; The desired minimum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.min_spare_servers = 1
; The desired maximum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.max_spare_servers = 3
; The number of seconds after which an idle process will be killed.
; Note: Used only when pm is set to 'ondemand'
; Default Value: 10s
;pm.process_idle_timeout = 10s;
; The number of requests each child process should execute before respawning.
; This can be useful to work around memory leaks in 3rd party libraries. For
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
; Default Value: 0
;pm.max_requests = 500
; The URI to view the FPM status page. If this value is not set, no URI will be
; recognized as a status page. It shows the following informations:
; pool - the name of the pool;
; process manager - static, dynamic or ondemand;
; start time - the date and time FPM has started;
; start since - number of seconds since FPM has started;
; accepted conn - the number of request accepted by the pool;
; listen queue - the number of request in the queue of pending
; connections (see backlog in listen(2));
; max listen queue - the maximum number of requests in the queue
; of pending connections since FPM has started;
; listen queue len - the size of the socket queue of pending connections;
; idle processes - the number of idle processes;
; active processes - the number of active processes;
; total processes - the number of idle + active processes;
; max active processes - the maximum number of active processes since FPM
; has started;
; max children reached - number of times, the process limit has been reached,
; when pm tries to start more children (works only for
; pm 'dynamic' and 'ondemand');
; Value are updated in real time.
; Example output:
; pool: www
; process manager: static
; start time: 01/Jul/2011:17:53:49 +0200
; start since: 62636
; accepted conn: 190460
; listen queue: 0
; max listen queue: 1
; listen queue len: 42
; idle processes: 4
; active processes: 11
; total processes: 15
; max active processes: 12
; max children reached: 0
;
; By default the status page output is formatted as text/plain. Passing either
; 'html', 'xml' or 'json' in the query string will return the corresponding
; output syntax. Example:
; http://www.foo.bar/status
; http://www.foo.bar/status?json
; http://www.foo.bar/status?html
; http://www.foo.bar/status?xml
;
; By default the status page only outputs short status. Passing 'full' in the
; query string will also return status for each pool process.
; Example:
; http://www.foo.bar/status?full
; http://www.foo.bar/status?json&full
; http://www.foo.bar/status?html&full
; http://www.foo.bar/status?xml&full
; The Full status returns for each process:
; pid - the PID of the process;
; state - the state of the process (Idle, Running, ...);
; start time - the date and time the process has started;
; start since - the number of seconds since the process has started;
; requests - the number of requests the process has served;
; request duration - the duration in µs of the requests;
; request method - the request method (GET, POST, ...);
; request URI - the request URI with the query string;
; content length - the content length of the request (only with POST);
; user - the user (PHP_AUTH_USER) (or '-' if not set);
; script - the main script called (or '-' if not set);
; last request cpu - the %cpu the last request consumed
; it's always 0 if the process is not in Idle state
; because CPU calculation is done when the request
; processing has terminated;
; last request memory - the max amount of memory the last request consumed
; it's always 0 if the process is not in Idle state
; because memory calculation is done when the request
; processing has terminated;
; If the process is in Idle state, then informations are related to the
; last request the process has served. Otherwise informations are related to
; the current request being served.
; Example output:
; ************************
; pid: 31330
; state: Running
; start time: 01/Jul/2011:17:53:49 +0200
; start since: 63087
; requests: 12808
; request duration: 1250261
; request method: GET
; request URI: /test_mem.php?N=10000
; content length: 0
; user: -
; script: /home/fat/web/docs/php/test_mem.php
; last request cpu: 0.00
; last request memory: 0
;
; Note: There is a real-time FPM status monitoring sample web page available
; It's available in: /usr/share/fpm/status.html
;
; Note: The value must start with a leading slash (/). The value can be
; anything, but it may not be a good idea to use the .php extension or it
; may conflict with a real PHP file.
; Default Value: not set
;pm.status_path = /status
; The ping URI to call the monitoring page of FPM. If this value is not set, no
; URI will be recognized as a ping page. This could be used to test from outside
; that FPM is alive and responding, or to
; - create a graph of FPM availability (rrd or such);
; - remove a server from a group if it is not responding (load balancing);
; - trigger alerts for the operating team (24/7).
; Note: The value must start with a leading slash (/). The value can be
; anything, but it may not be a good idea to use the .php extension or it
; may conflict with a real PHP file.
; Default Value: not set
;ping.path = /ping
; This directive may be used to customize the response of a ping request. The
; response is formatted as text/plain with a 200 response code.
; Default Value: pong
;ping.response = pong
; The access log file
; Default: not set
;access.log = log/$pool.access.log
; The access log format.
; The following syntax is allowed
; %%: the '%' character
; %C: %CPU used by the request
; it can accept the following format:
; - %{user}C for user CPU only
; - %{system}C for system CPU only
; - %{total}C for user + system CPU (default)
; %d: time taken to serve the request
; it can accept the following format:
; - %{seconds}d (default)
; - %{miliseconds}d
; - %{mili}d
; - %{microseconds}d
; - %{micro}d
; %e: an environment variable (same as $_ENV or $_SERVER)
; it must be associated with embraces to specify the name of the env
; variable. Some exemples:
; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e
; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e
; %f: script filename
; %l: content-length of the request (for POST request only)
; %m: request method
; %M: peak of memory allocated by PHP
; it can accept the following format:
; - %{bytes}M (default)
; - %{kilobytes}M
; - %{kilo}M
; - %{megabytes}M
; - %{mega}M
; %n: pool name
; %o: output header
; it must be associated with embraces to specify the name of the header:
; - %{Content-Type}o
; - %{X-Powered-By}o
; - %{Transfert-Encoding}o
; - ....
; %p: PID of the child that serviced the request
; %P: PID of the parent of the child that serviced the request
; %q: the query string
; %Q: the '?' character if query string exists
; %r: the request URI (without the query string, see %q and %Q)
; %R: remote IP address
; %s: status (response code)
; %t: server time the request was received
; it can accept a strftime(3) format:
; %d/%b/%Y:%H:%M:%S %z (default)
; %T: time the log has been written (the request has finished)
; it can accept a strftime(3) format:
; %d/%b/%Y:%H:%M:%S %z (default)
; %u: remote user
;
; Default: "%R - %u %t \"%m %r\" %s"
;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"
; The log file for slow requests
; Default Value: not set
; Note: slowlog is mandatory if request_slowlog_timeout is set
slowlog = /var/log/php-fpm/www-slow.log
; The timeout for serving a single request after which a PHP backtrace will be
; dumped to the 'slowlog' file. A value of '0s' means 'off'.
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0
;request_slowlog_timeout = 0
; The timeout for serving a single request after which the worker process will
; be killed. This option should be used when the 'max_execution_time' ini option
; does not stop script execution for some reason. A value of '0' means 'off'.
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0
;request_terminate_timeout = 0
; Set open file descriptor rlimit.
; Default Value: system defined value
;rlimit_files = 1024
; Set max core size rlimit.
; Possible Values: 'unlimited' or an integer greater or equal to 0
; Default Value: system defined value
;rlimit_core = 0
; Chroot to this directory at the start. This value must be defined as an
; absolute path. When this value is not set, chroot is not used.
; Note: you can prefix with '$prefix' to chroot to the pool prefix or one
; of its subdirectories. If the pool prefix is not set, the global prefix
; will be used instead.
; Note: chrooting is a great security feature and should be used whenever
; possible. However, all PHP paths will be relative to the chroot
; (error_log, sessions.save_path, ...).
; Default Value: not set
;chroot =
; Chdir to this directory at the start.
; Note: relative path can be used.
; Default Value: current directory or / when chroot
;chdir = /var/www
; Redirect worker stdout and stderr into main error log. If not set, stdout and
; stderr will be redirected to /dev/null according to FastCGI specs.
; Note: on highloaded environement, this can cause some delay in the page
; process time (several ms).
; Default Value: no
;catch_workers_output = yes
; Limits the extensions of the main script FPM will allow to parse. This can
; prevent configuration mistakes on the web server side. You should only limit
; FPM to .php extensions to prevent malicious users to use other extensions to
; exectute php code.
; Note: set an empty value to allow all extensions.
; Default Value: .php
;security.limit_extensions = .php .php3 .php4 .php5
; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
; the current environment.
; Default Value: clean env
;env[HOSTNAME] = $HOSTNAME
;env[PATH] = /usr/local/bin:/usr/bin:/bin
;env[TMP] = /tmp
;env[TMPDIR] = /tmp
;env[TEMP] = /tmp
; Additional php.ini defines, specific to this pool of workers. These settings
; overwrite the values previously defined in the php.ini. The directives are the
; same as the PHP SAPI:
; php_value/php_flag - you can set classic ini defines which can
; be overwritten from PHP call 'ini_set'.
; php_admin_value/php_admin_flag - these directives won't be overwritten by
; PHP call 'ini_set'
; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.
; Defining 'extension' will load the corresponding shared extension from
; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
; overwrite previously defined php.ini values, but will append the new value
; instead.
; Note: path INI options can be relative and will be expanded with the prefix
; (pool, global or /usr)
; Default Value: nothing is defined by default except the values in php.ini and
; specified at startup with the -d argument
;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
;php_flag[display_errors] = off
;php_admin_value[error_log] = /var/log/fpm-php.www.log
;php_admin_flag[log_errors] = on
;php_admin_value[memory_limit] = 32M
; Set session path to a directory owned by process user
php_value[session.save_handler] = files
php_value[session.save_path] = /tmp
@@ -0,0 +1,302 @@
diff -Naurp php-5.3.4RC1/ext/imap/php_imap.c php-5.3.4RC1.oden/ext/imap/php_imap.c
--- php-5.3.4RC1/ext/imap/php_imap.c 2010-11-18 16:22:22.000000000 +0100
+++ php-5.3.4RC1.oden/ext/imap/php_imap.c 2010-11-22 10:01:42.538863104 +0100
@@ -164,6 +164,22 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_geta
ZEND_ARG_INFO(0, mailbox)
ZEND_END_ARG_INFO()
#endif
+#if defined(HAVE_IMAP2005)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_setannotation, 0, 0, 5)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_INFO(0, mailbox)
+ ZEND_ARG_INFO(0, entry)
+ ZEND_ARG_INFO(0, attr)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_getannotation, 0, 0, 4)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_INFO(0, mailbox)
+ ZEND_ARG_INFO(0, entry)
+ ZEND_ARG_INFO(0, attr)
+ZEND_END_ARG_INFO()
+#endif
ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_expunge, 0, 0, 1)
ZEND_ARG_INFO(0, stream_id)
@@ -408,6 +424,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_stat
ZEND_ARG_INFO(0, options)
ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_status_current, 0, 0, 2)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_INFO(0, options)
+ZEND_END_ARG_INFO()
+
ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_bodystruct, 0, 0, 3)
ZEND_ARG_INFO(0, stream_id)
ZEND_ARG_INFO(0, msg_no)
@@ -507,6 +528,7 @@ const zend_function_entry imap_functions
PHP_FE(imap_binary, arginfo_imap_binary)
PHP_FE(imap_utf8, arginfo_imap_utf8)
PHP_FE(imap_status, arginfo_imap_status)
+ PHP_FE(imap_status_current, arginfo_imap_status_current)
PHP_FE(imap_mailboxmsginfo, arginfo_imap_mailboxmsginfo)
PHP_FE(imap_setflag_full, arginfo_imap_setflag_full)
PHP_FE(imap_clearflag_full, arginfo_imap_clearflag_full)
@@ -537,6 +559,10 @@ const zend_function_entry imap_functions
PHP_FE(imap_setacl, arginfo_imap_setacl)
PHP_FE(imap_getacl, arginfo_imap_getacl)
#endif
+#if defined(HAVE_IMAP2005)
+ PHP_FE(imap_setannotation, arginfo_imap_setannotation)
+ PHP_FE(imap_getannotation, arginfo_imap_getannotation)
+#endif
PHP_FE(imap_mail, arginfo_imap_mail)
@@ -798,6 +824,30 @@ void mail_getacl(MAILSTREAM *stream, cha
/* }}} */
#endif
+#if defined(HAVE_IMAP2005)
+/* {{{ mail_getannotation
+ *
+ * Mail GET_ANNOTATION callback
+ * Called via the mail_parameter function in c-client:src/c-client/mail.c
+ */
+void mail_getannotation(MAILSTREAM *stream, ANNOTATION *alist)
+{
+ ANNOTATION_VALUES *cur;
+
+ TSRMLS_FETCH();
+
+ /* walk through the ANNOTATION_VALUES */
+
+ for(cur = alist->values; cur; cur = cur->next) {
+ if (cur->value)
+ add_assoc_stringl(IMAPG(imap_annotation_list), cur->attr, cur->value, strlen(cur->value), 1);
+ else
+ add_assoc_stringl(IMAPG(imap_annotation_list), cur->attr, "", 0, 1);
+ }
+}
+/* }}} */
+#endif
+
/* {{{ PHP_GINIT_FUNCTION
*/
static PHP_GINIT_FUNCTION(imap)
@@ -823,6 +873,7 @@ static PHP_GINIT_FUNCTION(imap)
#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
imap_globals->quota_return = NIL;
imap_globals->imap_acl_list = NIL;
+ imap_globals->imap_annotation_list = NIL;
#endif
imap_globals->gets_stream = NIL;
}
@@ -1547,7 +1598,119 @@ PHP_FUNCTION(imap_getacl)
}
/* }}} */
#endif /* HAVE_IMAP2000 || HAVE_IMAP2001 */
+
+#if defined(HAVE_IMAP2005)
+
+/* {{{ proto bool imap_setannotation(resource stream_id, string mailbox, string entry, string attr, string value)
+ Sets an annotation for a given mailbox */
+PHP_FUNCTION(imap_setannotation)
+{
+ zval **streamind, **mailbox, **entry, **attr, **value;
+ pils *imap_le_struct;
+ long ret;
+
+ // TODO: Use zend_parse_parameters here
+ if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &streamind, &mailbox, &entry, &attr, &value) == FAILURE) {
+ ZEND_WRONG_PARAM_COUNT();
+ }
+
+ ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
+
+ convert_to_string_ex(mailbox);
+ convert_to_string_ex(entry);
+ convert_to_string_ex(attr);
+ convert_to_string_ex(value);
+
+ // create annotation object
+ ANNOTATION *annotation = mail_newannotation();
+ if (!annotation)
+ RETURN_FALSE;
+ annotation->values = mail_newannotationvalue();
+ if (!annotation->values) {
+ mail_free_annotation(&annotation);
+ RETURN_FALSE;
+ }
+
+ // fill in annotation values
+ annotation->mbox = Z_STRVAL_PP(mailbox);
+ annotation->entry = Z_STRVAL_PP(entry);
+ annotation->values->attr = Z_STRVAL_PP(attr);
+ annotation->values->value = Z_STRVAL_PP(value);
+
+ ret = imap_setannotation(imap_le_struct->imap_stream, annotation);
+
+ // make sure mail_free_annotation doesn't free our variables
+ annotation->mbox = NULL;
+ annotation->entry = NULL;
+ annotation->values->attr = NULL;
+ annotation->values->value = NULL;
+ mail_free_annotation(&annotation);
+
+ RETURN_BOOL(ret);
+}
+/* }}} */
+
+/* {{{ proto array imap_getannotation(resource stream_id, string mailbox, string entry, string attr)
+ Gets the ACL for a given mailbox */
+PHP_FUNCTION(imap_getannotation)
+{
+ zval **streamind, **mailbox, **entry, **attr;
+ pils *imap_le_struct;
+ long ret;
+
+ if(ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &streamind, &mailbox, &entry, &attr) == FAILURE) {
+ ZEND_WRONG_PARAM_COUNT();
+ }
+ ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
+
+ convert_to_string_ex(mailbox);
+ convert_to_string_ex(entry);
+ convert_to_string_ex(attr);
+
+ /* initializing the special array for the return values */
+ if (array_init(return_value) == FAILURE) {
+ RETURN_FALSE;
+ }
+
+ // fillup calling parameters
+ STRINGLIST *entries = mail_newstringlist();
+ if (!entries)
+ RETURN_FALSE;
+
+ STRINGLIST *cur = entries;
+ cur->text.data = (unsigned char *)cpystr(Z_STRVAL_PP(entry));
+ cur->text.size = Z_STRLEN_PP(entry);
+ cur->next = NIL;
+
+ STRINGLIST *attributes = mail_newstringlist();
+ if (!attributes)
+ RETURN_FALSE;
+ cur = attributes;
+ cur->text.data = (unsigned char *)cpystr (Z_STRVAL_PP(attr));
+ cur->text.size = Z_STRLEN_PP(attr);
+ cur->next = NIL;
+
+ IMAPG(imap_annotation_list) = return_value;
+
+ /* set the callback for the GET_ANNOTATION function */
+ mail_parameters(NIL, SET_ANNOTATION, (void *) mail_getannotation);
+ ret = imap_getannotation(imap_le_struct->imap_stream, Z_STRVAL_PP(mailbox), entries, attributes);
+
+ mail_free_stringlist(&entries);
+ mail_free_stringlist(&attributes);
+
+ if (!ret) {
+ zval_dtor(return_value);
+ RETURN_FALSE;
+ }
+
+ IMAPG(imap_annotation_list) = NIL;
+}
+/* }}} */
+
+#endif /* HAVE_IMAP2005 */
+
/* {{{ proto bool imap_expunge(resource stream_id)
Permanently delete all messages marked for deletion */
PHP_FUNCTION(imap_expunge)
@@ -3190,6 +3353,42 @@ PHP_FUNCTION(imap_msgno)
}
/* }}} */
+/* {{{ proto object imap_status_current(resource stream_id, int options)
+ Get (cached) status info from current mailbox */
+PHP_FUNCTION(imap_status_current)
+{
+ zval **streamind, **pflags;
+ pils *imap_le_struct;
+ long flags = 0L;
+
+ if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind, &pflags) == FAILURE) {
+ ZEND_WRONG_PARAM_COUNT();
+ }
+
+ ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
+
+ convert_to_long_ex(pflags);
+ flags = Z_LVAL_PP(pflags);
+
+ if (object_init(return_value) == FAILURE) {
+ RETURN_FALSE;
+ }
+
+ if (flags & SA_MESSAGES) {
+ add_property_long(return_value, "messages", imap_le_struct->imap_stream->nmsgs);
+ }
+ if (flags & SA_RECENT) {
+ add_property_long(return_value, "recent", imap_le_struct->imap_stream->recent);
+ }
+ if (flags & SA_UIDNEXT) {
+ add_property_long(return_value, "uidnext", imap_le_struct->imap_stream->uid_last+1);
+ }
+ if (flags & SA_UIDVALIDITY) {
+ add_property_long(return_value, "uidvalidity", imap_le_struct->imap_stream->uid_validity);
+ }
+}
+/* }}} */
+
/* {{{ proto object imap_status(resource stream_id, string mailbox, int options)
Get status info from a mailbox */
PHP_FUNCTION(imap_status)
diff -Naurp php-5.3.4RC1/ext/imap/php_imap.h php-5.3.4RC1.oden/ext/imap/php_imap.h
--- php-5.3.4RC1/ext/imap/php_imap.h 2010-01-03 10:23:27.000000000 +0100
+++ php-5.3.4RC1.oden/ext/imap/php_imap.h 2010-11-22 10:01:42.542862889 +0100
@@ -153,6 +153,7 @@ PHP_FUNCTION(imap_lsub);
PHP_FUNCTION(imap_lsub_full);
PHP_FUNCTION(imap_create);
PHP_FUNCTION(imap_rename);
+PHP_FUNCTION(imap_status_current);
PHP_FUNCTION(imap_status);
PHP_FUNCTION(imap_bodystruct);
PHP_FUNCTION(imap_fetch_overview);
@@ -173,6 +174,9 @@ PHP_FUNCTION(imap_mime_header_decode);
PHP_FUNCTION(imap_thread);
PHP_FUNCTION(imap_timeout);
+// TODO: Needs fixing in configure in
+#define HAVE_IMAP2005 1
+
#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
PHP_FUNCTION(imap_get_quota);
PHP_FUNCTION(imap_get_quotaroot);
@@ -180,7 +184,10 @@ PHP_FUNCTION(imap_set_quota);
PHP_FUNCTION(imap_setacl);
PHP_FUNCTION(imap_getacl);
#endif
-
+#if defined(HAVE_IMAP2005)
+PHP_FUNCTION(imap_setannotation);
+PHP_FUNCTION(imap_getannotation);
+#endif
ZEND_BEGIN_MODULE_GLOBALS(imap)
char *imap_user;
@@ -211,6 +218,9 @@ ZEND_BEGIN_MODULE_GLOBALS(imap)
zval **quota_return;
zval *imap_acl_list;
#endif
+#if defined(HAVE_IMAP2005)
+ zval *imap_annotation_list;
+#endif
/* php_stream for php_mail_gets() */
php_stream *gets_stream;
ZEND_END_MODULE_GLOBALS(imap)
@@ -0,0 +1,92 @@
diff -Naurp php-5.3.4RC1/ext/imap/php_imap.c php-5.3.4RC1.oden/ext/imap/php_imap.c
--- php-5.3.4RC1/ext/imap/php_imap.c 2010-11-22 10:39:59.349863220 +0100
+++ php-5.3.4RC1.oden/ext/imap/php_imap.c 2010-11-22 10:40:14.709956619 +0100
@@ -163,6 +163,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_geta
ZEND_ARG_INFO(0, stream_id)
ZEND_ARG_INFO(0, mailbox)
ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_myrights, 0, 0, 2)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_INFO(0, mailbox)
+ZEND_END_ARG_INFO()
#endif
#if defined(HAVE_IMAP2005)
ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_setannotation, 0, 0, 5)
@@ -558,6 +563,7 @@ const zend_function_entry imap_functions
PHP_FE(imap_set_quota, arginfo_imap_set_quota)
PHP_FE(imap_setacl, arginfo_imap_setacl)
PHP_FE(imap_getacl, arginfo_imap_getacl)
+ PHP_FE(imap_myrights, arginfo_imap_myrights)
#endif
#if defined(HAVE_IMAP2005)
PHP_FE(imap_setannotation, arginfo_imap_setannotation)
@@ -822,6 +828,20 @@ void mail_getacl(MAILSTREAM *stream, cha
}
}
/* }}} */
+
+/* {{{ mail_myrights
+ *
+ * Mail MYRIGHTS callback
+ * Called via the mail_parameter function in c-client:src/c-client/mail.c
+ */
+void mail_myrights(MAILSTREAM *stream, char *mailbox, char *rights)
+{
+ TSRMLS_FETCH();
+
+ ZVAL_STRING(IMAPG(imap_acl_list), rights, 1);
+
+}
+/* }}} */
#endif
#if defined(HAVE_IMAP2005)
@@ -1597,6 +1617,36 @@ PHP_FUNCTION(imap_getacl)
IMAPG(imap_acl_list) = NIL;
}
/* }}} */
+
+/* {{{ proto string imap_myrights(resource stream_id, string mailbox)
+ Gets my rights (ACL) for a given mailbox */
+PHP_FUNCTION(imap_myrights)
+{
+ zval **streamind, **mailbox;
+ pils *imap_le_struct;
+
+ if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind, &mailbox) == FAILURE) {
+ ZEND_WRONG_PARAM_COUNT();
+ }
+
+ ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
+
+ convert_to_string_ex(mailbox);
+
+ IMAPG(imap_acl_list) = return_value;
+
+ /* set the callback for the GET_ACL function */
+ mail_parameters(NIL, SET_MYRIGHTS, (void *) mail_myrights);
+ if(!imap_myrights(imap_le_struct->imap_stream, Z_STRVAL_PP(mailbox))) {
+ php_error(E_WARNING, "c-client imap_myrights failed");
+ zval_dtor(return_value);
+ RETURN_FALSE;
+ }
+
+ IMAPG(imap_acl_list) = NIL;
+}
+/* }}} */
+
#endif /* HAVE_IMAP2000 || HAVE_IMAP2001 */
#if defined(HAVE_IMAP2005)
diff -Naurp php-5.3.4RC1/ext/imap/php_imap.h php-5.3.4RC1.oden/ext/imap/php_imap.h
--- php-5.3.4RC1/ext/imap/php_imap.h 2010-11-22 10:39:59.349863220 +0100
+++ php-5.3.4RC1.oden/ext/imap/php_imap.h 2010-11-22 10:40:14.709956619 +0100
@@ -183,6 +183,7 @@ PHP_FUNCTION(imap_get_quotaroot);
PHP_FUNCTION(imap_set_quota);
PHP_FUNCTION(imap_setacl);
PHP_FUNCTION(imap_getacl);
+PHP_FUNCTION(imap_myrights);
#endif
#if defined(HAVE_IMAP2005)
PHP_FUNCTION(imap_setannotation);
@@ -0,0 +1,15 @@
--- ext/imap/config.m4 2006-01-23 23:55:13.000000000 +0200
+++ ext.orig/imap/config.m4 2006-01-23 23:56:08.000000000 +0200
@@ -146,12 +146,6 @@
AC_MSG_ERROR(Cannot find rfc822.h. Please check your c-client installation.)
fi
- if test -r "$IMAP_DIR/c-client/c-client.a"; then
- ln -s "$IMAP_DIR/c-client/c-client.a" "$IMAP_DIR/c-client/libc-client.a" >/dev/null 2>&1
- elif test -r "$IMAP_DIR/$PHP_LIBDIR/c-client.a"; then
- ln -s "$IMAP_DIR/$PHP_LIBDIR/c-client.a" "$IMAP_DIR/$PHP_LIBDIR/libc-client.a" >/dev/null 2>&1
- fi
-
for lib in c-client4 c-client imap; do
IMAP_LIB=$lib
IMAP_LIB_CHK($PHP_LIBDIR)
@@ -0,0 +1,14 @@
--- php-5.2.14.orig/ext/gd/gd.c 2011-01-26 12:38:42.956023043 +0200
+++ php-5.2.14/ext/gd/gd.c 2011-01-26 13:37:21.171023045 +0200
@@ -4593,6 +4593,11 @@
return;
}
+ if (aa_steps != 4 && aa_steps != 16) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Antialias steps must be 4 or 16");
+ RETURN_FALSE;
+ }
+
ZEND_FETCH_RESOURCE(bg_img, gdImagePtr, &img, -1, "Image", le_gd);
ZEND_FETCH_RESOURCE(f_ind, int *, &fnt, -1, "Type 1 font", le_ps_font);
@@ -0,0 +1,265 @@
Index: ext/date/lib/parse_tz.c
===================================================================
RCS file: /repository/php-src/ext/date/lib/parse_tz.c,v
retrieving revision 1.35
diff -u -r1.35 parse_tz.c
--- ext/date/lib/parse_tz.c 31 Dec 2007 07:12:08 -0000 1.35
+++ ext/date/lib/parse_tz.c 10 Jan 2008 11:42:15 -0000
@@ -20,6 +20,16 @@
#include "timelib.h"
+#ifdef HAVE_SYSTEM_TZDATA
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <limits.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include "php_scandir.h"
+#endif
+
#include <stdio.h>
#ifdef HAVE_STRING_H
@@ -27,7 +37,10 @@
#else
#include <strings.h>
#endif
+
+#ifndef HAVE_SYSTEM_TZDATA
#include "timezonedb.h"
+#endif
#if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__))
# if defined(__LITTLE_ENDIAN__)
@@ -202,6 +215,195 @@
}
}
+#ifdef HAVE_SYSTEM_TZDATA
+
+#ifdef HAVE_SYSTEM_TZDATA_PREFIX
+#define ZONEINFO_PREFIX HAVE_SYSTEM_TZDATA_PREFIX
+#else
+#define ZONEINFO_PREFIX "/usr/share/zoneinfo"
+#endif
+
+static const timelib_tzdb *timezonedb_system = NULL;
+
+/* Filter out some non-tzdata files and the posix/right databases, if
+ * present. */
+static int index_filter(const struct dirent *ent)
+{
+ return strcmp(ent->d_name, ".") != 0
+ && strcmp(ent->d_name, "..") != 0
+ && strcmp(ent->d_name, "posix") != 0
+ && strcmp(ent->d_name, "posixrules") != 0
+ && strcmp(ent->d_name, "right") != 0
+ && strstr(ent->d_name, ".tab") == NULL;
+}
+
+/* Create the zone identifier index by trawling the filesystem. */
+static void create_zone_index(timelib_tzdb *db)
+{
+ size_t dirstack_size, dirstack_top;
+ size_t index_size, index_next;
+ timelib_tzdb_index_entry *db_index;
+ char **dirstack;
+
+ /* LIFO stack to hold directory entres to scan; each slot is a
+ * directory name relative to the zoneinfo prefix. */
+ dirstack_size = 32;
+ dirstack = malloc(dirstack_size * sizeof *dirstack);
+ dirstack_top = 1;
+ dirstack[0] = strdup("");
+
+ /* Index array. */
+ index_size = 64;
+ db_index = malloc(index_size * sizeof *db_index);
+ index_next = 0;
+
+ do {
+ struct dirent **ents;
+ char name[PATH_MAX], *top;
+ int count;
+
+ /* Pop the top stack entry, and iterate through its contents. */
+ top = dirstack[--dirstack_top];
+ snprintf(name, sizeof name, ZONEINFO_PREFIX "/%s", top);
+
+ count = php_scandir(name, &ents, index_filter, php_alphasort);
+
+ while (count > 0) {
+ struct stat st;
+ const char *leaf = ents[count - 1]->d_name;
+
+ snprintf(name, sizeof name, ZONEINFO_PREFIX "/%s/%s",
+ top, leaf);
+
+ if (strlen(name) && stat(name, &st) == 0) {
+ /* Name, relative to the zoneinfo prefix. */
+ const char *root = top;
+
+ if (root[0] == '/') root++;
+
+ snprintf(name, sizeof name, "%s%s%s", root,
+ *root ? "/": "", leaf);
+
+ if (S_ISDIR(st.st_mode)) {
+ if (dirstack_top == dirstack_size) {
+ dirstack_size *= 2;
+ dirstack = realloc(dirstack,
+ dirstack_size * sizeof *dirstack);
+ }
+ dirstack[dirstack_top++] = strdup(name);
+ }
+ else {
+ if (index_next == index_size) {
+ index_size *= 2;
+ db_index = realloc(db_index,
+ index_size * sizeof *db_index);
+ }
+
+ db_index[index_next].id = strdup(name);
+ db_index[index_next++].pos = 0;
+ }
+ }
+
+ free(ents[--count]);
+ }
+
+ free(ents);
+ free(top);
+ } while (dirstack_top);
+
+ db->index = db_index;
+ db->index_size = index_next;
+
+ free(dirstack);
+}
+
+/* Return the mmap()ed tzfile if found, else NULL. On success, the
+ * length of the mapped data is placed in *length. */
+static char *map_tzfile(const char *timezone, size_t *length)
+{
+ char fname[PATH_MAX];
+ struct stat st;
+ char *p;
+ int fd;
+
+ if (strstr(timezone, "..") != NULL) {
+ return NULL;
+ }
+
+ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", timezone);
+
+ fd = open(fname, O_RDONLY);
+ if (fd == -1) {
+ return NULL;
+ } else if (fstat(fd, &st) != 0 || st.st_size < 21) {
+ close(fd);
+ return NULL;
+ }
+
+ *length = st.st_size;
+ p = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
+ close(fd);
+
+ return p != MAP_FAILED ? p : NULL;
+}
+
+const timelib_tzdb *timelib_builtin_db(void)
+{
+ if (timezonedb_system == NULL) {
+ timelib_tzdb *tmp = malloc(sizeof *tmp);
+
+ tmp->version = "0.system";
+ tmp->data = NULL;
+ create_zone_index(tmp);
+ timezonedb_system = tmp;
+ }
+
+ return timezonedb_system;
+}
+
+const timelib_tzdb_index_entry *timelib_timezone_builtin_identifiers_list(int *count)
+{
+ *count = timezonedb_system->index_size;
+ return timezonedb_system->index;
+}
+
+int timelib_timezone_id_is_valid(char *timezone, const timelib_tzdb *tzdb)
+{
+ char fname[PATH_MAX];
+
+ if (strstr(timezone, "..") != NULL) {
+ return 0;
+ }
+
+ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", timezone);
+
+ return access(fname, R_OK) == 0 ? 1 : 0;
+}
+
+timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb)
+{
+ char *tzf, *orig;
+ timelib_tzinfo *tmp;
+ size_t len;
+
+ orig = map_tzfile(timezone, &len);
+ if (orig == NULL) {
+ return NULL;
+ }
+
+ tmp = timelib_tzinfo_ctor(timezone);
+
+ tzf = orig + 20;
+ read_header(&tzf, tmp);
+ read_transistions(&tzf, tmp);
+ read_types(&tzf, tmp);
+
+ munmap(orig, len);
+
+ return tmp;
+}
+#else /* !HAVE_SYSTEM_TZDATA */
+
static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const timelib_tzdb *tzdb)
{
int left = 0, right = tzdb->index_size - 1;
@@ -258,6 +460,7 @@
return tmp;
}
+#endif
static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib_sll *transition_time)
{
Index: ext/date/lib/timelib.m4
===================================================================
RCS file: /repository/php-src/ext/date/lib/timelib.m4,v
retrieving revision 1.4
diff -u -r1.4 timelib.m4
--- ext/date/lib/timelib.m4 3 Jul 2005 23:30:52 -0000 1.4
+++ ext/date/lib/timelib.m4 10 Jan 2008 11:42:16 -0000
@@ -78,3 +78,17 @@
dnl Check for strtoll, atoll
AC_CHECK_FUNCS(strtoll atoll strftime)
+
+PHP_ARG_WITH(system-tzdata, for use of system timezone data,
+[ --with-system-tzdata[=DIR] to specify use of system timezone data],
+no, no)
+
+if test "$PHP_SYSTEM_TZDATA" != "no"; then
+ AC_DEFINE(HAVE_SYSTEM_TZDATA, 1, [Define if system timezone data is used])
+
+ if test "$PHP_SYSTEM_TZDATA" != "yes"; then
+ AC_DEFINE_UNQUOTED(HAVE_SYSTEM_TZDATA_PREFIX, "$PHP_SYSTEM_TZDATA",
+ [Define for location of system timezone data])
+ fi
+fi
+