cvs: php-src /win32 wsyslog.c /win32/build Makefile config.w32 registersyslog.php wsyslog.mc

From: Date: Sat, 31 Jul 2004 23:59:46 +0000
Subject: cvs: php-src /win32 wsyslog.c /win32/build Makefile config.w32 registersyslog.php wsyslog.mc
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-28124@lists.php.net to get a copy of this message
wez Sat Jul 31 19:59:46 2004 EDT Added files: /php-src/win32/build registersyslog.php wsyslog.mc Modified files: /php-src/win32 wsyslog.c /php-src/win32/build Makefile config.w32 Log: Fix bug #8314: sane syslog output to the WinNT event log. Big fat note: if you're building from a .dsp, you need to replicate the custom build step that uses MC to generate the message catalog To make use of this fix, you need to register the event source; running "nmake install" will handle this for you (if you also build the win32std extension from pecl). I'll arrange with Phil to have the installer handle this registration too. http://cvs.php.net/diff.php/php-src/win32/wsyslog.c?r1=1.5&r2=1.6&ty=u Index: php-src/win32/wsyslog.c diff -u php-src/win32/wsyslog.c:1.5 php-src/win32/wsyslog.c:1.6 --- php-src/win32/wsyslog.c:1.5 Wed Jul 28 22:59:43 2004 +++ php-src/win32/wsyslog.c Sat Jul 31 19:59:46 2004 @@ -57,6 +57,7 @@ #include <process.h> #include "php_win32_globals.h" +#include "wsyslog.h" void closelog(void) { @@ -78,6 +79,7 @@ LPTSTR strs[2]; unsigned short etype; char *tmp = NULL; + DWORD evid; TSRMLS_FETCH(); /* default event source */ @@ -87,19 +89,22 @@ switch (priority) { /* translate UNIX type into NT type */ case LOG_ALERT: etype = EVENTLOG_ERROR_TYPE; + evid = PHP_SYSLOG_ERROR_TYPE; break; case LOG_INFO: etype = EVENTLOG_INFORMATION_TYPE; + evid = PHP_SYSLOG_INFO_TYPE; break; default: etype = EVENTLOG_WARNING_TYPE; + evid = PHP_SYSLOG_WARNING_TYPE; } va_start(args, message); /* initialize vararg mechanism */ vspprintf(&tmp, 0, message, args); /* build message */ strs[0] = PW32G(log_header); /* write header */ strs[1] = tmp; /* then the message */ /* report the event */ - ReportEvent(PW32G(log_source), etype, (unsigned short) priority, 2000, NULL, 2, 0, strs, NULL); + ReportEvent(PW32G(log_source), etype, (unsigned short) priority, evid, NULL, 2, 0, strs, NULL); va_end(args); efree(tmp); } @@ -121,6 +126,6 @@ STR_FREE(PW32G(log_header)); - PW32G(log_source) = RegisterEventSource(NULL, ident); + PW32G(log_source) = RegisterEventSource(NULL, "PHP-" PHP_VERSION); spprintf(&PW32G(log_header), 0, (logopt & LOG_PID) ? "%s[%d]" : "%s", ident, getpid()); } http://cvs.php.net/diff.php/php-src/win32/build/Makefile?r1=1.23&r2=1.24&ty=u Index: php-src/win32/build/Makefile diff -u php-src/win32/build/Makefile:1.23 php-src/win32/build/Makefile:1.24 --- php-src/win32/build/Makefile:1.23 Tue May 25 08:57:45 2004 +++ php-src/win32/build/Makefile Sat Jul 31 19:59:46 2004 @@ -14,11 +14,12 @@ # | Author: Wez Furlong <wez@thebrainroom.com> | # +----------------------------------------------------------------------+ # -# $Id: Makefile,v 1.23 2004/05/25 12:57:45 wez Exp $ +# $Id: Makefile,v 1.24 2004/07/31 23:59:46 wez Exp $ # This is the makefile template for the win32 build CC="$(CL)" LD="$(LINK)" +MC="$(MC)" all: $(BUILD_DIR) $(BUILD_DIRS_SUB) generated_files $(EXT_TARGETS) $(PECL_TARGETS) $(SAPI_TARGETS) @@ -48,13 +49,19 @@ PHPDLL_RES=$(BUILD_DIR)\$(PHPDLL).res +MCFILE=$(BUILD_DIR)\wsyslog.res + +$(MCFILE): win32\build\wsyslog.mc + $(MC) -h win32\ -r $(BUILD_DIR)\ -x $(BUILD_DIR)\ win32\build\wsyslog.mc + $(RC) /fo $(MCFILE) $(BUILD_DIR)\wsyslog.rc + $(PHPDLL_RES): win32\build\template.rc $(RC) /fo $(PHPDLL_RES) /d FILE_DESCRIPTION="\"PHP Script Interpreter\"" \ /d FILE_NAME="\"$(PHPDLL)\"" /d PRODUCT_NAME="\"PHP Script Interpreter\"" \ - win32\build\template.rc + win32\build\template.rc -$(BUILD_DIR)\$(PHPDLL): $(PHPDEF) $(PHP_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(PHPDLL_RES) - $(LD) /out:$(BUILD_DIR)\$(PHPDLL) $(PHP_LDFLAGS) $(LDFLAGS) $(STATIC_EXT_LDFLAGS) $(PHP_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(STATIC_EXT_LIBS) $(LIBS) $(PHPDLL_RES) +$(BUILD_DIR)\$(PHPDLL): $(PHPDEF) $(PHP_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(PHPDLL_RES) $(MCFILE) + $(LD) /out:$(BUILD_DIR)\$(PHPDLL) $(PHP_LDFLAGS) $(LDFLAGS) $(STATIC_EXT_LDFLAGS) $(PHP_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(STATIC_EXT_LIBS) $(LIBS) $(PHPDLL_RES) $(MCFILE) $(BUILD_DIR)\$(PHPLIB): $(BUILD_DIR)\$(PHPDLL) @@ -113,8 +120,13 @@ msi-installer: dist $(BUILD_DIR)\php.exe ..\php-installer\build-installer.php "$(BUILD_DIR)" "$(PHPDLL)" "$(SAPI_TARGETS)" "$(EXT_TARGETS)" "$(PECL_TARGETS)" -install: all +# need to redirect, since INSTALL is a file in the root... +install: really-install + +really-install: @if not exist $(PHP_PREFIX) mkdir $(PHP_PREFIX) @copy $(BUILD_DIR)\*.exe $(PHP_PREFIX) /y >nul @copy $(BUILD_DIR)\*.dll $(PHP_PREFIX) /y >nul - + $(PHP_PREFIX)\php.exe -n -dextension_dir=$(PHP_PREFIX) win32/build/registersyslog.php $(PHP_PREFIX)\$(PHPDLL) + + http://cvs.php.net/diff.php/php-src/win32/build/config.w32?r1=1.27&r2=1.28&ty=u Index: php-src/win32/build/config.w32 diff -u php-src/win32/build/config.w32:1.27 php-src/win32/build/config.w32:1.28 --- php-src/win32/build/config.w32:1.27 Wed Jul 28 22:59:44 2004 +++ php-src/win32/build/config.w32 Sat Jul 31 19:59:46 2004 @@ -1,5 +1,5 @@ // vim:ft=javascript -// $Id: config.w32,v 1.27 2004/07/29 02:59:44 wez Exp $ +// $Id: config.w32,v 1.28 2004/07/31 23:59:46 wez Exp $ // "Master" config file; think of it as a configure.in // equivalent. @@ -16,6 +16,7 @@ PATH_PROG('re2c'); PATH_PROG('zip'); PATH_PROG('lemon'); +PATH_PROG('mc'); ARG_ENABLE('debug', 'Compile with debugging symbols', "no"); ARG_ENABLE('zts', 'Thread safety', 'yes'); http://cvs.php.net/co.php/php-src/win32/build/registersyslog.php?r=1.1&p=1 Index: php-src/win32/build/registersyslog.php +++ php-src/win32/build/registersyslog.php <?php /* This script sets up an event source for use by the php syslog() function. */ if (!extension_loaded("win32std")) { dl("php_win32std.dll") or die("b0rk"); } $PATH = "SYSTEM\\CurrentControlSet\\Services\\Eventlog\\Application\\PHP-" . phpversion(); $key = @reg_create_key(HKEY_LOCAL_MACHINE, $PATH, KEY_ALL_ACCESS); if (!$key) $key = reg_open_key(HKEY_LOCAL_MACHINE, $PATH, KEY_ALL_ACCESS); if ($key) { reg_set_value($key, "TypesSupported", REG_DWORD, 7) or die("Types"); reg_set_value($key, "EventMessageFile", REG_SZ, $argv[1]) or die("EventMessageFile"); define_syslog_variables(); syslog(LOG_NOTICE, "Registered PHP Event source"); } else { echo "Could not register event source\n"; } ?> http://cvs.php.net/co.php/php-src/win32/build/wsyslog.mc?r=1.1&p=1 Index: php-src/win32/build/wsyslog.mc +++ php-src/win32/build/wsyslog.mc MessageId=1 Severity=Success SymbolicName=PHP_SYSLOG_SUCCESS_TYPE Language=English %1 %2

« previous php.cvs (#28124) next »