From da7d046f988df6a980a2a880216292831f8b9b07 Mon Sep 17 00:00:00 2001 From: Kyle Spier-Swenson Date: Tue, 31 Oct 2017 13:31:22 -0700 Subject: [PATCH 1/3] Improves php logging --- tools/WebhookProcessor/github_webhook_processor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/WebhookProcessor/github_webhook_processor.php b/tools/WebhookProcessor/github_webhook_processor.php index 20d5631b739..860616b510b 100644 --- a/tools/WebhookProcessor/github_webhook_processor.php +++ b/tools/WebhookProcessor/github_webhook_processor.php @@ -42,7 +42,7 @@ set_error_handler(function($severity, $message, $file, $line) { set_exception_handler(function($e) { header('HTTP/1.1 500 Internal Server Error'); echo "Error on line {$e->getLine()}: " . htmlSpecialChars($e->getMessage()); - file_put_contents('htwebhookerror.log', "Error on line {$e->getLine()}: " . $e->getMessage(), FILE_APPEND); + file_put_contents('htwebhookerror.log', '['.date(DATE_ATOM).'] '."Error on line {$e->getLine()}: " . $e->getMessage().PHP_EOL, FILE_APPEND); die(); }); $rawPost = NULL; From 7ce48884f2cf5130c2c88b3cb9c7021125465563 Mon Sep 17 00:00:00 2001 From: Kyle Spier-Swenson Date: Tue, 31 Oct 2017 13:44:56 -0700 Subject: [PATCH 2/3] Fix the error. --- tools/WebhookProcessor/github_webhook_processor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/WebhookProcessor/github_webhook_processor.php b/tools/WebhookProcessor/github_webhook_processor.php index 860616b510b..bb853d6ddf9 100644 --- a/tools/WebhookProcessor/github_webhook_processor.php +++ b/tools/WebhookProcessor/github_webhook_processor.php @@ -561,7 +561,7 @@ function has_tree_been_edited($payload, $tree){ get_diff($payload); //find things in the _maps/map_files tree //e.g. diff --git a/_maps/map_files/Cerestation/cerestation.dmm b/_maps/map_files/Cerestation/cerestation.dmm - return $github_diff !== FALSE && preg_match('/^diff --git a\/' . preg_quote($tree, '/') . '/m') !== FALSE; + return $github_diff !== FALSE && preg_match('/^diff --git a\/' . preg_quote($tree, '/') . '/m', $github_diff) !== FALSE; } $no_changelog = false; From 3d6e9a72c107fdee48a366b7d6077419c3d2ad43 Mon Sep 17 00:00:00 2001 From: Kyle Spier-Swenson Date: Tue, 31 Oct 2017 13:50:50 -0700 Subject: [PATCH 3/3] Fixes the other thing --- tools/WebhookProcessor/github_webhook_processor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/WebhookProcessor/github_webhook_processor.php b/tools/WebhookProcessor/github_webhook_processor.php index bb853d6ddf9..62446d707ca 100644 --- a/tools/WebhookProcessor/github_webhook_processor.php +++ b/tools/WebhookProcessor/github_webhook_processor.php @@ -561,7 +561,7 @@ function has_tree_been_edited($payload, $tree){ get_diff($payload); //find things in the _maps/map_files tree //e.g. diff --git a/_maps/map_files/Cerestation/cerestation.dmm b/_maps/map_files/Cerestation/cerestation.dmm - return $github_diff !== FALSE && preg_match('/^diff --git a\/' . preg_quote($tree, '/') . '/m', $github_diff) !== FALSE; + return ($github_diff !== FALSE) && (preg_match('/^diff --git a\/' . preg_quote($tree, '/') . '/m', $github_diff) !== 0); } $no_changelog = false;