Ticket #198: xcache-1.3.2-stream-patch

File xcache-1.3.2-stream-patch, 1.1 KB (added by hlang, 2 years ago)

patch cache php modul streams in xcache version 1.3.x

Line 
1diff -u -r -N xcache-1.3.2/xcache.c xcache-1.3.2-patch/xcache.c
2--- xcache-1.3.2/xcache.c   2011-06-04 04:41:40.000000000 +0200
3+++ xcache-1.3.2-patch/xcache.c 2012-01-09 13:23:34.000000000 +0100
4@@ -828,13 +828,29 @@
5        return FAILURE;
6    }
7 
8+/*
9    if (strstr(filename, "://") != NULL) {
10        return FAILURE;
11    }
12+*/
13 
14    php = xce->data.php;
15 
16    if (XG(stat)) {
17+#ifdef ZEND_ENGINE_2
18+                php_stream_statbuf ssb;
19+                php_stream_wrapper *wrapper = NULL;
20+                char *path_for_open = NULL;
21+
22+                wrapper = php_stream_locate_url_wrapper(filename, &path_for_open, 0 TSRMLS_CC);
23+                if ((wrapper) && (wrapper->wops) && (wrapper->wops->url_stat) &&
24+                    (wrapper != &php_plain_files_wrapper) &&
25+                    (SUCCESS == wrapper->wops->url_stat(wrapper, path_for_open, PHP_STREAM_URL_STAT_QUIET, &ssb, NULL TSRMLS_CC))) {
26+                        pbuf = &ssb.sb;
27+                        goto stat_done;
28+                }
29+#endif
30+
31        if (strcmp(SG(request_info).path_translated, filename) == 0) {
32            /* sapi has already done this stat() for us */
33            pbuf = sapi_get_stat(TSRMLS_C);