Skip to content

Commit 548dfcc

Browse files
author
mreishman
committed
Auto works
1 parent 8f8fb33 commit 548dfcc

File tree

5 files changed

+72
-15
lines changed

5 files changed

+72
-15
lines changed

core/html/changelog.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
<ul>
2+
<li>
3+
Version 4.1.2
4+
<ul>
5+
<li>
6+
Features
7+
<ul>
8+
<li>
9+
Added option for auto get repo name from poll requests (Only works with poll type 2)
10+
</li>
11+
<li>
12+
Added option for auto get repo type from poll requests (Only works with poll type 2)
13+
</li>
14+
</ul>
15+
</li>
16+
</ul>
17+
</li>
218
<li>
319
Version 4.1.1
420
<ul>

core/php/configStatic.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<?php
33

44
$configStatic = array(
5-
'version' => '4.1.1',
5+
'version' => '4.1.2',
66
'lastCheck' => '12-14-2018',
77
'newestVersion' => '3.3.4',
88
'versionList' => array(

core/php/functions/gitBranchName.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,31 @@ function getBranchStats($location)
186186
return substr($branchStats, 0, strpos($branchStats, "}"));
187187
}
188188

189+
function getRepo($location)
190+
{
191+
$function = "git --git-dir=".escapeshellarg($location).".git config --get remote.origin.url";
192+
$repoName = trim(shell_exec($function));
193+
$secondHalf = basename($repoName, ".git");
194+
$repoName = implode("", explode($secondHalf.".git", $repoName));
195+
$firstHalf = basename($repoName);
196+
return $firstHalf."/".$secondHalf;
197+
}
198+
199+
function getGitType($location)
200+
{
201+
$function = "git --git-dir=".escapeshellarg($location).".git config --get remote.origin.url";
202+
$gitType = trim(shell_exec($function));
203+
if(strpos($gitType, "github.com"))
204+
{
205+
return "github";
206+
}
207+
elseif(strpos($gitType, "gitlab"))
208+
{
209+
return "gitlab";
210+
}
211+
return false;
212+
}
213+
189214
$pollType = null;
190215
if(isset($_POST['pollType']))
191216
{
@@ -280,6 +305,14 @@ function getBranchStats($location)
280305
{
281306
$websiteBase = str_replace("gitBranchName.php", "", $value["urlHit"]);
282307
}
308+
if($value["githubRepo"] === "auto")
309+
{
310+
$value["githubRepo"] = getRepo($value["Folder"]);
311+
}
312+
if($value["gitType"] === "auto")
313+
{
314+
$value["gitType"] = getGitType($value["Folder"]);
315+
}
283316
$response["info"][$key] = array(
284317
'isHere' => true,
285318
'branch' => getBranchName($value['Folder']),

core/php/functions/watchlistFunctions.php

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,24 @@ function generateWatchlistBlock($defaultArray, $arrayKeys, $key = "{{key}}", $it
103103
if(!empty($item))
104104
{
105105
$stringToReturn .= "
106-
<option value=\"github\" ";
107-
if($varValue === "github")
108-
{
109-
$stringToReturn .= " selected ";
110-
}
111-
$stringToReturn .= " >GitHub</option>
112-
<option value=\"gitlab\" ";
113-
if($varValue === "gitlab")
114-
{
115-
$stringToReturn .= "selected";
116-
}
117-
$stringToReturn .= ">GitLab</option>";
106+
<option value=\"auto\" ";
107+
if($varValue === "auto")
108+
{
109+
$stringToReturn .= " selected ";
110+
}
111+
$stringToReturn .= " >Auto (v2 Only)</option>
112+
<option value=\"github\" ";
113+
if($varValue === "github")
114+
{
115+
$stringToReturn .= " selected ";
116+
}
117+
$stringToReturn .= " >GitHub</option>
118+
<option value=\"gitlab\" ";
119+
if($varValue === "gitlab")
120+
{
121+
$stringToReturn .= "selected";
122+
}
123+
$stringToReturn .= ">GitLab</option>";
118124
}
119125
else
120126
{

core/php/templateFiles/watchListServer.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@
3030
</div>
3131
<span class="leftSpacingserverNames" > Git Repo:</span> <input disabled="true" class='inputWidth300' type='text' value='Name of your github repo: username/repo'>
3232
<br>
33+
<span>Put "auto" to automatically get the repo config on poll</span>
34+
<br>
3335
<span class="leftSpacingserverNames" > Branch List:</span> <input disabled="true" class='inputWidth300' type='text' value='Compare branches list example: master , develop'>
3436
<br>
3537
<span class="leftSpacingserverNames" > Git Type:</span>
3638
<select disabled="true" class='inputWidth300' >
37-
<option value="local" >github</option>
38-
<option value="external" >gitlab</option>
39+
<option value="github" >github</option>
40+
<option value="gitlab" >gitlab</option>
3941
</select>
4042
<br>
4143
<span class="leftSpacingserverNames" > Custom Git:</span> <input disabled="true" class='inputWidth300' type='text' value='Custom url for git. Empty = default'>

0 commit comments

Comments
 (0)