Ticket #296: ticket-296-2.0.1.patch

File ticket-296-2.0.1.patch, 2.7 KB (added by dschnepper, 12 months ago)

Patch for 2.0.1

  • xcache.c

    From 3551bb779956147a1756239225284342d277ed61 Mon Sep 17 00:00:00 2001
    From: David Schnepper <dschnepper@box.com>
    Date: Wed, 8 May 2013 18:16:27 -0700
    Subject: [PATCH] WIP - patch
    
    ---
     xcache.c         |    7 +++++++
     xcache.ini       |    3 +++
     xcache_globals.h |    1 +
     3 files changed, 11 insertions(+), 0 deletions(-)
    
    diff --git a/xcache.c b/xcache.c
    index f7b0fad..573142e 100644
    a b static int xc_entry_data_php_init_md5(xc_cache_t *cache, xc_compiler_t *compiler 
    12231223    while ((n = php_stream_read(stream, (char *) buf, sizeof(buf))) > 0) { 
    12241224        PHP_MD5Update(&context, buf, n); 
    12251225    } 
     1226    if (XG(dedup_on_filename_only)) { 
     1227        /* Include the full file pathname in the hash calculation. 
     1228         * Files with identical source can have different opcode results if they include __FILE__ or __DIR__ 
     1229         */ 
     1230        PHP_MD5Update(&context, compiler->filename, strlen(compiler->filename)); 
     1231    } 
    12261232    PHP_MD5Final((unsigned char *) compiler->new_php.md5.digest, &context); 
    12271233 
    12281234    php_stream_close(stream); 
    PHP_INI_BEGIN() 
    36053611    STD_PHP_INI_BOOLEAN("xcache.stat",                   "1", PHP_INI_ALL,    OnUpdateBool,        stat,              zend_xcache_globals, xcache_globals) 
    36063612    STD_PHP_INI_BOOLEAN("xcache.admin.enable_auth",      "1", PHP_INI_SYSTEM, OnUpdateBool,        auth_enabled,      zend_xcache_globals, xcache_globals) 
    36073613    STD_PHP_INI_BOOLEAN("xcache.experimental",           "0", PHP_INI_ALL,    OnUpdateBool,        experimental,      zend_xcache_globals, xcache_globals) 
     3614    STD_PHP_INI_BOOLEAN("xcache.dedup_on_filename_only", "0", PHP_INI_SYSTEM, OnUpdateBool,        dedup_on_filename_only, zend_xcache_globals, xcache_globals) 
    36083615#ifdef HAVE_XCACHE_OPTIMIZER 
    36093616    STD_PHP_INI_BOOLEAN("xcache.optimizer",              "0", PHP_INI_ALL,    OnUpdateBool,        optimizer,         zend_xcache_globals, xcache_globals) 
    36103617#endif 
  • xcache.ini

    diff --git a/xcache.ini b/xcache.ini
    index 1f23fcb..d4f27f0 100644
    a b xcache.coredump_directory = "" 
    6161; enable experimental documented features for each release if available 
    6262xcache.experimental =        Off 
    6363 
     64; Include filename in md5 of contents for detecting identical files 
     65xcache.dedup_on_filename_only = Off 
     66 
    6467; per request settings. can ini_set, .htaccess etc 
    6568xcache.cacher =               On 
    6669xcache.stat   =               On 
  • xcache_globals.h

    diff --git a/xcache_globals.h b/xcache_globals.h
    index 312a9ea..d6e9cd3 100644
    a b ZEND_BEGIN_MODULE_GLOBALS(xcache) 
    44    zend_bool cacher;      /* true if enabled */ 
    55    zend_bool stat; 
    66    zend_bool experimental; 
     7    zend_bool dedup_on_filename_only; 
    78#ifdef HAVE_XCACHE_OPTIMIZER 
    89    zend_bool optimizer;   /* true if enabled */ 
    910#endif