]> granicus.if.org Git - php/commitdiff
Turn accel_activate into module callback.
authorDmitry Stogov <dmitry@zend.com>
Mon, 1 Oct 2018 11:10:54 +0000 (14:10 +0300)
committerDmitry Stogov <dmitry@zend.com>
Mon, 1 Oct 2018 11:10:54 +0000 (14:10 +0300)
ext/opcache/ZendAccelerator.c
ext/opcache/ZendAccelerator.h
ext/opcache/zend_accelerator_module.c

index 6a0d991df714b4164465a1cf140e5ffd4de032ac..fdaa9aecc0adce44a5b2c8145776b1bf16f224be 100644 (file)
@@ -2293,12 +2293,12 @@ static void accel_reset_pcre_cache(void)
        } ZEND_HASH_FOREACH_END();
 }
 
-static void accel_activate(void)
+int accel_activate(INIT_FUNC_ARGS)
 {
        zend_bool reset_pcre = 0;
 
        if (!ZCG(enabled) || !accel_startup_ok) {
-               return;
+               return SUCCESS;
        }
 
        /* PHP-5.4 and above return "double", but we use 1 sec precision */
@@ -2315,7 +2315,7 @@ static void accel_activate(void)
 
 #ifdef HAVE_OPCACHE_FILE_CACHE
        if (file_cache_only) {
-               return;
+               return SUCCESS;
        }
 #endif
 
@@ -2333,7 +2333,7 @@ static void accel_activate(void)
                                        zend_alter_ini_entry_chars(key, "0", 1, ZEND_INI_SYSTEM, ZEND_INI_STAGE_RUNTIME);
                                        zend_string_release_ex(key, 0);
                                        zend_accel_error(ACCEL_LOG_WARNING, "Can't cache files in chroot() directory with too big inode");
-                                       return;
+                                       return SUCCESS;
                                }
                        }
                }
@@ -2410,6 +2410,8 @@ static void accel_activate(void)
        } else if (reset_pcre) {
                accel_reset_pcre_cache();
        }
+
+       return SUCCESS;
 }
 
 int accel_post_deactivate(void)
@@ -3026,7 +3028,7 @@ ZEND_EXT_API zend_extension zend_extension_entry = {
        "Copyright (c) 1999-2018",                              /* copyright */
        accel_startup,                                                  /* startup */
        NULL,                                                                   /* shutdown */
-       accel_activate,                                                 /* per-script activation */
+       NULL,                                                                   /* per-script activation */
        NULL,                                                                   /* per-script deactivation */
        NULL,                                                                   /* message handler */
        NULL,                                                                   /* op_array handler */
index 26dc0a6e8f183e2f6e87d429c6a16a9c28a5bd6a..f48c3779f28f86bea0ea774a448069a4ec100e45 100644 (file)
@@ -313,6 +313,7 @@ extern zend_accel_globals accel_globals;
 extern char *zps_api_failure_reason;
 
 void accel_shutdown(void);
+int  accel_activate(INIT_FUNC_ARGS);
 int  accel_post_deactivate(void);
 void zend_accel_schedule_restart(zend_accel_restart_reason reason);
 void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason);
index b4db8cb1c8aead94f92f980cfb95234383de5a84..79af9a3c67dcd3246e8eb03b83934aa2aa0f7f82 100644 (file)
@@ -521,7 +521,7 @@ static zend_module_entry accel_module_entry = {
        accel_functions,
        ZEND_MINIT(zend_accelerator),
        ZEND_MSHUTDOWN(zend_accelerator),
-       NULL,
+       accel_activate,
        NULL,
        zend_accel_info,
        PHP_VERSION,