From a7cfa5f6643821a2f26835e0f543f373008fc294 Mon Sep 17 00:00:00 2001 From: Paul J R Date: Sat, 27 Oct 2012 03:41:46 +1100 Subject: [PATCH] replacing the cli cmds with variables and configuration in config.php --- gwvpmini/gwvpmini_debug.php | 22 +++++++++++++++++----- gwvpmini/gwvpmini_gitrepo.php | 24 ++++++++++++++---------- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/gwvpmini/gwvpmini_debug.php b/gwvpmini/gwvpmini_debug.php index cd70c6f..e45404c 100644 --- a/gwvpmini/gwvpmini_debug.php +++ b/gwvpmini/gwvpmini_debug.php @@ -44,11 +44,23 @@ function gwvpmini_DebugPageBody() } echo "
Sending some messages for db
"; - gwvpmini_SendMessageByDb("info", "message 1", $_SESSION["id"]); - gwvpmini_SendMessageByDb("error", "message 1", $_SESSION["id"]); - gwvpmini_SendMessageByDb("info", "message 1", $_SESSION["id"]); - gwvpmini_SendMessageByDb("error", "message really really reallyrea rea asdf asdf asdf asdf asdf qwef asdf asdr qwef asdf qwef asdf asd fqwe fqs dfa sdf qwe fa sdf asd fq wef qdwf asdf qwe fa sdf asdf a ewfqa wesf awefqefd", $_SESSION["id"]); - gwvpmini_SendMessageByDb("info", "message 1 sdfg sdfgs fdg sdfg sdfg sdfg sdfg sdfg sdfgwqerg fb sdvbefd wqerg zsdafg asdfgargf aerg afg agfs qrgasg agf wergafgs sag arg arg asgd arg argsa garg aerg sad gf ar gfasdg asd aweg asasd", $_SESSION["id"]); + //gwvpmini_SendMessageByDb("info", "message 1", $_SESSION["id"]); + //gwvpmini_SendMessageByDb("error", "message 1", $_SESSION["id"]); + //gwvpmini_SendMessageByDb("info", "message 1", $_SESSION["id"]); + //gwvpmini_SendMessageByDb("error", "message really really reallyrea rea asdf asdf asdf asdf asdf qwef asdf asdr qwef asdf qwef asdf asd fqwe fqs dfa sdf qwe fa sdf asd fq wef qdwf asdf qwe fa sdf asdf a ewfqa wesf awefqefd", $_SESSION["id"]); + //gwvpmini_SendMessageByDb("info", "message 1 sdfg sdfgs fdg sdfg sdfg sdfg sdfg sdfg sdfgwqerg fb sdvbefd wqerg zsdafg asdfgargf aerg afg agfs qrgasg agf wergafgs sag arg arg asgd arg argsa garg aerg sad gf ar gfasdg asd aweg asasd", $_SESSION["id"]); echo "done
"; + + $repo_base = gwvpmini_getConfigVal("repodir"); + + $repos = glob("$repo_base/*.git"); + + foreach($repos as $repo) { + $bn = substr(basename($repo), 0, -4); + echo "Repo: $repo, $bn
"; + echo "reflist:
".print_r(gwvpmini_GetRefList($bn),true)."
"; + } + + } ?> \ No newline at end of file diff --git a/gwvpmini/gwvpmini_gitrepo.php b/gwvpmini/gwvpmini_gitrepo.php index 01a6862..3c19507 100644 --- a/gwvpmini/gwvpmini_gitrepo.php +++ b/gwvpmini/gwvpmini_gitrepo.php @@ -150,7 +150,8 @@ function gwvpmini_RepoMainPageBody() function gwvpmini_GitLogProvider() -{ +{ + global $cmd_line_tool,$git_cli_cmd,$php_cli_cmd; /* * The home page provider will: * 1) show the last 10 commits for every repository - though, excluding private repos @@ -180,7 +181,7 @@ function gwvpmini_GitLogProvider() echo "$name$desc"; echo ""; $repo_base = gwvpmini_getConfigVal("repodir"); - $cmd = "git --git-dir=\"$repo_base/$name.git\" log --all -1 2> /dev/null"; + $cmd = "$git_cli_cmd --git-dir=\"$repo_base/$name.git\" log --all -1 2> /dev/null"; // error_log("CMD: $cmd"); //system("$cmd"); $fls = popen($cmd, "r"); @@ -358,29 +359,29 @@ function gwvpmini_GetCommitDetail($repo, $commitid) $repo_base = gwvpmini_getConfigVal("repodir"); - $cmd = "$cmd_line_tool --git-dir=$repo_base/$repo.git log $commitid -1 --format='%an'"; + $cmd = "$git_cli_cmd --git-dir=$repo_base/$repo.git log $commitid -1 --format='%an'"; exec($cmd, $commitername, $returnvar); - $cmd = "$cmd_line_tool --git-dir=$repo_base/$repo.git log $commitid -1 --format='%ae'"; + $cmd = "$git_cli_cmd --git-dir=$repo_base/$repo.git log $commitid -1 --format='%ae'"; exec($cmd, $commiteremail, $returnvar); - $cmd = "$cmd_line_tool --git-dir=$repo_base/$repo.git log $commitid -1 --format='%ct'"; + $cmd = "$git_cli_cmd --git-dir=$repo_base/$repo.git log $commitid -1 --format='%ct'"; exec($cmd, $commitertime, $returnvar); - $cmd = "$cmd_line_tool --git-dir=$repo_base/$repo.git log $commitid -1 --format='%s'"; + $cmd = "$git_cli_cmd --git-dir=$repo_base/$repo.git log $commitid -1 --format='%s'"; exec($cmd, $commiterlog, $returnvar); - $cmd = "$cmd_line_tool --git-dir=$repo_base/$repo.git log $commitid -1 --format='%b'"; + $cmd = "$git_cli_cmd --git-dir=$repo_base/$repo.git log $commitid -1 --format='%b'"; exec($cmd, $commiterbody, $returnvar); } function gwvpmini_GetCommitList($repo, $branch, $num=20) { - global $cmd_line_tool,$git_cli_cmd,$php_cli_cmd; + global $git_cli_cmd,$git_cli_cmd,$php_cli_cmd; $repo_base = gwvpmini_getConfigVal("repodir"); - $cmd = "$cmd_line_tool --git-dir=$repo_base/$repo.git log $commitid -1 --format='%an'"; + $cmd = "$git_cli_cmd --git-dir=$repo_base/$repo.git log $commitid -1 --format='%an'"; exec($cmd, $commitername, $returnvar); } @@ -391,8 +392,11 @@ function gwvpmini_GetRefList($repo) $repo_base = gwvpmini_getConfigVal("repodir"); - $cmd = "$cmd_line_tool --git-dir=$repo_base/$repo.git for-each-ref $commitid --format='%(objecttype):%(objectname):%(refname)'"; + $cmd = "$git_cli_cmd --git-dir=$repo_base/$repo.git for-each-ref $commitid --format='%(objecttype):%(objectname):%(refname)'"; + error_log("command was $cmd"); exec($cmd, $reflist, $returnvar); + + return $reflist; } ?> \ No newline at end of file -- 1.7.0.4