Changeset 625 in svn for branches/1.3/xcache.c


Ignore:
Timestamp:
2009-07-05T11:01:49+02:00 (6 years ago)
Author:
Xuefer
Message:

merged r541:559 from trunk

Location:
branches/1.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/1.3

  • branches/1.3/xcache.c

    r623 r625  
    11
    22#if 0
    3 #define DEBUG
     3#define XCACHE_DEBUG
    44#endif
    55
     
    2323
    2424#include "xcache.h"
     25#ifdef ZEND_ENGINE_2_1
     26#include "ext/date/php_date.h"
     27#endif
    2528#include "optimizer.h"
    2629#include "coverager.h"
     
    652655        new_cest_ptrs[i] =
    653656#endif
     657#ifdef ZEND_COMPILE_DELAYED_BINDING
     658        xc_install_class(xce->name.str.val, &ci->cest, -1,
     659                UNISW(0, ci->type), ci->key, ci->key_size, ci->h TSRMLS_CC);
     660#else
    654661        xc_install_class(xce->name.str.val, &ci->cest, ci->oplineno,
    655662                UNISW(0, ci->type), ci->key, ci->key_size, ci->h TSRMLS_CC);
     663#endif
    656664    }
    657665
     
    750758
    751759#define HASH(i) (i)
    752 #define HASH_USTR_L(t, s, l) HASH(zend_u_inline_hash_func(t, s, (l + 1) * sizeof(UChar)))
     760#define HASH_ZSTR_L(t, s, l) HASH(zend_u_inline_hash_func(t, s, (l + 1) * sizeof(UChar)))
    753761#define HASH_STR_L(s, l) HASH(zend_inline_hash_func(s, l + 1))
    754762#define HASH_STR(s) HASH_STR_L(s, strlen(s) + 1)
     
    766774static inline xc_hash_value_t xc_entry_hash_name(xc_entry_t *xce TSRMLS_DC) /* {{{ */
    767775{
    768     return UNISW(NOTHING, UG(unicode) ? HASH_USTR_L(xce->name_type, xce->name.uni.val, xce->name.uni.len) :)
     776    return UNISW(NOTHING, UG(unicode) ? HASH_ZSTR_L(xce->name_type, xce->name.uni.val, xce->name.uni.len) :)
    769777        HASH_STR_L(xce->name.str.val, xce->name.str.len);
    770778}
     
    893901}
    894902/* }}} */
     903#ifndef ZEND_COMPILE_DELAYED_BINDING
    895904static void xc_cache_early_binding_class_cb(zend_op *opline, int oplineno, void *data TSRMLS_DC) /* {{{ */
    896905{
     
    920929}
    921930/* }}} */
     931#endif
    922932static zend_op_array *xc_check_initial_compile_file(zend_file_handle *h, int type TSRMLS_DC) /* {{{ */
    923933{
     
    938948    char opened_path_buffer[MAXPATHLEN];
    939949    int old_constinfo_cnt, old_funcinfo_cnt, old_classinfo_cnt;
    940     int i;
    941950
    942951    if (!xc_initized) {
     
    11801189    }
    11811190    /* }}} */
     1191#ifndef ZEND_COMPILE_DELAYED_BINDING
    11821192    /* {{{ find inherited classes that should be early-binding */
    11831193    php.have_early_binding = 0;
    1184     for (i = 0; i < php.classinfo_cnt; i ++) {
    1185         php.classinfos[i].oplineno = -1;
     1194    {
     1195        int i;
     1196        for (i = 0; i < php.classinfo_cnt; i ++) {
     1197            php.classinfos[i].oplineno = -1;
     1198        }
    11861199    }
    11871200
     
    11901203    xc_redo_pass_two(php.op_array TSRMLS_CC);
    11911204    /* }}} */
     1205#endif
     1206
    11921207#ifdef SHOW_DPRINT
    11931208    xc_dprint(&xce, 0 TSRMLS_CC);
     
    17111726
    17121727    if (admin_user == NULL || admin_pass == NULL) {
    1713         php_error_docref(NULL TSRMLS_CC, E_ERROR, "xcache.admin.user and xcache.admin.pass is required");
     1728        php_error_docref(XCACHE_WIKI_URL "/InstallAdministration" TSRMLS_CC, E_ERROR,
     1729                "xcache.admin.user and/or xcache.admin.pass settings is not configured."
     1730                " Make sure you've modified the correct php ini file for your php used in webserver.");
    17141731        zend_bailout();
    17151732    }
    17161733    if (strlen(admin_pass) != 32) {
    1717         php_error_docref(NULL TSRMLS_CC, E_ERROR, "unexpect %lu bytes of xcache.admin.pass, expected 32 bytes, the password after md5()", (unsigned long) strlen(admin_pass));
     1734        php_error_docref(NULL TSRMLS_CC, E_ERROR, "xcache.admin.pass is %lu chars unexpectedly, it is supposed to be the password after md5() which should be 32 chars", (unsigned long) strlen(admin_pass));
    17181735        zend_bailout();
    17191736    }
     
    17641781    sapi_add_header_ex(STR, sizeof(STR) - 1, 1, 1 TSRMLS_CC);
    17651782#undef STR
    1766     ZEND_PUTS("XCache Auth Failed. User and Password is case sense\n");
     1783#define STR "Content-type: text/html; charset=UTF-8"
     1784    sapi_add_header_ex(STR, sizeof(STR) - 1, 1, 1 TSRMLS_CC);
     1785#undef STR
     1786    ZEND_PUTS("<html>\n");
     1787    ZEND_PUTS("<head><title>XCache Authentication Failed</title></head>\n");
     1788    ZEND_PUTS("<body>\n");
     1789    ZEND_PUTS("<h1>XCache Authentication Failed</h1>\n");
     1790    ZEND_PUTS("<p>You're not authorized to access this page due to wrong username and/or password you typed.<br />The following check points is suggested:</p>\n");
     1791    ZEND_PUTS("<ul>\n");
     1792    ZEND_PUTS("<li>Be aware that `Username' and `Password' is case sense. Check capslock status led on your keyboard, and punch left/right Shift keys once for each</li>\n");
     1793    ZEND_PUTS("<li>Make sure the md5 password is generated correctly. You may use <a href=\"mkpassword.php\">mkpassword.php</a></li>\n");
     1794    ZEND_PUTS("<li>Reload browser cache by pressing F5 and/or Ctrl+F5, or simply clear browser cache after you've updated username/password in php ini.</li>\n");
     1795    ZEND_PUTS("</ul>\n");
     1796    ZEND_PUTS("Check <a href=\"" XCACHE_WIKI_URL "/InstallAdministration\">XCache wiki page</a> for more information.\n");
     1797    ZEND_PUTS("</body>\n");
     1798    ZEND_PUTS("</html>\n");
    17671799
    17681800    zend_bailout();
     
    25602592    php_info_print_table_row(2, "Modules Built", XCACHE_MODULES);
    25612593    php_info_print_table_row(2, "Readonly Protection", xc_readonly_protection ? "enabled" : "N/A");
     2594#ifdef ZEND_ENGINE_2_1
    25622595    ptr = php_format_date("Y-m-d H:i:s", sizeof("Y-m-d H:i:s") - 1, xc_init_time, 1 TSRMLS_CC);
    25632596    php_info_print_table_row(2, "Cache Init Time", ptr);
    25642597    efree(ptr);
     2598#else
     2599    snprintf(buf, sizeof(buf), "%lu", (long unsigned) xc_init_time);
     2600    php_info_print_table_row(2, "Cache Init Time", buf);
     2601#endif
    25652602
    25662603#ifdef ZTS
     
    28052842        xc_initized = 1;
    28062843        xc_init_time = time(NULL);
     2844#ifdef PHP_WIN32
     2845        xc_init_instance_id = GetCurrentProcessId();
     2846#else
    28072847        xc_init_instance_id = getpid();
     2848#endif
    28082849#ifdef ZTS
    28092850        xc_init_instance_subid = tsrm_thread_id();
     
    29793020
    29803021        ext = (zend_extension *) zend_llist_get_last_ex(&zend_extensions, &lpos);
    2981         assert(ext && ext != xc_llist_zend_extension);
     3022        assert(ext && ext != (zend_extension *) xc_llist_zend_extension->data);
    29823023        xc_last_ext_startup = ext->startup;
    29833024        ext->startup = xc_zend_startup_last;
Note: See TracChangeset for help on using the changeset viewer.