notification of repo remote cloning complete via db message
[gwvp-mini.git] / bin / gwvpminicmdtool.php
index c42c8bf..3f59778 100644 (file)
@@ -25,6 +25,9 @@ if(isset($argv["3"])) {
                case "pre-receive":
                        gwvpcmdtool_PreReceive();
                        break;
+               case "backgroundclone":
+                       gwvpcmdtool_BackGroundClone();
+                       break;
                default:
                        gwvpcmdtool_Usage();
        }
@@ -68,6 +71,32 @@ function gwvpcmdtool_Usage()
 }
 
 
+function gwvpcmdtool_BackGroundClone()
+{
+       // here we parse arguments and have stuff with things and its 6am why am i doing this right now?
+       global $data_directory, $argv;
+       
+       $repo_base = gwvpmini_getConfigVal("repodir");
+       
+       sleep(60);
+       
+       $from = $argv[1];
+       $to = $argv[2];
+       echo "Would actually clone $from to $to in $data_directory\n";
+       //sleep(20);
+       
+       $cmd = "git clone --bare $from $repo_base/$to.git";
+       exec($cmd);
+       $rn = gwvpmini_getRepo(null, $to, null);
+       $rid = $rn["id"];
+       $uid = $rn["ownerid"];
+       gwvpmini_EnableRepo($rid);
+       
+       //gwvpmini_SendMessageByDb($type, $data, $forid)
+       gwvpmini_SendMessageByDb("info", "Repo $to has finished cloning and now ready", $uid);
+       echo "update $to ($rid) and enabled it\n";
+}
+
 // update will log things like branch and tag creations
 function gwvpcmdtool_UpdateHook()
 {