all the various fixes to make update_redmine work
This commit is contained in:
parent
1925b5b4b0
commit
9c0a5603d3
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@
|
||||
contact.txt
|
||||
users.csv
|
||||
oncallbot.jpg
|
||||
.vscode
|
||||
|
@ -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 = [
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
declare(strict_types = 1);
|
||||
require_once 'vendor/autoload.php';
|
||||
@ -63,15 +62,15 @@ class update_redmine {
|
||||
// Debug Mode will show more information.
|
||||
$this->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";
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user