From: Paul J R Date: Sat, 22 Sep 2012 20:46:41 +0000 (+1000) Subject: push EVERY repo request back to git-http-backend cause it knows how to X-Git-Url: http://git.pjr.cc/?a=commitdiff_plain;h=ee03efce23152f2c09b293c9013d83da8a42ff9f;p=gwvp-mini.git push EVERY repo request back to git-http-backend cause it knows how to play with clients via reads at the http level properly and works with older clients, thats a really nice discovery - thanks git mailing list. --- diff --git a/gwvpmini/gwvpmini_db.php b/gwvpmini/gwvpmini_db.php index 17bbb0a..b94b4ca 100644 --- a/gwvpmini/gwvpmini_db.php +++ b/gwvpmini/gwvpmini_db.php @@ -667,6 +667,7 @@ function gwvpmini_GetUserNameFromEmail($email) return $retval; } + function gwvpmini_GetOwnedRepos($username) { /* @@ -693,6 +694,7 @@ function gwvpmini_GetOwnedRepos($username) $retval[$id]["name"] = $row["repos_name"]; $retval[$id]["desc"] = $row["repos_description"]; $retval[$id]["id"] = $row["repos_id"]; + $retval[$id]["status"] = $row["repos_status"]; error_log(print_r($row, true)); } @@ -700,6 +702,43 @@ function gwvpmini_GetOwnedRepos($username) return $retval; } +function gwvpmini_GetContributedRepos($username) +{ + /* + * CREATE TABLE "repos" ( + "repos_id" INTEGER PRIMARY KEY AUTOINCREMENT, + "repos_name" TEXT, + "repos_description" TEXT, + "repos_owner" INTEGER + )'; + + */ + $conn = gwvpmini_ConnectDB(); + + + $uid = gwvpmini_GetUserId($username); + $sql = "select repos_id,repos_description,repos_perms,repos_owernid,repos_status from repos"; + $res = $conn->query($sql); + if($username == "") return false; + + $retval = false; + $rids = null; + $i = 0; + foreach($res as $row) { + $perms = unserialize(base64_decode($row["repos_perms"])); + if(isset($perms["$uid"])) if($perms["$uid"] > 1) { + $rids[$i]["id"] = $row["repos_id"]; + $rids[$i]["desc"] = $row["repos_description"]; + $rids[$i]["ownerid"] = $row["repos_ownerid"]; + $rids[$i]["status"] = $row["repos_status"]; + $i++; + } + } + + error_log(print_r($retval, true)); + return $retval; +} + function gwvpmini_userLevel($id) { $conn = gwvpmini_ConnectDB(); diff --git a/gwvpmini/gwvpmini_gitbackend.php b/gwvpmini/gwvpmini_gitbackend.php index 10bb77c..bea736d 100644 --- a/gwvpmini/gwvpmini_gitbackend.php +++ b/gwvpmini/gwvpmini_gitbackend.php @@ -89,9 +89,6 @@ function gwvpmini_gitBackendInterface() $write = true; } } - if($_SERVER["REQUEST_METHOD"] == "POST") { - $write = true; - } //$write = true; // THIS MAY CAUSE ISSUES LATER ON but we do it cause the git client ignores our 403 when it uses git-receive-pack after an auth @@ -139,13 +136,14 @@ function gwvpmini_gitBackendInterface() } // if its a write, we push for authentication - if($write) { + + //if($write) { gwvpmini_callGitBackend($person, $repo); return; - } + //} // if we made it this far, we a read and we have permissions to do so, just search the file from the repo - if(file_exists("$repo_base/$repo.git/$newloc")) { + /*if(file_exists("$repo_base/$repo.git/$newloc")) { error_log("would ask $repo for $repo.git/$newloc from $repo_base/$repo.git/$newloc"); $fh = fopen("$repo_base/$repo.git/$newloc", "rb"); @@ -157,7 +155,7 @@ function gwvpmini_gitBackendInterface() error_log("would ask $repo for $repo/$newloc from $repo_base/$repo/$newloc, NE"); gwvpmini_fourZeroFour(); return; - } + }*/ }