Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 34a491d

Browse files
committedOct 1, 2018
Turn accel_activate into module callback.
1 parent c25e743 commit 34a491d

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed
 

‎ext/opcache/ZendAccelerator.c

+7-5
Original file line numberDiff line numberDiff line change
@@ -2293,12 +2293,12 @@ static void accel_reset_pcre_cache(void)
22932293
} ZEND_HASH_FOREACH_END();
22942294
}
22952295

2296-
static void accel_activate(void)
2296+
int accel_activate(INIT_FUNC_ARGS)
22972297
{
22982298
zend_bool reset_pcre = 0;
22992299

23002300
if (!ZCG(enabled) || !accel_startup_ok) {
2301-
return;
2301+
return SUCCESS;
23022302
}
23032303

23042304
/* PHP-5.4 and above return "double", but we use 1 sec precision */
@@ -2315,7 +2315,7 @@ static void accel_activate(void)
23152315

23162316
#ifdef HAVE_OPCACHE_FILE_CACHE
23172317
if (file_cache_only) {
2318-
return;
2318+
return SUCCESS;
23192319
}
23202320
#endif
23212321

@@ -2333,7 +2333,7 @@ static void accel_activate(void)
23332333
zend_alter_ini_entry_chars(key, "0", 1, ZEND_INI_SYSTEM, ZEND_INI_STAGE_RUNTIME);
23342334
zend_string_release_ex(key, 0);
23352335
zend_accel_error(ACCEL_LOG_WARNING, "Can't cache files in chroot() directory with too big inode");
2336-
return;
2336+
return SUCCESS;
23372337
}
23382338
}
23392339
}
@@ -2410,6 +2410,8 @@ static void accel_activate(void)
24102410
} else if (reset_pcre) {
24112411
accel_reset_pcre_cache();
24122412
}
2413+
2414+
return SUCCESS;
24132415
}
24142416

24152417
int accel_post_deactivate(void)
@@ -3026,7 +3028,7 @@ ZEND_EXT_API zend_extension zend_extension_entry = {
30263028
"Copyright (c) 1999-2018", /* copyright */
30273029
accel_startup, /* startup */
30283030
NULL, /* shutdown */
3029-
accel_activate, /* per-script activation */
3031+
NULL, /* per-script activation */
30303032
NULL, /* per-script deactivation */
30313033
NULL, /* message handler */
30323034
NULL, /* op_array handler */

‎ext/opcache/ZendAccelerator.h

+1
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ extern zend_accel_globals accel_globals;
313313
extern char *zps_api_failure_reason;
314314

315315
void accel_shutdown(void);
316+
int accel_activate(INIT_FUNC_ARGS);
316317
int accel_post_deactivate(void);
317318
void zend_accel_schedule_restart(zend_accel_restart_reason reason);
318319
void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason);

‎ext/opcache/zend_accelerator_module.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ static zend_module_entry accel_module_entry = {
521521
accel_functions,
522522
ZEND_MINIT(zend_accelerator),
523523
ZEND_MSHUTDOWN(zend_accelerator),
524-
NULL,
524+
accel_activate,
525525
NULL,
526526
zend_accel_info,
527527
PHP_VERSION,

0 commit comments

Comments
 (0)
Failed to load comments.