[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gforge-commits] gforge/cronjobs/dav-svn create_svn.php,1.1,1.2
From: |
ruben |
Subject: |
[Gforge-commits] gforge/cronjobs/dav-svn create_svn.php,1.1,1.2 |
Date: |
Tue, 14 Dec 2004 13:50:49 -0600 |
Update of /cvsroot/gforge/gforge/cronjobs/dav-svn
In directory db.perdue.net:/tmp/cvs-serv4880/cronjobs/dav-svn
Modified Files:
create_svn.php
Log Message:
Syncmail updates
Index: create_svn.php
===================================================================
RCS file: /cvsroot/gforge/gforge/cronjobs/dav-svn/create_svn.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- create_svn.php 29 Oct 2004 02:49:05 -0000 1.1
+++ create_svn.php 14 Dec 2004 19:50:45 -0000 1.2
@@ -9,6 +9,7 @@
*/
require ('squal_pre.php');
+require_once('/etc/gforge/local.inc');
// /path/to/svn/bin/
$svn_path='/usr/local/svn/bin';
@@ -44,11 +45,65 @@
// Create the docman repository for versioning of docs
//
system ("[ ! -d
$svn/".$row["unix_group_name"][0]."/".$row["unix_group_name"]." ] && mkdir -p
$svn/".$row["unix_group_name"][0]."/ && $svn_path/svnadmin create
$svn/".$row["unix_group_name"][0]."/".$row["unix_group_name"]);
+
svn_hooks("$svn/".$row["unix_group_name"][0]."/".$row["unix_group_name"]);
+
addsvnmail("$svn/".$row["unix_group_name"][0]."/".$row["unix_group_name"],$row["unix_group_name"]);
} else {
system ("[ ! -d $svn/".$row["unix_group_name"]." ] &&
$svn_path/svnadmin create $svn/".$row["unix_group_name"]);
+ svn_hooks("$svn/".$row["unix_group_name"]);
+
addsvnmail("$svn/".$row["unix_group_name"],$row["unix_group_name"]);
}
}
+/**
+* addsvnmail($filePath,$unix_group_name)
+* This function add the commit-email.pl into post-commit
+* The commit-email.pl must be in same directory of this script
+* Copyright 2004 (c) GForge
+* @autor Luis Alberto Hurtado Alvarado <address@hidden>
+* @param $filePath The path to svn repository
+* @param $unix_group_name The project name.
+*/
+function addsvnmail($filePath,$unix_group_name) {
+ global $sys_lists_host;
+ $pathsvnmail = dirname($_SERVER['SCRIPT_FILENAME']).'/commit-email.pl
'.' "$REPOS" '.' "$REV" '.$unix_group_name.'-commits@'.$sys_lists_host;
+ writeFile($filePath.'/hooks/post-commit',$pathsvnmail);
+}
+
+/**
+* svn_hooks($filePath)
+* This function create the post-commit file in svn hooks
+* Copyright 2004 (c) GForge
+* @autor Luis Alberto Hurtado Alvarado <address@hidden>
+* @param $filePath The path to svn repository
+*/
+function svn_hooks($filePath) {
+ system ("cp $filePath/hooks/post-commit.tmpl
$filePath/hooks/post-commit");
+ system("chmod +x ".$filePath."/hooks/post-commit");
+}
+
+/**
+* writeFile($filePath, $content)
+* This function add the mail
+* Copyright 2004 (c) GForge
+* @autor Luis Alberto Hurtado Alvarado <address@hidden>
+* @param $filePath The path to svn repository
+* @param $content The mail
+*/
+function writeFile($filePath, $content) {
+ $file = fopen($filePath, 'a');
+ flock($file, LOCK_EX);
+ ftruncate($file, 0);
+ rewind($file);
+ if(!empty($content)) {
+ fwrite($file, '#!/bin/sh'."\n");
+ fwrite($file, 'REPOS="$1"'."\n");
+ fwrite($file, 'REV="$2"'."\n");
+ fwrite($file, $content);
+ }
+ flock($file, LOCK_UN);
+ fclose($file);
+}
+
system("chown $file_owner -R $svn");
system("cd $svn/ ; find -type d -exec chmod 700 {} \;");
system("cd $svn/ ; find -type f -exec chmod 600 {} \;");
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gforge-commits] gforge/cronjobs/dav-svn create_svn.php,1.1,1.2,
ruben <=