PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2004, PHP 5.1.0
+- Add SAPI hook to get the current request time. (Rasmus)
- Fixed bug #29522 (accessing properties without connection) (Georg)
- Fixed bug #29335 (fetch functions now use MYSQLI_BOTH as default) (Georg)
- Fixed bug #29311 (calling parent constructor in mysqli). (Georg)
#ifdef ZTS
#include "TSRM.h"
#endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
#include "rfc1867.h"
}
}
-
SAPI_API char *sapi_getenv(char *name, size_t name_len TSRMLS_DC)
{
if (sapi_module.getenv) {
}
}
+SAPI_API time_t sapi_get_request_time(TSRMLS_D)
+{
+ if (sapi_module.get_request_time) {
+ return sapi_module.get_request_time(TSRMLS_C);
+ } else {
+ if(!SG(global_request_time)) SG(global_request_time) = time(0);
+ return SG(global_request_time);
+ }
+}
/*
* Local variables:
long post_max_size;
int options;
zend_bool sapi_started;
+ time_t global_request_time;
} sapi_globals_struct;
SAPI_API int sapi_get_target_uid(uid_t * TSRMLS_DC);
SAPI_API int sapi_get_target_gid(gid_t * TSRMLS_DC);
+SAPI_API time_t sapi_get_request_time(TSRMLS_D);
END_EXTERN_C()
struct _sapi_module_struct {
void (*register_server_variables)(zval *track_vars_array TSRMLS_DC);
void (*log_message)(char *message);
+ time_t (*get_request_time)(TSRMLS_D);
char *php_ini_path_override;
}
/* }}} */
+/* {{{ php_apache_get_request_time
+ */
+static time_t php_apache_get_request_time(TSRMLS_D)
+{
+ return ((request_rec *)SG(server_context))->request_time;
+}
+/* }}} */
+
/* {{{ sapi_module_struct apache_sapi_module
*/
static sapi_module_struct apache_sapi_module = {
sapi_apache_register_server_variables, /* register server variables */
php_apache_log_message, /* Log message */
+ php_apache_get_request_time, /* Get request time */
NULL, /* php.ini path override */
return OK;
}
+static time_t
+php_apache_sapi_get_request_time(void)
+{
+ php_struct *ctx = SG(server_context);
+ TSRMLS_FETCH();
+
+ return ctx->r->request_time;
+}
+
extern zend_module_entry php_apache_module;
static int php_apache2_startup(sapi_module_struct *sapi_module)
php_apache_sapi_register_variables,
php_apache_sapi_log_message, /* Log message */
+ php_apache_sapi_get_request_time, /* Get Request Time */
STANDARD_SAPI_MODULE_PROPERTIES
};
}
}
+static time_t php_apache_sapi_get_request_time(void) {
+ php_struct *ctx = SG(server_context);
+ TSRMLS_FETCH();
+
+ return ctx->r->request_time;
+}
+
extern zend_module_entry php_apache_module;
static int php_apache2_startup(sapi_module_struct *sapi_module)
php_apache_sapi_register_variables,
php_apache_sapi_log_message, /* Log message */
+ php_apache_sapi_get_request_time, /* Request Time */
STANDARD_SAPI_MODULE_PROPERTIES
};