From 3a319290353bbe27aa901b4f1c48ccb44dca28ed Mon Sep 17 00:00:00 2001 From: Paul J R Date: Sun, 23 Sep 2012 09:07:19 +1000 Subject: [PATCH] activity logs... oh fun --- gwvpmini/gwvpmini.php | 1 + gwvpmini/gwvpmini_activity.php | 32 ++++++++++++++++++++++++++++++++ gwvpmini/gwvpmini_db.php | 9 +++++++++ gwvpmini/gwvpmini_gitbackend.php | 7 ++++++- 4 files changed, 48 insertions(+), 1 deletions(-) create mode 100644 gwvpmini/gwvpmini_activity.php diff --git a/gwvpmini/gwvpmini.php b/gwvpmini/gwvpmini.php index 42538f1..ad44251 100644 --- a/gwvpmini/gwvpmini.php +++ b/gwvpmini/gwvpmini.php @@ -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 index 0000000..cf2e122 --- /dev/null +++ b/gwvpmini/gwvpmini_activity.php @@ -0,0 +1,32 @@ + \ No newline at end of file diff --git a/gwvpmini/gwvpmini_db.php b/gwvpmini/gwvpmini_db.php index 64277bc..972746e 100644 --- a/gwvpmini/gwvpmini_db.php +++ b/gwvpmini/gwvpmini_db.php @@ -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 // 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 )'; diff --git a/gwvpmini/gwvpmini_gitbackend.php b/gwvpmini/gwvpmini_gitbackend.php index c3975e6..23b198b 100644 --- a/gwvpmini/gwvpmini_gitbackend.php +++ b/gwvpmini/gwvpmini_gitbackend.php @@ -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); -- 1.7.0.4