Skip to content

Commit 72527d9

Browse files
Add OPcache restart hook
1 parent b9b317a commit 72527d9

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

ext/opcache/ZendAccelerator.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3410,6 +3410,8 @@ void accel_shutdown(void)
34103410
}
34113411
}
34123412

3413+
ZEND_EXT_API void (*zend_accel_schedule_restart_hook)(zend_accel_restart_reason reason);
3414+
34133415
void zend_accel_schedule_restart(zend_accel_restart_reason reason)
34143416
{
34153417
const char *zend_accel_restart_reason_text[ACCEL_RESTART_USER + 1] = {
@@ -3418,6 +3420,10 @@ void zend_accel_schedule_restart(zend_accel_restart_reason reason)
34183420
"user",
34193421
};
34203422

3423+
if (zend_accel_schedule_restart_hook) {
3424+
zend_accel_schedule_restart_hook(reason);
3425+
}
3426+
34213427
if (ZCSG(restart_pending)) {
34223428
/* don't schedule twice */
34233429
return;

ext/opcache/ZendAccelerator.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,9 @@ extern const char *zps_api_failure_reason;
311311
BEGIN_EXTERN_C()
312312

313313
void accel_shutdown(void);
314-
zend_result accel_activate(INIT_FUNC_ARGS);
314+
zend_result accel_activate(INIT_FUNC_ARGS);
315315
zend_result accel_post_deactivate(void);
316+
extern ZEND_EXT_API void (*zend_accel_schedule_restart_hook)(zend_accel_restart_reason reason);
316317
void zend_accel_schedule_restart(zend_accel_restart_reason reason);
317318
void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason);
318319
accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle, size_t *size);

0 commit comments

Comments
 (0)