Changeset 81 for branches/1.0/xcache.c


Ignore:
Timestamp:
2006-06-18T03:04:54+02:00 (8 years ago)
Author:
moo
Message:

improved phpinfo displaying for those ini not in standard form.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.0/xcache.c

    r74 r81  
    1212#include "ext/standard/info.h" 
    1313#include "ext/standard/md5.h" 
     14#include "ext/standard/php_math.h" 
    1415#include "zend_extensions.h" 
    1516#include "SAPI.h" 
     
    17881789PHP_INI_END() 
    17891790/* }}} */ 
     1791static int xc_config_long_disp(char *name, char *default_value) /* {{{ */ 
     1792{ 
     1793    char *value; 
     1794    char buf[100]; 
     1795 
     1796    if (cfg_get_string(name, &value) != SUCCESS) { 
     1797        sprintf(buf, "%s (default)", default_value); 
     1798        php_info_print_table_row(2, name, buf); 
     1799    } 
     1800    else { 
     1801        php_info_print_table_row(2, name, value); 
     1802    } 
     1803 
     1804    return SUCCESS; 
     1805} 
     1806/* }}} */ 
     1807#define xc_config_hash_disp xc_config_long_disp 
    17901808/* {{{ PHP_MINFO_FUNCTION(xcache) */ 
    17911809static PHP_MINFO_FUNCTION(xcache) 
    17921810{ 
     1811    char buf[100]; 
     1812    char *ptr; 
     1813 
    17931814    php_info_print_table_start(); 
    17941815    php_info_print_table_header(2, "XCache Support", (xc_php_size || xc_var_size) ? "enabled" : "disabled"); 
    17951816    php_info_print_table_row(2, "Version", XCACHE_VERSION); 
    17961817    php_info_print_table_row(2, "Modules Built", XCACHE_MODULES); 
    1797     php_info_print_table_row(2, "Readonly Protection", xc_readonly_protection ? "enabled" : "N/A"); 
    1798     php_info_print_table_row(2, "Opcode Cache", xc_php_size ? "enabled" : "disabled"); 
    1799     php_info_print_table_row(2, "Variable Cache", xc_var_size ? "enabled" : "disabled"); 
     1818    php_info_print_table_row(2, "Readonly Protection", xc_readonly_protection ? "enabled" : "N/A or disabled"); 
     1819 
     1820    if (xc_php_size) { 
     1821        ptr = _php_math_number_format(xc_php_size, 0, '.', ','); 
     1822        sprintf(buf, "enabled, %s bytes, %d split(s), with %d slots each", ptr, xc_php_hcache.size, xc_php_hentry.size); 
     1823        php_info_print_table_row(2, "Opcode Cache", buf); 
     1824        efree(ptr); 
     1825    } 
     1826    else { 
     1827        php_info_print_table_row(2, "Opcode Cache", "disabled"); 
     1828    } 
     1829    if (xc_var_size) { 
     1830        ptr = _php_math_number_format(xc_var_size, 0, '.', ','); 
     1831        sprintf(buf, "enabled, %s bytes, %d split(s), with %d slots each", ptr, xc_var_hcache.size, xc_var_hentry.size); 
     1832        php_info_print_table_row(2, "Variable Cache", buf); 
     1833        efree(ptr); 
     1834    } 
     1835    else { 
     1836        php_info_print_table_row(2, "Variable Cache", "disabled"); 
     1837    } 
    18001838#ifdef HAVE_XCACHE_COVERAGER 
    18011839    php_info_print_table_row(2, "Coverage Dumper", XG(coveragedumper) && xc_coveragedump_dir && xc_coveragedump_dir[0] ? "enabled" : "disabled"); 
    18021840#endif 
    18031841    php_info_print_table_end(); 
     1842 
     1843    php_info_print_table_start(); 
     1844    php_info_print_table_header(2, "Directive ", "Value"); 
     1845    xc_config_long_disp("xcache.size",       "0"); 
     1846    xc_config_hash_disp("xcache.count",      "1"); 
     1847    xc_config_hash_disp("xcache.slots",     "8K"); 
     1848 
     1849    xc_config_long_disp("xcache.var_size",   "0"); 
     1850    xc_config_hash_disp("xcache.var_count",  "1"); 
     1851    xc_config_hash_disp("xcache.var_slots", "8K"); 
     1852    php_info_print_table_end(); 
     1853 
    18041854    DISPLAY_INI_ENTRIES(); 
    18051855} 
     
    18571907    return SUCCESS; 
    18581908} 
     1909/* }}} */ 
    18591910static int xc_config_long(long *p, char *name, char *default_value) /* {{{ */ 
    18601911{ 
Note: See TracChangeset for help on using the changeset viewer.