@@ -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 ;
190215if (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 ' ]),
0 commit comments