cmdline tool for hooking into update githook
authorPaul J R <me@pjr.cc>
Sun, 23 Sep 2012 21:13:12 +0000 (07:13 +1000)
committerPaul J R <me@pjr.cc>
Sun, 23 Sep 2012 21:13:12 +0000 (07:13 +1000)
bin/gwvpminicmdtool.php [new file with mode: 0644]
gwvpmini/gwvpmini_gitbackend.php
gwvpmini/gwvpmini_view.php
www/index.php

diff --git a/bin/gwvpminicmdtool.php b/bin/gwvpminicmdtool.php
new file mode 100644 (file)
index 0000000..7fb27d4
--- /dev/null
@@ -0,0 +1,19 @@
+<?php
+
+$WEB_ROOT_FS = realpath(dirname(__FILE__));
+$BASE_URL = "/";\r
+
+global $WEB_ROOT_FS, $BASE_URL;
+
+if(file_exists("../www/config.php")) require_once("../www/config.php");
+else if(file_exists("/etc/gwvpmini/config.php")) require_once("/etc/gwvpmini/config.php");
+else $noconfig = true;
+
+if(file_exists("../gwvpmini/gwvpmini.php")) require_once("../gwvpmini/gwvpmini.php");
+else if(file_exists("/usr/share/gwvpmini/lib/gwvpmini/gwvpmini.php")) require_once("/usr/share/gwvpmini/lib/gwvpmini/gwvpmini.php");
+
+global $IS_WEB_REQUEST;
+
+$IS_WEB_REQUEST = false;
+
+?>
\ No newline at end of file
index 23b198b..6c8b8b5 100644 (file)
@@ -26,6 +26,16 @@ function gwvpmini_gitControlCallMe()
 }
 
 
+function gwvpmini_CreateUpdateHookInRepo($repopath)
+{
+       $fp = fopen("$repopath/hooks/$repopath", "w");
+       
+       if(!$fp) error_log("could not create update hook");
+       
+       // TODO: think about this one
+       
+}
+
 function gwvpmini_gitBackendInterface()
 {
        // and this is where i re-code the git backend interface from scratch
@@ -82,6 +92,8 @@ function gwvpmini_gitBackendInterface()
        
        // so now we have the repo
        // next we determine if this is a read or a write
+       
+       // TODO: WE NEED TO FIX THIS, IT DOESNT ALWAYS DETECT a "WRITE"
        $write = false;
        if(isset($_REQUEST["service"])) {
                if($_REQUEST["service"] == "git-receive-pack") {
@@ -141,7 +153,15 @@ function gwvpmini_gitBackendInterface()
        if(!$person) {
                $person = "anonymous";
        }
+       
+       // if its a write, we check (before and after) the branch/tag info to see if they were updated
+       //if($write) {
+       //}
+       
        gwvpmini_callGitBackend($person, $repo);
+       
+       //if($write) {
+               //}
        return;
        //}
 
@@ -199,8 +219,7 @@ function gwvpmini_callGitBackend($username, $repo)
                }
                
                //sleep(2);
-               
-               
+
                
                // this is where the fun, it ends.
                $myoutput = "";
index d9721a7..165a3c1 100644 (file)
@@ -112,7 +112,7 @@ function gwvpmini_RepoViewPageBody()
        else $owner_extra = "";\r
        
        echo "<h2>".gwvpmini_HtmlGravatar($owner["email"], 30)."$repo_view_call - $owner_name$owner_extra</h2>";
-       if(!$owner_view) echo "<b>$desc</b><br>";
+       if(!$owner_view) echo "$desc<br>";
        
        if($owner_view) {
                echo "<form method=\"post\" action=\"$BASE_URL/repoupdatedesc/$repo_view_call\">";\r
index 3765aca..1482ceb 100644 (file)
@@ -3,7 +3,9 @@ error_log("INCALLSTART ".print_r($_COOKIE, true)." -------------------- ".print_
 $WEB_ROOT_FS = realpath(dirname(__FILE__));\r
 $BASE_URL = dirname($_SERVER["PHP_SELF"]);\r
 \r
-global $WEB_ROOT_FS, $BASE_URL, $data_directory, $db_type, $db_name, $db_username, $db_password;\r
+global $WEB_ROOT_FS, $BASE_URL, $data_directory, $db_type, $db_name, $db_username, $db_password, $IS_WEB_REQUEST;
+
+$IS_WEB_REQUEST = false;\r
 
 if(file_exists("./config.php")) require_once("./config.php");
 else if(file_exists("/etc/gwvpmini/config.php")) require_once("/etc/gwvpmini/config.php");
@@ -13,7 +15,6 @@ if(file_exists("../gwvpmini/gwvpmini.php")) require_once("../gwvpmini/gwvpmini.p
 else if(file_exists("/usr/share/gwvpmini/lib/gwvpmini/gwvpmini.php")) require_once("/usr/share/gwvpmini/lib/gwvpmini/gwvpmini.php");
 
 
-
 if(isset($noconfig)) {
        gwvpmini_goSetup();
        return;