@@ -431,7 +431,7 @@ static zend_always_inline zend_string *accel_find_interned_string(zend_string *s
431431 }
432432
433433 if (!ZCG (counted )) {
434- if (accel_activate_add () == FAILURE ) {
434+ if (! ZCG ( accelerator_enabled ) || accel_activate_add () == FAILURE ) {
435435 return str ;
436436 }
437437 ZCG (counted ) = 1 ;
@@ -1164,7 +1164,7 @@ char *accel_make_persistent_key(const char *path, size_t path_length, int *key_l
11641164 cwd_len = ZSTR_LEN (cwd_str );
11651165 if (ZCG (cwd_check )) {
11661166 ZCG (cwd_check ) = 0 ;
1167- if (( ZCG (counted ) || ZCSG ( accelerator_enabled ) )) {
1167+ if (ZCG (accelerator_enabled )) {
11681168
11691169 zend_string * str = accel_find_interned_string (cwd_str );
11701170 if (!str ) {
@@ -1204,7 +1204,7 @@ char *accel_make_persistent_key(const char *path, size_t path_length, int *key_l
12041204
12051205 if (ZCG (include_path_check )) {
12061206 ZCG (include_path_check ) = 0 ;
1207- if (( ZCG (counted ) || ZCSG ( accelerator_enabled ) )) {
1207+ if (ZCG (accelerator_enabled )) {
12081208
12091209 zend_string * str = accel_find_interned_string (ZCG (include_path ));
12101210 if (!str ) {
@@ -1287,7 +1287,7 @@ int zend_accel_invalidate(const char *filename, size_t filename_len, zend_bool f
12871287 zend_string * realpath ;
12881288 zend_persistent_script * persistent_script ;
12891289
1290- if (!ZCG (enabled ) || ! accel_startup_ok || ! ZCSG ( accelerator_enabled ) || accelerator_shm_read_lock () != SUCCESS ) {
1290+ if (!ZCG (accelerator_enabled ) || accelerator_shm_read_lock () != SUCCESS ) {
12911291 return FAILURE ;
12921292 }
12931293
@@ -1910,7 +1910,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
19101910 } else if (file_cache_only ) {
19111911 return file_cache_compile_file (file_handle , type );
19121912#endif
1913- } else if (( !ZCG (counted ) && ! ZCSG ( accelerator_enabled ) ) ||
1913+ } else if (!ZCG (accelerator_enabled ) ||
19141914 (ZCSG (restart_in_progress ) && accel_restart_is_active ())) {
19151915#ifdef HAVE_OPCACHE_FILE_CACHE
19161916 if (ZCG (accel_directives ).file_cache ) {
@@ -2205,12 +2205,11 @@ static int persistent_stream_open_function(const char *filename, zend_file_handl
22052205/* zend_resolve_path() replacement for PHP 5.3 and above */
22062206static zend_string * persistent_zend_resolve_path (const char * filename , size_t filename_len )
22072207{
2208- if (ZCG ( enabled ) && accel_startup_ok &&
2208+ if (
22092209#ifdef HAVE_OPCACHE_FILE_CACHE
22102210 !file_cache_only &&
22112211#endif
2212- (ZCG (counted ) || ZCSG (accelerator_enabled )) &&
2213- !ZCSG (restart_in_progress )) {
2212+ ZCG (accelerator_enabled )) {
22142213
22152214 /* check if callback is called from include_once or it's a main request */
22162215 if ((!EG (current_execute_data ) &&
@@ -2359,6 +2358,7 @@ static void accel_activate(void)
23592358 zend_alter_ini_entry_chars (key , "0" , 1 , ZEND_INI_SYSTEM , ZEND_INI_STAGE_RUNTIME );
23602359 zend_string_release_ex (key , 0 );
23612360 zend_accel_error (ACCEL_LOG_WARNING , "Can't cache files in chroot() directory with too big inode" );
2361+ ZCG (accelerator_enabled ) = 0 ;
23622362 return ;
23632363 }
23642364 }
@@ -2416,12 +2416,15 @@ static void accel_activate(void)
24162416 }
24172417 accel_restart_leave ();
24182418 }
2419- } else {
2419+ }
2420+ if (!ZCG (pcre_reseted )) {
24202421 reset_pcre = 1 ;
24212422 }
24222423 zend_shared_alloc_unlock ();
24232424 }
24242425
2426+ ZCG (accelerator_enabled ) = ZCSG (accelerator_enabled );
2427+
24252428 SHM_PROTECT ();
24262429 HANDLE_UNBLOCK_INTERRUPTIONS ();
24272430
@@ -2433,8 +2436,10 @@ static void accel_activate(void)
24332436 realpath_cache_clean ();
24342437
24352438 accel_reset_pcre_cache ();
2439+ ZCG (pcre_reseted ) = 0 ;
24362440 } else if (reset_pcre ) {
24372441 accel_reset_pcre_cache ();
2442+ ZCG (pcre_reseted ) = 1 ;
24382443 }
24392444}
24402445
@@ -2462,10 +2467,6 @@ static void accel_deactivate(void)
24622467 zend_string_release_ex (ZCG (cwd ), 0 );
24632468 ZCG (cwd ) = NULL ;
24642469 }
2465-
2466- if (!ZCG (enabled ) || !accel_startup_ok ) {
2467- return ;
2468- }
24692470}
24702471
24712472static int accelerator_remove_cb (zend_extension * element1 , zend_extension * element2 )
0 commit comments