]> granicus.if.org Git - php/commitdiff
Use regedit to register event source
authorChristoph M. Becker <cmbecker69@gmx.de>
Thu, 18 Jul 2019 07:06:10 +0000 (09:06 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Thu, 18 Jul 2019 07:10:48 +0000 (09:10 +0200)
ext/win32std is unmaintained for years, so it is highly unlikely that
it is available.  We therefore use regedit instead to register the
event source.  We also remove the bundled syslog.reg, since it is of no
use, unless generated for the respective installation.

.gitignore
win32/build/Makefile
win32/build/registersyslog.php
win32/syslog.reg [deleted file]

index cc4481db6b76be5152ec12a4d502cc5c47d7276a..250a23efa2654269daf6e2a1ee1ecf04b10aa9e3 100644 (file)
@@ -208,6 +208,7 @@ php
 /win32/*.positions
 /win32/*.suo
 /win32/ext
+/win32/syslog.reg
 /win32/wsyslog.h
 
 # Standard object files generated by Visual Studio
index 26b73b625ac678ac85367d6745c1bd4c4dacff76..9435df5c461b21a6b89e69a60cb8a91c6143b059 100644 (file)
@@ -264,3 +264,4 @@ really-install:
        @echo Registering event source with syslog (requires admin rights)
        @echo It's okay for this step to fail:
        -$(PHP_PREFIX)\php.exe -n -dextension_dir=$(PHP_PREFIX) win32/build/registersyslog.php $(PHP_PREFIX)\$(PHPDLL)
+       -regedit /s win32\syslog.reg
index ce28cbf42015aa53bcfeb964d1d05d1b6f2fbf61..fa8503a4b81f64289949eb09fbde48ed6ea128e4 100755 (executable)
@@ -1,33 +1,10 @@
 <?php
 
-/* This script sets up an event source for use by the php syslog() function. */
-
-if (!extension_loaded("win32std")) {
-       @dl("php_win32std.dll");
-}
+/* This script generates the .reg file to set up an event source for use by the php syslog() function. */
 
 $PATH = "SYSTEM\\CurrentControlSet\\Services\\Eventlog\\Application\\PHP-" . phpversion();
 
 $dll = $argv[1];
-
-if (extension_loaded("win32std")) {
-       $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, $dll) or die("EventMessageFile");
-
-               syslog(LOG_NOTICE, "Registered PHP Event source");
-       } else {
-               echo "Could not register event source\n";
-       }
-}
-
-/* let's also generate/update the bundled .reg file */
-
 $dll = addslashes($dll);
 
 file_put_contents("win32/syslog.reg", <<<REG
@@ -40,5 +17,4 @@ REGEDIT4
 REG
 );
 
-
 ?>
diff --git a/win32/syslog.reg b/win32/syslog.reg
deleted file mode 100644 (file)
index a817b52..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-REGEDIT4
-
-[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\PHP-7.3.0-dev]
-"TypesSupported"=dword:00000007
-"EventMessageFile"="g:\\test\\srctrunkinstall\\php7ts.dll"