Skip to content

Commit a2ac8f9

Browse files
committed
Changed to getenv, fixed error, and moved to new constructor
Also Removing Circleci
1 parent 47df414 commit a2ac8f9

File tree

8 files changed

+36
-54
lines changed

8 files changed

+36
-54
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ before_script:
1414
- cp include/configuration-template.php include/configuration.php
1515

1616
script:
17-
- phpunit test5.php
17+
- phpunit test.php

README.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
Git-Challenge
22
=============
3-
Version 5.4-5.6: [![Build Status](https://travis-ci.org/devinmatte/Git-Challenge.svg?branch=master)](https://travis-ci.org/devinmatte/Git-Challenge)
4-
5-
Version 7.0+: [![CircleCI](https://circleci.com/gh/devinmatte/Git-Challenge.svg?style=svg)](https://circleci.com/gh/devinmatte/Git-Challenge)
3+
[![Build Status](https://travis-ci.org/devinmatte/Git-Challenge.svg?branch=master)](https://travis-ci.org/devinmatte/Git-Challenge)
64

75
Gamification of Git Contributions for the use of either education or competition.
86

circle.yml

-12
This file was deleted.

include/configuration-template.php

+28-13
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,37 @@
1212
return isset($var) ? $var : $default;
1313
};
1414

15+
$CHALLENGE_DB_HOST = getenv('CHALLENGE_DB_HOST');
16+
$CHALLENGE_DB_USER = getenv('CHALLENGE_DB_USER');
17+
$CHALLENGE_DB_PASS = getenv('CHALLENGE_DB_PASS');
18+
$CHALLENGE_DB = getenv('CHALLENGE_DB');
19+
$CHALLENGE_GITHUB_ORG = getenv('CHALLENGE_GITHUB_ORG');
20+
$CHALLENGE_GITHUB_CLIENT = getenv('CHALLENGE_GITHUB_CLIENT');
21+
$CHALLENGE_GITHUB_SECRET = getenv('CHALLENGE_GITHUB_SECRET');
22+
$CHALLENGE_POOL = getenv('CHALLENGE_POOL');
23+
$CHALLENGE_DEBUG = getenv('CHALLENGE_DEBUG');
24+
$CHALLENGE_EVENT = getenv('CHALLENGE_EVENT');
25+
$CHALLENGE_CHALLENGES = getenv('CHALLENGE_CHALLENGES');
26+
$CHALLENGE_INFO = getenv('CHALLENGE_INFO');
27+
$CHALLENGE_MAXCALLS = getenv('CHALLENGE_MAXCALLS');
28+
1529
return (object)array(
16-
'host' => $get_data($_ENV['CHALLENGE_DB_HOST'], '127.0.0.1'),
17-
'username' => $get_data($_ENV['CHALLENGE_DB_USER'], 'root'),
18-
'password' => $get_data($_ENV['CHALLENGE_DB_PASS'], ''),
19-
'database' => $get_data($_ENV['CHALLENGE_DB'], 'gitchallenge'),
30+
'host' => $get_data($CHALLENGE_DB_HOST, '127.0.0.1'),
31+
'username' => $get_data($CHALLENGE_DB_USER, 'root'),
32+
'password' => $get_data($CHALLENGE_DB_PASS, ''),
33+
'database' => $get_data($CHALLENGE_DB, 'gitchallenge'),
2034
'git' => (object)array(
21-
'org' => $get_data($_ENV['CHALLENGE_GITHUB_ORG'], 'github-tools'),
22-
'client' => $get_data($_ENV['CHALLENGE_GITHUB_CLIENT'], ''),
23-
'secret' => $get_data($_ENV['CHALLENGE_GITHUB_SECRET'], '')
35+
'org' => $get_data($CHALLENGE_GITHUB_ORG, 'github-tools'),
36+
'client' => $get_data($CHALLENGE_GITHUB_CLIENT, ''),
37+
'secret' => $get_data($CHALLENGE_GITHUB_SECRET, '')
2438
),
2539
'options' => (object)array(
26-
'pool' => $get_data($_ENV['CHALLENGE_POOL'], true),
27-
'debug' => $get_data($_ENV['CHALLENGE_DEBUG'], false),
28-
'event' => $get_data($_ENV['CHALLENGE_EVENT'], false),
29-
'challenges' => $get_data($_ENV['CHALLENGE_CHALLENGES'], false),
30-
'info' => $get_data($_ENV['CHALLENGE_INFO'], true),
31-
'maxcalls' => $get_data($_ENV['CHALLENGE_MAXCALLS'], 1000)
40+
'pool' => $get_data($CHALLENGE_POOL, true),
41+
'debug' => $get_data($CHALLENGE_DEBUG, false),
42+
'event' => $get_data($CHALLENGE_EVENT, false),
43+
'challenges' => $get_data($CHALLENGE_CHALLENGES, false),
44+
'info' => $get_data($CHALLENGE_INFO, true),
45+
'maxcalls' => $get_data($CHALLENGE_MAXCALLS, 1000)
3246
),
3347
'points' => (object)array(
3448
'additions' => 1,
@@ -42,3 +56,4 @@
4256
'invalid-email-address' => 148100
4357
)
4458
);
59+

index.php

+1
Original file line numberDiff line numberDiff line change
@@ -441,3 +441,4 @@ class="label">GitHub</span></a>
441441
<?php
442442
mysqli_close($conn);
443443
?>
444+

main.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
class main
66
{
7-
public function main(mysqli $conn, $configs, Alert $alert)
7+
public function __construct(mysqli $conn, $configs, Alert $alert)
88
{
99
$GLOBALS['call_count'] = 0;
1010

@@ -149,12 +149,12 @@ public function closedIssue(mysqli $conn, $configs, Alert $alert, $opts, $repo,
149149

150150
public function commit(mysqli $conn, $configs, Alert $alert, $opts, $repo, $commit, $repo_empty)
151151
{
152-
if ($GLOBALS['call_count'] < $configs->options->maxcalls && !$repo_empty && !array_key_exists("message", $commit) && !array_key_exists($commit->author->login, $configs->blacklist)) {
152+
if ($GLOBALS['call_count'] < $configs->options->maxcalls && !$repo_empty && !array_key_exists("message", $commit)) {
153153
if (array_key_exists("author", $commit) && !empty($commit->author)) {
154154
$query = "SELECT * FROM Users WHERE id='" . $commit->author->id . "'";
155155
$result = $conn->query($query);
156156

157-
if ($configs->options->pool == true && $result->num_rows <= 0 && ($repo->fork != true && $repo->fork != "true")) {
157+
if ($configs->options->pool == true && $result->num_rows <= 0 && ($repo->fork != true && $repo->fork != "true") && !array_key_exists($commit->author->login, $configs->blacklist)) {
158158
$this->addUser($conn, $configs, $alert, $opts, $commit->author->url, $commit->author->login);
159159
}
160160

@@ -287,4 +287,4 @@ public function repo(mysqli $conn, $configs, Alert $alert, $opts, $obj, $repo)
287287
}
288288
}
289289

290-
}
290+
}

test5.php renamed to test.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
class test5
3+
class test
44
{
55

66
}

test7.php

-20
This file was deleted.

0 commit comments

Comments
 (0)