From 9c0a5603d3414c31d8967cd3cd38eed49afbd731 Mon Sep 17 00:00:00 2001 From: Jon Goldberg Date: Fri, 31 Jul 2020 17:39:49 -0400 Subject: [PATCH] all the various fixes to make update_redmine work --- .gitignore | 1 + oncall.php | 2 +- update_redmine.php | 13 ++++++------- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 9bed604..af6f996 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ contact.txt users.csv oncallbot.jpg +.vscode diff --git a/oncall.php b/oncall.php index d7dfe32..2c8cfee 100644 --- a/oncall.php +++ b/oncall.php @@ -79,7 +79,7 @@ class oncall { // Debug Mode will show more information. $this->debugMode = (bool) getenv('DEBUG_MODE'); $this->baseUrl = getenv('REDMINE_URL'); - $this->apiKey = getenv('KEY'); + $this->apiKey = getenv('REDMINE_API_KEY'); // FIXME: Not using $this->apiKey. $this->queries = [ diff --git a/update_redmine.php b/update_redmine.php index ae546a8..cf8f54d 100644 --- a/update_redmine.php +++ b/update_redmine.php @@ -1,4 +1,3 @@ -#!/usr/bin/php debugMode = (bool) getenv('DEBUG_MODE'); $this->baseUrl = getenv('REDMINE_URL'); - $this->apiKey = getenv('KEY'); - $this->setAction($action); + $this->apiKey = getenv('REDMINE_API_KEY'); + $this->setAction($_GET['action']); } public function setAction($action) { $validActions = [ 'do_not_alert' => 'PUT', ]; - if ($validActions['$action'] ?? FALSE) { + if ($validActions[$action] ?? FALSE) { $this->action = $action; $this->httpMethod = $validActions[$action]; } @@ -83,10 +82,10 @@ class update_redmine { public function prepareAction() { if ($this->action === 'do_not_alert') { $this->json = '{"issue": {"custom_fields": [{"id": 4, "value": "1"}]}}'; - if (is_int($_GET['issue'])) { - $issue = $GET['issue']; + if (is_numeric($_GET['issue'])) { + $issue = $_GET['issue']; } - $this->fullUrl = $this->baseUrl . "/$issue.json"; + $this->fullUrl = $this->baseUrl . "/issues/$issue.json"; } }