activity logs... oh fun
[gwvp-mini.git] / gwvpmini / gwvpmini_gitbackend.php
index 10bb77c..23b198b 100644 (file)
@@ -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,17 @@ function gwvpmini_gitBackendInterface()
        }
        
        // if its a write, we push for authentication
-       if($write) {
-               gwvpmini_callGitBackend($person, $repo);
-               return;
+       
+       //if($write) {
+       if(!$person) {
+               $person = "anonymous";
        }
+       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 +158,7 @@ function gwvpmini_gitBackendInterface()
                error_log("would ask $repo for $repo/$newloc from $repo_base/$repo/$newloc, NE");
                gwvpmini_fourZeroFour();
                return;
-       }
+       }*/
        
 }
 
@@ -265,12 +266,17 @@ function gwvpmini_callGitBackend($username, $repo)
                        error_log("cant set pipe1 non-blocking");
                }
                
+               
+               $fp = fopen("/tmp/gitup.".rand(0,4000000), "w");
                // i was going to use stream_select, but i feel this works better like this
                while($continue) {
                        // do client
                        if(!feof($fh)) {
                                $from_client_data = fread($fh,8192);
-                               if($from_client_data !== false) fwrite($pipes[0], $from_client_data);
+                               if($from_client_data !== false) {
+                                       fwrite($pipes[0], $from_client_data);
+                                       fwrite($fp, $from_client_data);
+                               }
                                fflush($pipes[0]);
                                //fwrite($fl, $from_client_data);
                                $client_len = strlen($from_client_data);