Ticket #198: xcache-1.2.2-stream-patch

File xcache-1.2.2-stream-patch, 909 bytes (added by hlang, 2 years ago)

patch cache php modul streams in xcache version 1.2.x

Line 
1diff -u -r -N xcache-1.2.2/xcache.c xcache-1.2.2-patch/xcache.c
2--- xcache-1.2.2/xcache.c   2007-12-28 17:00:00.000000000 +0100
3+++ xcache-1.2.2-patch/xcache.c 2008-10-02 12:38:06.000000000 +0200
4@@ -727,6 +727,21 @@
5    php = xce->data.php;
6 
7    if (XG(stat)) {
8+
9+#ifdef ZEND_ENGINE_2
10+       php_stream_statbuf ssb;
11+       php_stream_wrapper *wrapper = NULL;
12+       char *path_for_open = NULL;
13+
14+       wrapper = php_stream_locate_url_wrapper(filename, &path_for_open, 0 TSRMLS_CC);
15+       if ((wrapper) && (wrapper->wops) && (wrapper->wops->url_stat) &&
16+           (wrapper != &php_plain_files_wrapper) &&
17+           (SUCCESS == wrapper->wops->url_stat(wrapper, path_for_open, PHP_STREAM_URL_STAT_QUIET, &ssb, NULL TSRMLS_CC))) {
18+           pbuf = &ssb.sb;
19+           goto stat_done;
20+       }
21+#endif
22+
23        if (strcmp(SG(request_info).path_translated, filename) == 0) {
24            /* sapi has already done this stat() for us */
25            pbuf = sapi_get_stat(TSRMLS_C);