From 5073b246b92f3b4dc7ccb2b63fe4d475fed4f6f8 Mon Sep 17 00:00:00 2001 From: Guilherme Branco Stracini Date: Sat, 17 Feb 2024 23:41:46 +0000 Subject: [PATCH] Enhancements (#154) --- Src/composer.lock | 26 ++++++++++++-------------- Src/issues.php | 6 +----- Src/lib/functions.php | 23 +---------------------- Src/lib/queue.php | 4 ++-- Src/lib/request.php | 8 +++++--- 5 files changed, 21 insertions(+), 46 deletions(-) diff --git a/Src/composer.lock b/Src/composer.lock index 5a2ef42..7c939e5 100644 --- a/Src/composer.lock +++ b/Src/composer.lock @@ -8,21 +8,19 @@ "packages": [ { "name": "lcobucci/jwt", - "version": "5.1.0", + "version": "5.2.0", "source": { "type": "git", "url": "https://github.com/lcobucci/jwt.git", - "reference": "f0031c07b96db6a0ca649206e7eacddb7e9d5908" + "reference": "0ba88aed12c04bd2ed9924f500673f32b67a6211" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/lcobucci/jwt/zipball/f0031c07b96db6a0ca649206e7eacddb7e9d5908", - "reference": "f0031c07b96db6a0ca649206e7eacddb7e9d5908", + "url": "https://api.github.com/repos/lcobucci/jwt/zipball/0ba88aed12c04bd2ed9924f500673f32b67a6211", + "reference": "0ba88aed12c04bd2ed9924f500673f32b67a6211", "shasum": "" }, "require": { - "ext-hash": "*", - "ext-json": "*", "ext-openssl": "*", "ext-sodium": "*", "php": "~8.1.0 || ~8.2.0 || ~8.3.0", @@ -67,7 +65,7 @@ ], "support": { "issues": "https://github.com/lcobucci/jwt/issues", - "source": "https://github.com/lcobucci/jwt/tree/5.1.0" + "source": "https://github.com/lcobucci/jwt/tree/5.2.0" }, "funding": [ { @@ -79,7 +77,7 @@ "type": "patreon" } ], - "time": "2023-10-31T06:41:47+00:00" + "time": "2023-11-20T21:17:42+00:00" }, { "name": "paragonie/constant_time_encoding", @@ -200,16 +198,16 @@ }, { "name": "php-amqplib/php-amqplib", - "version": "v3.6.0", + "version": "v3.6.1", "source": { "type": "git", "url": "https://github.com/php-amqplib/php-amqplib.git", - "reference": "fb84e99589de0904a25861451b0552f806284ee5" + "reference": "76eee289e98b0b309a761787e65cbe1acbaf8c72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-amqplib/php-amqplib/zipball/fb84e99589de0904a25861451b0552f806284ee5", - "reference": "fb84e99589de0904a25861451b0552f806284ee5", + "url": "https://api.github.com/repos/php-amqplib/php-amqplib/zipball/76eee289e98b0b309a761787e65cbe1acbaf8c72", + "reference": "76eee289e98b0b309a761787e65cbe1acbaf8c72", "shasum": "" }, "require": { @@ -275,9 +273,9 @@ ], "support": { "issues": "https://github.com/php-amqplib/php-amqplib/issues", - "source": "https://github.com/php-amqplib/php-amqplib/tree/v3.6.0" + "source": "https://github.com/php-amqplib/php-amqplib/tree/v3.6.1" }, - "time": "2023-10-22T15:02:02+00:00" + "time": "2024-02-07T17:21:26+00:00" }, { "name": "phpseclib/phpseclib", diff --git a/Src/issues.php b/Src/issues.php index b75fbbb..cff6ed9 100644 --- a/Src/issues.php +++ b/Src/issues.php @@ -17,11 +17,7 @@ function handleIssue($issue) $issueResponse = requestGitHub($metadata["token"], $metadata["issuesUrl"]); $issueUpdated = json_decode($issueResponse["body"]); - if ($issueUpdated->state != "open") { - return; - } - - echo "Issue " . $issueUpdated->number . " - " . $issueUpdated->title . " is open\n"; + echo "Issue " . $issueUpdated->number . " - " . trim($issueUpdated->title) . " is " . $issueUpdated->state . "\n"; } function main() diff --git a/Src/lib/functions.php b/Src/lib/functions.php index d6b70a7..50bce00 100644 --- a/Src/lib/functions.php +++ b/Src/lib/functions.php @@ -24,28 +24,7 @@ function sendHealthCheck($token, $type = null) return; } - $headers = array(); - $headers[] = "User-Agent: " . USER_AGENT; - - $curl = curl_init(); - curl_setopt_array( - $curl, - array( - CURLOPT_URL => "https://hc-ping.com/" . $token . ($type == null ? "" : $type), - CURLOPT_RETURNTRANSFER => true, - CURLOPT_ENCODING => "", - CURLOPT_MAXREDIRS => 10, - CURLOPT_TIMEOUT => 0, - CURLOPT_FOLLOWLOCATION => true, - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, - CURLOPT_SSL_VERIFYPEER => false, - CURLOPT_SSL_VERIFYHOST => false, - CURLOPT_HTTPHEADER => $headers - - ) - ); - curl_exec($curl); - curl_close($curl); + doRequest("https://hc-ping.com/" . $token . ($type == null ? "" : $type)); } function toCamelCase($inputString) diff --git a/Src/lib/queue.php b/Src/lib/queue.php index e309ade..25258fd 100644 --- a/Src/lib/queue.php +++ b/Src/lib/queue.php @@ -34,7 +34,7 @@ function sendByLib($queueName, $payload) $channel->close(); $connection->close(); } catch (Exception $e) { - file_put_contents("rabbitmq.error_log", "[" . date("Y-m-d H:i:s") . "] ERROR sending: " . $e->getMessage() . "\n", FILE_APPEND); + file_put_contents("rabbitmq.error_log", "[" . date("Y-m-d H:i:s e") . "] ERROR sending " . $queueName . ": " . $e->getMessage() . "\n", FILE_APPEND); if (!is_dir("logs")) { mkdir("logs"); } @@ -79,6 +79,6 @@ function receiveByLib($queueName, $callback) $channel->close(); $connection->close(); } catch (Exception $e) { - file_put_contents("rabbitmq.error_log", "[" . date("Y-m-d H:i:s") . "] ERROR receiving: " . $e->getMessage() . "\n", FILE_APPEND); + file_put_contents("rabbitmq.error_log", "[" . date("Y-m-d H:i:s e") . "] ERROR receiving " . $queueName . ": " . $e->getMessage() . "\n", FILE_APPEND); } } diff --git a/Src/lib/request.php b/Src/lib/request.php index e8853c4..bde20fb 100644 --- a/Src/lib/request.php +++ b/Src/lib/request.php @@ -1,12 +1,14 @@ $url,