activity logs... oh fun
authorPaul J R <me@pjr.cc>
Sat, 22 Sep 2012 23:07:19 +0000 (09:07 +1000)
committerPaul J R <me@pjr.cc>
Sat, 22 Sep 2012 23:07:19 +0000 (09:07 +1000)
gwvpmini/gwvpmini.php
gwvpmini/gwvpmini_activity.php [new file with mode: 0644]
gwvpmini/gwvpmini_db.php
gwvpmini/gwvpmini_gitbackend.php

index 42538f1..ad44251 100644 (file)
@@ -8,6 +8,7 @@ require_once("gwvpmini_gitrepo.php");
 require_once("gwvpmini_search.php");
 require_once("gwvpmini_gitbackend.php");
 require_once("gwvpmini_view.php");
+require_once("gwvpmini_activity.php");
 require_once("gwvpmini_register.php");
 require_once("gwvpmini_user.php");
 if(gwvpmini_isLoggedIn()) if(gwvpmini_isUserAdmin()) {
diff --git a/gwvpmini/gwvpmini_activity.php b/gwvpmini/gwvpmini_activity.php
new file mode 100644 (file)
index 0000000..cf2e122
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+
+$reg = gwvpmini_getConfigVal("activityloglength");\r
+\r
+$activity_log_length = false;\r
+if($reg == null) {\r
+       gwvpmini_setConfigVal("activityloglength", "100");\r
+} else if($reg == 1) {\r
+       $activityloglength = true;\r
+} else {\r
+       $activityloglength = false;\r
+}\r
+\r
+global $use_gravatar;\r
+
+
+// this will add a repo activity (a commit for eg)
+// and auto populate the field in the activity
+// log
+function gwvpmini_AddActivityForRepo($desc, $userbyid)
+{
+       
+}
+
+// gets the activity log as it would be viewed by
+// the user id of "$forid"
+function gwvpmini_GetActivityLogFor($forid)
+{
+       
+}
+
+?>
\ No newline at end of file
index 64277bc..972746e 100644 (file)
@@ -426,11 +426,20 @@ function gwvpmini_dbCreateSQLiteStructure($dbloc)
        // read|visible|write = can clone from repo|can see repo exists and see description but not clone from it|can push to repo\r
        // TODO: is this sufficient? i have to think about it
        
+       
+       // type for now will only be "git"
+       // date is obvious
+       // desc is a desction of the activity
+       // link is of the form "repo,reponame,repoid:user,username,useremail,userid" so it
+       // can be attached simply
+       // viewby is a simple list of uid's that should be able to see it... "r" for all registered
+       // "a" for everyone
        $activitysql = '
        CREATE TABLE "activity" (
                "activity_type" TEXT,
                "activity_date" TEXT,
                "activity_desc" TEXT,
+               "activity_link" TEXT,
                "activity_viewby" TEXT
        )';\r
 \r
index c3975e6..23b198b 100644 (file)
@@ -266,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);