Changeset 178

Show
Ignore:
Timestamp:
03/06/06 10:08:40 (2 years ago)
Author:
bart
Message:

Removed the old webui and made a new controlpanel en disassembler

more information in the README file

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • eaccelerator/trunk/ChangeLog

    r176 r178  
     12006-03-06  Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 
     2 
     3        * Removed the old webui and made a new controlpanel en disassembler. 
     4 
    152006-03-02  Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 
    26 
  • eaccelerator/trunk/Makefile.in

    r162 r178  
    11LTLIBRARY_NAME        = libeaccelerator.la 
    2 LTLIBRARY_SOURCES     = eaccelerator.c optimize.c encoder.c loader.c opcodes.c content.c mm.c webui.c session.c shm.c debug.c cache.c ea_restore.c ea_store.c 
     2LTLIBRARY_SOURCES     = eaccelerator.c optimize.c encoder.c loader.c opcodes.c content.c mm.c session.c shm.c debug.c cache.c ea_restore.c ea_store.c ea_info.c ea_dasm.c 
    33LTLIBRARY_SHARED_NAME = eaccelerator.la 
    44 
  • eaccelerator/trunk/README

    r152 r178  
    225225    "none"         - don't cache data 
    226226 
     227eaccelerator.allowed_admin_path 
     228    The script paths that are allowed to get admin information and do admin  
     229    controls 
     230 
     231Control panel and disassembler 
     232------------------------------ 
     233 
     234If you want to use the control-panel you need to compile eAccelerator with  
     235    --with-eaccelerator-info which is the default value. 
     236You need to copy the control.php file to your webroot and set the path to it  
     237in the php.ini or eaccelerator.ini in the eaccelerator.allowed_admin_path  
     238directive. If you don't do this you wont be able to see much information and  
     239can't control eAccelerator. 
     240You can set the username and password needed to access the control-panel in  
     241the control.php file. 
     242 
     243When you compile eAccelerator with --with-eaccelerator-disassembler you need  
     244to place the dasm.php file also in the same directory as the control.php file. 
    227245 
    228246eAccelerator API 
     
    290308  loads script which was encoded by eaccelerator_encode() 
    291309 
    292 WEB interface 
    293 ------------- 
    294 eAccelerator can be managed through web interface script  eaccelerator.php. So 
    295 you need to put this file on  your  web  site.  For  security  reasons  it  is 
    296 recommended to restrict the usage of this script by your local IP. 
    297  
    298 Since version 2.3.18 admin interface may be protected by password. To generate 
    299 password run the eaccelerator_password.php from command line  and  follow  the  
    300 instruction. 
    301  
    302   $ php -q eaccelerator_password.php 
    303   Changing password for eAccelerator Web Interface (eaccelerator.php) 
    304  
    305   Enter admin name: admin 
    306   New admin password: eaccelerator 
    307   Retype new admin password: eaccelerator 
    308  
    309   Add the following lines into your php.ini and restart HTTPD 
    310  
    311   eaccelerator.admin.name="admin" 
    312   eaccelerator.admin.password="$1$0ScD9gkb$nOEmFerNMvQ576hELeLrG0" 
    313  
    314 If you use eaccelerator.php in directory that is password-protected  by  HTTPD 
    315 then eaccelerator's admin name and password must be the same. 
    316  
    317  
    318310Contact us 
    319311---------- 
  • eaccelerator/trunk/cache.c

    r176 r178  
    4848extern int binary_zend_version; 
    4949 
    50 static char *build_key (const char *key, int key_len, int *xlen TSRMLS_DC) 
     50static char *build_key(const char *key, int key_len, int *xlen TSRMLS_DC) 
    5151{ 
    5252        int len; 
     
    5555         * namespace  
    5656         */ 
    57         len = strlen (EAG (name_space)); 
     57        len = strlen(EAG(name_space)); 
    5858        if (len > 0) { 
    5959                char *xkey; 
    6060                *xlen = len + key_len + 1; 
    61                 xkey = emalloc ((*xlen) + 1); 
    62                 memcpy (xkey, EAG (name_space), len); 
     61                xkey = emalloc((*xlen) + 1); 
     62                memcpy(xkey, EAG(name_space), len); 
    6363                xkey[len] = ':'; 
    64                 memcpy (xkey + len + 1, key, key_len + 1); 
     64                memcpy(xkey + len + 1, key, key_len + 1); 
    6565                return xkey; 
    6666        } 
     
    6969         * hostname  
    7070         */ 
    71         len = strlen (EAG (hostname)); 
     71        len = strlen(EAG (hostname)); 
    7272        if (len > 0) { 
    7373                char *xkey; 
    7474                *xlen = len + key_len + 1; 
    75                 xkey = emalloc ((*xlen) + 1); 
    76                 memcpy (xkey, EAG (hostname), len); 
     75                xkey = emalloc((*xlen) + 1); 
     76                memcpy(xkey, EAG(hostname), len); 
    7777                xkey[len] = ':'; 
    78                 memcpy (xkey + len + 1, key, key_len + 1); 
     78                memcpy(xkey + len + 1, key, key_len + 1); 
    7979                return xkey; 
    8080        } else { 
     
    139139#ifdef ZEND_WIN32 
    140140                        Sleep (100); 
    141 /*??? 
    142 #elif defined(HAVE_SCHED_YIELD) 
    143       sched_yield(); 
    144 */ 
    145141#else 
    146142                        struct timeval t; 
     
    258254                memcpy (&q->value, val, sizeof (zval)); 
    259255                q->ttl = ttl ? time (0) + ttl : 0; 
     256                q->create = time (0); 
    260257                store_zval (&q->value TSRMLS_CC); 
    261258                zend_hash_destroy (&EAG (strings)); 
     
    605602        return size; 
    606603} 
     604 
     605/* get list of all keys stored in memory that matches hostname or namespace */ 
     606int eaccelerator_list_keys(zval *return_value TSRMLS_DC)  
     607{ 
     608        unsigned int i, xlen; 
     609        zval *list; 
     610        char *xkey; 
     611        mm_user_cache_entry *p; 
     612        time_t t = time (0); 
     613 
     614        // create key prefix for current host / namespace 
     615        xlen = strlen(EAG(name_space)); 
     616        if (xlen > 0) { 
     617                xkey = emalloc(xlen + 1); 
     618                memcpy(xkey, EAG(name_space), xlen); 
     619        } else { 
     620        xlen = strlen(EAG(hostname)); 
     621            if (xlen > 0) { 
     622                xkey = emalloc(xlen + 1); 
     623                memcpy(xkey, EAG(hostname), xlen); 
     624            } 
     625    } 
     626 
     627        // initialize return value as an array 
     628        array_init(return_value); 
     629 
     630        for (i = 0; i < MM_USER_HASH_SIZE; ++i) { 
     631        p = eaccelerator_mm_instance->user_hash[i]; 
     632                while(p != NULL) { 
     633                        if (!xlen || strncmp(p->key, xkey, xlen) == 0) { 
     634                                list = NULL; 
     635                                ALLOC_INIT_ZVAL(list); 
     636                                array_init(list); 
     637                                 
     638                                if (strlen(p->key) > xlen) { 
     639                                        add_assoc_string(list, "name", (p->key) + xlen, 1); 
     640                                } else { 
     641                                        add_assoc_string(list, "name", p->key, 1); 
     642                                } 
     643                 
     644                if (p->ttl) { 
     645                                if (p->ttl < t) { 
     646                                        add_assoc_long(list, "ttl", (p->ttl -t)); // ttl 
     647                                } else { 
     648                                        add_assoc_long(list, "ttl", -1); // expired 
     649                                } 
     650                } else { 
     651                                        add_assoc_long(list, "ttl", 0); // no ttl 
     652                                } 
     653                                 
     654                                add_assoc_long(list, "created", p->create); 
     655                                add_assoc_long(list, "size", p->size); 
     656                                add_next_index_zval(return_value, list); 
     657                        } 
     658            p = p->next; 
     659                } 
     660        } 
     661 
     662    if (xlen > 0)  
     663        efree(xkey); 
     664        return 1; 
     665} 
     666 
    607667#endif /* HAVE_EACCELERATOR */ 
     668 
  • eaccelerator/trunk/cache.h

    r176 r178  
    4343size_t eaccelerator_gc (TSRMLS_D); 
    4444 
     45int eaccelerator_list_keys(zval *return_value TSRMLS_DC); 
     46 
    4547#endif                                                  /* INCLUDED_CACHE_H */ 
  • eaccelerator/trunk/config.m4

    r175 r178  
    5151]) 
    5252 
    53 AC_ARG_WITH(eaccelerator-webui, 
    54 [  --without-eaccelerator-webui             Do not include the eaccelerator WebUI],[ 
    55   eaccelerator_webui=$withval 
    56 ],[ 
    57   eaccelerator_webui=yes 
    58 ]) 
    59  
    6053AC_ARG_WITH(eaccelerator-sessions, 
    6154[  --with-eaccelerator-sessions             Include eaccelerator sessions],[ 
     
    7063],[ 
    7164  eaccelerator_content_caching=no 
     65]) 
     66 
     67AC_ARG_WITH(eaccelerator-info, 
     68[  --without-eaccelerator-info                Do not compile the eAccelerator information functions],[ 
     69  eaccelerator_info=$withval 
     70],[ 
     71  eaccelerator_info=yes 
    7272]) 
    7373 
     
    105105  AC_DEFINE(HAVE_EACCELERATOR, 1, [Define if you like to use eAccelerator]) 
    106106 
     107  AC_DEFINE(WITH_EACCELERATOR_INFO, 1, [Define to be able to get information about eAccelerator]) 
     108 
    107109  AC_DEFINE_UNQUOTED(EA_USERID, $ea_userid, [The userid eAccelerator will be running under.])  
    108110     
     
    122124    AC_DEFINE(WITH_EACCELERATOR_SHM, 1, [Define if you like to use the eAccelerator functions to store keys in shared memory]) 
    123125  fi 
    124   if test "$eaccelerator_webui" = "yes"; then 
    125     AC_DEFINE(WITH_EACCELERATOR_WEBUI, 1, [Define if you like to use the eAccelerator WebUI]) 
     126  if test "$eaccelerator_info" = "yes"; then 
     127    AC_DEFINE(WITH_EACCELERATOR_INFO, 1, [Define if you want the information functions]) 
    126128  fi 
    127129  if test "$eaccelerator_sessions" = "yes"; then 
  • eaccelerator/trunk/eaccelerator.c

    r176 r178  
    3737#include "zend_extensions.h" 
    3838 
    39 #include "webui.h" 
    4039#include "debug.h" 
    4140#include "shm.h" 
     
    4544#include "ea_store.h" 
    4645#include "ea_restore.h" 
     46#include "ea_info.h" 
     47#include "ea_dasm.h" 
    4748 
    4849#include <sys/types.h> 
     
    904905  *nreloads = 1; 
    905906  EACCELERATOR_UNPROTECT(); 
    906   p = hash_find_mm(realname, buf, nreloads, 
    907                    ((eaccelerator_shm_ttl > 0)?(compile_time + eaccelerator_shm_ttl):0)); 
     907  p = hash_find_mm(realname, buf, nreloads, ((eaccelerator_shm_ttl > 0)?(compile_time + eaccelerator_shm_ttl):0)); 
    908908  if (p == NULL && !eaccelerator_scripts_shm_only) { 
    909909    p = hash_find_file(realname, buf TSRMLS_CC); 
     
    13871387*/ 
    13881388    EAG(compiler) = 0; 
    1389     if (t != NULL && 
    1390         file_handle->opened_path != NULL && 
     1389    if (t != NULL && file_handle->opened_path != NULL && 
    13911390#ifdef EACCELERATOR_USE_INODE 
    13921391        eaccelerator_ok_to_cache(file_handle->opened_path TSRMLS_CC)) { 
     
    16221621  php_info_print_table_header(2, "eAccelerator support", "enabled"); 
    16231622  php_info_print_table_row(2, "Version", EACCELERATOR_VERSION); 
    1624   php_info_print_table_row(2, "Caching Enabled", (EAG(enabled) && (eaccelerator_mm_instance != NULL) && eaccelerator_mm_instance->enabled)?"true":"false"); 
    1625   php_info_print_table_row(2, "Optimizer Enabled", (EAG(optimizer_enabled) && (eaccelerator_mm_instance != NULL) && eaccelerator_mm_instance->optimizer_enabled)?"true":"false"); 
     1623  php_info_print_table_row(2, "Caching Enabled", (EAG(enabled) && (eaccelerator_mm_instance != NULL) &&  
     1624              eaccelerator_mm_instance->enabled)?"true":"false"); 
     1625  php_info_print_table_row(2, "Optimizer Enabled", (EAG(optimizer_enabled) &&  
     1626              (eaccelerator_mm_instance != NULL) && eaccelerator_mm_instance->optimizer_enabled)?"true":"false"); 
    16261627  if (eaccelerator_mm_instance != NULL) { 
    16271628    size_t available; 
     
    17421743#ifdef WITH_EACCELERATOR_CONTENT_CACHING 
    17431744ZEND_INI_ENTRY("eaccelerator.content",          "shm_and_disk", PHP_INI_SYSTEM, eaccelerator_OnUpdateContentCachePlace) 
     1745#endif 
     1746#ifdef WITH_EACCELERATOR_INFO 
     1747STD_PHP_INI_ENTRY("eaccelerator.allowed_admin_path",       "", PHP_INI_SYSTEM, OnUpdateString, allowed_admin_path, zend_eaccelerator_globals, eaccelerator_globals) 
    17441748#endif 
    17451749STD_PHP_INI_ENTRY("eaccelerator.cache_dir",      "/tmp/eaccelerator", PHP_INI_SYSTEM, OnUpdateString, cache_dir, zend_eaccelerator_globals, eaccelerator_globals) 
     
    19181922  eaccelerator_globals->hostname[0]       = '\000'; 
    19191923  eaccelerator_globals->in_request        = 0; 
     1924  eaccelerator_globals->allowed_admin_path= NULL; 
    19201925} 
    19211926 
     
    20712076                zend_function tmp_func; 
    20722077                zend_class_entry tmp_class; 
    2073  
    2074                 // Don't need this, as the context given by function argument. 
    2075                 // TSRMLS_FETCH(); 
    20762078 
    20772079                zend_hash_init_ex(&eaccelerator_global_function_table, 100, NULL, NULL, 1, 0); 
     
    21402142PHP_RSHUTDOWN_FUNCTION(eaccelerator) 
    21412143{ 
    2142         if (eaccelerator_mm_instance == NULL) 
    2143         { 
     2144        if (eaccelerator_mm_instance == NULL) { 
    21442145                return SUCCESS; 
    21452146        } 
    21462147#ifdef WITH_EACCELERATOR_CRASH_DETECTION 
    21472148#ifdef SIGSEGV 
    2148         if (EAG(original_sigsegv_handler) != eaccelerator_crash_handler) 
    2149         { 
     2149        if (EAG(original_sigsegv_handler) != eaccelerator_crash_handler) { 
    21502150                signal(SIGSEGV, EAG(original_sigsegv_handler)); 
    2151         } 
    2152         else 
    2153         { 
     2151        } else { 
    21542152                signal(SIGSEGV, SIG_DFL); 
    21552153        } 
    21562154#endif 
    21572155#ifdef SIGFPE 
    2158         if (EAG(original_sigfpe_handler) != eaccelerator_crash_handler) 
    2159         { 
     2156        if (EAG(original_sigfpe_handler) != eaccelerator_crash_handler) { 
    21602157                signal(SIGFPE, EAG(original_sigfpe_handler)); 
    2161         } 
    2162         else 
    2163         { 
     2158        } else { 
    21642159                signal(SIGFPE, SIG_DFL); 
    21652160        } 
    21662161#endif 
    21672162#ifdef SIGBUS 
    2168         if (EAG(original_sigbus_handler) != eaccelerator_crash_handler) 
    2169         { 
     2163        if (EAG(original_sigbus_handler) != eaccelerator_crash_handler) { 
    21702164                signal(SIGBUS, EAG(original_sigbus_handler)); 
    2171         } 
    2172         else 
    2173         { 
     2165        } else { 
    21742166                signal(SIGBUS, SIG_DFL); 
    21752167        } 
    21762168#endif 
    21772169#ifdef SIGILL 
    2178         if (EAG(original_sigill_handler) != eaccelerator_crash_handler) 
    2179         { 
     2170        if (EAG(original_sigill_handler) != eaccelerator_crash_handler) { 
    21802171                signal(SIGILL, EAG(original_sigill_handler)); 
    2181         } 
    2182         else 
    2183         { 
     2172        } else { 
    21842173                signal(SIGILL, SIG_DFL); 
    21852174        } 
    21862175#endif 
    21872176#ifdef SIGABRT 
    2188         if (EAG(original_sigabrt_handler) != eaccelerator_crash_handler) 
    2189         { 
     2177        if (EAG(original_sigabrt_handler) != eaccelerator_crash_handler) { 
    21902178                signal(SIGABRT, EAG(original_sigabrt_handler)); 
    2191         } 
    2192         else 
    2193         { 
     2179        } else { 
    21942180                signal(SIGABRT, SIG_DFL); 
    21952181        } 
     
    22122198 
    22132199function_entry eaccelerator_functions[] = { 
    2214 #ifdef WITH_EACCELERATOR_WEBUI 
    2215   PHP_FE(eaccelerator, NULL) 
    2216 #endif 
    22172200#ifdef WITH_EACCELERATOR_SHM 
    22182201  PHP_FE(eaccelerator_put, NULL) 
     
    22222205  PHP_FE(eaccelerator_lock, NULL) 
    22232206  PHP_FE(eaccelerator_unlock, NULL) 
     2207#endif 
     2208#ifdef WITH_EACCELERATOR_INFO 
     2209  PHP_FE(eaccelerator_caching, NULL) 
     2210  #ifdef WITH_EACCELERATOR_OPTIMIZER 
     2211  PHP_FE(eaccelerator_optimizer, NULL) 
     2212  #endif 
     2213  PHP_FE(eaccelerator_clear, NULL) 
     2214  PHP_FE(eaccelerator_clean, NULL) 
     2215  PHP_FE(eaccelerator_info, NULL) 
     2216  PHP_FE(eaccelerator_purge, NULL) 
     2217  PHP_FE(eaccelerator_cached_scripts, NULL) 
     2218  PHP_FE(eaccelerator_removed_scripts, NULL) 
     2219  PHP_FE(eaccelerator_list_keys, NULL) 
    22242220#endif 
    22252221#ifdef WITH_EACCELERATOR_ENCODER 
     
    22482244  PHP_FE(eaccelerator_cache_output, NULL) 
    22492245  PHP_FE(eaccelerator_cache_result, NULL) 
     2246#endif 
     2247#ifdef WITH_EACCELERATOR_DISASSEMBLER 
     2248  PHP_FE(eaccelerator_dasm_file, NULL) 
    22502249#endif 
    22512250#ifdef ZEND_ENGINE_2 
  • eaccelerator/trunk/eaccelerator.h

    r176 r178  
    304304        unsigned int hv;                        /* hash value                  */ 
    305305        long ttl;                                       /* expiration time             */ 
     306        long create; 
    306307        int size; 
    307308        zval value;                                     /* value                       */ 
     
    460461char *name_space; 
    461462char *mem; 
     463char *allowed_admin_path; 
    462464HashTable strings; 
    463465zend_class_entry *class_entry; 
  • eaccelerator/trunk/eaccelerator.ini

    r141 r178  
    107107eaccelerator.content  = "shm_and_disk" 
    108108 
    109 ; eAccelerator can be managed through web interface script  eaccelerator.php. So 
    110 ; you need to put this file on  your  web  site.  For  security  reasons  it  is 
    111 ; recommended to restrict the usage of this script by your local IP. 
    112 
    113 ; To create the eAccelerator password type 
    114 
    115 ; php -q eaccelerator_password.php 
    116 ; Changing password for eAccelerator Web Interface (eaccelerator.php) 
    117 
    118 ; Enter admin name: admin 
    119 ; New admin password: eaccelerator 
    120 ; Retype new admin password: eaccelerator 
     109; The script paths that are allowed to get admin information and do admin 
     110; controls 
     111eaccelerator.allowed_admin_path = "" 
    121112 
    122 eaccelerator.admin.name="yourusername" 
    123 eaccelerator.admin.password="yourpassword" 
  • eaccelerator/trunk/shm.c

    r176 r178  
    6868/******************************************************************************/ 
    6969 
    70 PHP_FUNCTION (eaccelerator_lock) 
     70PHP_FUNCTION(eaccelerator_lock) 
    7171{ 
    7272        char *key; 
    7373        int key_len; 
    7474 
    75         if (zend_parse_parameters (ZEND_NUM_ARGS ()TSRMLS_CC, "s", &key, &key_len) 
    76                 == FAILURE) 
     75        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &key, &key_len) == FAILURE) 
    7776                return; 
    7877 
    79         if (eaccelerator_lock (key, key_len TSRMLS_CC)) { 
     78        if (eaccelerator_lock(key, key_len TSRMLS_CC)) { 
    8079                RETURN_TRUE; 
    8180        } else { 
     
    8988        int key_len; 
    9089 
    91         if (zend_parse_parameters (ZEND_NUM_ARGS ()TSRMLS_CC, "s", &key, &key_len) 
    92                 == FAILURE) 
     90        if (zend_parse_parameters (ZEND_NUM_ARGS ()TSRMLS_CC, "s", &key, &key_len) == FAILURE) 
    9391                return; 
    9492 
     
    108106        long where = eaccelerator_keys_cache_place; 
    109107 
    110         if (zend_parse_parameters (ZEND_NUM_ARGS ()TSRMLS_CC, "sz|ll", &key,  
    111                                                                 &key_len, &val, &ttl, &where) == FAILURE) 
     108        if (zend_parse_parameters (ZEND_NUM_ARGS ()TSRMLS_CC, "sz|ll", &key, &key_len, &val, &ttl, &where) == FAILURE) 
    112109                return; 
    113110 
     
    125122        long where = eaccelerator_keys_cache_place; 
    126123 
    127         if (zend_parse_parameters (ZEND_NUM_ARGS ()TSRMLS_CC, 
    128                                                            "s|l", &key, &key_len, &where) == FAILURE) 
     124        if (zend_parse_parameters (ZEND_NUM_ARGS ()TSRMLS_CC, "s|l", &key, &key_len, &where) == FAILURE) 
    129125                return; 
    130126 
     
    142138        long where = eaccelerator_keys_cache_place; 
    143139 
    144         if (zend_parse_parameters (ZEND_NUM_ARGS ()TSRMLS_CC, 
    145                                                            "s|l", &key, &key_len, &where) == FAILURE) 
     140        if (zend_parse_parameters (ZEND_NUM_ARGS ()TSRMLS_CC, "s|l", &key, &key_len, &where) == FAILURE) 
    146141                return; 
    147142 
     
    161156        RETURN_TRUE; 
    162157} 
     158 
     159 
     160 
    163161#endif                                                  /* WITH_EACCELERATOR_SHM */ 
    164162#endif                                                  /* HAVE_EACCELERATOR */ 
  • eaccelerator/trunk/shm.h

    r176 r178  
    4242 
    4343#endif /* WITH_EACCELERATOR_SHM */ 
    44  
    4544#endif /* INCLUDED_SHM_H */ 
  • eaccelerator/trunk/x86_spinlocks.h

    r176 r178  
    6666  } 
    6767} 
     68