@@ -177,8 +177,37 @@ static ZEND_INI_MH(OnUpdateMaxWastedPercentage)
177
177
return SUCCESS ;
178
178
}
179
179
180
+ static ZEND_INI_MH (OnEnable )
181
+ {
182
+ if (stage == ZEND_INI_STAGE_STARTUP ||
183
+ stage == ZEND_INI_STAGE_SHUTDOWN ||
184
+ stage == ZEND_INI_STAGE_DEACTIVATE ) {
185
+ return OnUpdateBool (entry , new_value , new_value_length , mh_arg1 , mh_arg2 , mh_arg3 , stage TSRMLS_CC );
186
+ } else {
187
+ /* It may be only temporary disabled */
188
+ zend_bool * p ;
189
+ #ifndef ZTS
190
+ char * base = (char * ) mh_arg2 ;
191
+ #else
192
+ char * base = (char * ) ts_resource (* ((int * ) mh_arg2 ));
193
+ #endif
194
+
195
+ p = (zend_bool * ) (base + (size_t ) mh_arg1 );
196
+ if ((new_value_length == 2 && strcasecmp ("on" , new_value ) == 0 ) ||
197
+ (new_value_length == 3 && strcasecmp ("yes" , new_value ) == 0 ) ||
198
+ (new_value_length == 4 && strcasecmp ("true" , new_value ) == 0 ) ||
199
+ atoi (new_value ) != 0 ) {
200
+ zend_error (E_WARNING , ACCELERATOR_PRODUCT_NAME " can't be temporary enabled (it may be only disabled till the end of request)" );
201
+ return FAILURE ;
202
+ } else {
203
+ * p = 0 ;
204
+ return SUCCESS ;
205
+ }
206
+ }
207
+ }
208
+
180
209
ZEND_INI_BEGIN ()
181
- STD_PHP_INI_BOOLEAN ("opcache.enable" , "1" , PHP_INI_SYSTEM , OnUpdateBool , enabled , zend_accel_globals , accel_globals )
210
+ STD_PHP_INI_BOOLEAN ("opcache.enable" , "1" , PHP_INI_ALL , OnEnable , enabled , zend_accel_globals , accel_globals )
182
211
STD_PHP_INI_BOOLEAN ("opcache.use_cwd" , "1" , PHP_INI_SYSTEM , OnUpdateBool , accel_directives .use_cwd , zend_accel_globals , accel_globals )
183
212
STD_PHP_INI_BOOLEAN ("opcache.validate_timestamps" , "1" , PHP_INI_ALL , OnUpdateBool , accel_directives .validate_timestamps , zend_accel_globals , accel_globals )
184
213
STD_PHP_INI_BOOLEAN ("opcache.inherited_hack" , "1" , PHP_INI_SYSTEM , OnUpdateBool , accel_directives .inherited_hack , zend_accel_globals , accel_globals )
0 commit comments