moved the old git poc code off and away from the main directory
[gwvp.git] / gwvplib / gwvpdebug.php
index 2a56674..4a5c303 100644 (file)
@@ -8,6 +8,21 @@ function gwvp_DebugEnabled()
 {
        global $BASE_URL, $LOGIN_TYPE;
        
+       $isgitagent = false;
+       
+       // tested the user agent bit with jgit from eclipse and normal git... seems to work
+       if(isset($_SERVER["HTTP_USER_AGENT"])) {
+               $agent = $_SERVER["HTTP_USER_AGENT"];
+               error_log("in git backend with user agent $agent");
+               if(stristr($agent, "git")!==false) {
+                       $isgitagent = true;
+               }
+       }
+       
+       // we dont wan to send this to a git agent
+       if($isgitagent) return;
+       
+       
        echo "<pre>";
        if(isset($_SERVER["PHP_AUTH_USER"])) error_log("authuser: ".$_SERVER["PHP_AUTH_USER"]."\n");
        echo "USERTYPE: $LOGIN_TYPE\n";
@@ -114,12 +129,17 @@ function gwvp_DebugCall()
                                        
                                        gwvp_SendMessage("info", "blank db re-created");
                                        
-                                       gwvp_AddRepo("repo1", "this is a test repo1", $adminid);
-                                       gwvp_AddRepo("repo2", "this is a test repo2", $userid1);
-                                       gwvp_AddRepo("repo3", "this is a test repo3", $userid2);
-                                       
+                                       //gwvp_createGitRepo($name, $ownerid, $desc, $bundle=null, $defaultperms=0)
                                        gwvp_setConfigVal("repodir", "/tmp/");
                                        
+                                       // TODO change these to create not add.
+                                       system("rm -rf /tmp/repo1.git /tmp/repo2.git /tmp/repo3.git");
+                                       gwvp_createGitRepo("repo1", $adminid, "test repo1");
+                                       gwvp_createGitRepo("repo2", $userid1, "test repo2");
+                                       gwvp_createGitRepo("repo3", $userid2, "test repo3");
+                                       
+                                       
+                                       
                                        header("Location: $BASE_URL/debug");
                                        break;
                                case "dropallusersandgroups":
@@ -143,6 +163,8 @@ function gwvp_DebugCall()
 function gwvp_DebugBody()
 {
        global $BASE_URL;
+       
+       
        ?>
        <a href="<?php echo $BASE_URL?>/debug/errormessage">Generate error message</a><br>
        <a href="<?php echo $BASE_URL?>/debug/infomessage">Generate info message</a><br>