[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gforge-commits] gforge/cronjobs/dav-svn README, NONE, 1.1 create_docman
From: |
tperdue |
Subject: |
[Gforge-commits] gforge/cronjobs/dav-svn README, NONE, 1.1 create_docman.php, NONE, 1.1 create_group_home.php, NONE, 1.1 create_groups.php, NONE, 1.1 create_svn.php, NONE, 1.1 create_users.php, NONE, 1.1 default_page.php, NONE, 1.1 svn-index.php, NONE, 1.1 |
Date: |
Thu, 28 Oct 2004 21:49:07 -0500 |
Update of /cvsroot/gforge/gforge/cronjobs/dav-svn
In directory db.perdue.net:/home/tperdue/share/dev.gforge.org/cronjobs/dav-svn
Added Files:
README create_docman.php create_group_home.php
create_groups.php create_svn.php create_users.php
default_page.php svn-index.php
Log Message:
adding dav / svn cronjobs
--- NEW FILE: README ---
These new scripts and files allow you to do away completely with
CVS and the editing of the /etc/passwd /etc/groups and /etc/shadow files
(or LDAP auth server).
Instead we can use the new module libapache2-mod-auth-gforge in conjunction
with Subversion, DAV, mod_dav, mod_dav_svn, and mod_authz_svn.
Sounds complex, doesn't it? There's a lot of stuff to install, but the
scripts are quite clear and flexible.
A sample crontab is at crontab.in and sample httpd.conf is here as well.
Here's what you get:
User DAV-accesible space:
Home directories, public and shareable for each user:
/var/www/homedirs/users/*user_name*/
Home pages for Users (http://*user_name*.users.gforge.company.com)
/var/www/homedirs/users/*user_name*/www
Private DAV directories for each user
/var/www/homedirs/users/*user_name*/private
Group DAV space:
Home directories, public and shareable for each group:
/var/www/homedirs/groups/*group_name*
Home pages for Groups (http://*group_name*.groups.gforge.company.com)
/var/www/homedirs/groups/*group_name*
Group DAV/Subversion Document Repository
Each project has its own subversion repository for document storage
/var/docman/*group_name*/ is where the repositories are
/var/www/docman is the DOCUMENT_ROOT for apache
Access them at (http://doc.gforge.company.com/*group_name*)
Group DAV/Subversion Source Code Repository
Each project has its own subversion repository for source code
/var/svn/*group_name*/ is where the repositories are
/var/www/docman is the DOCUMENT_ROOT for apache
Access them at (http://svn.gforge.company.com/*group_name*)
--- NEW FILE: create_docman.php ---
#! /usr/bin/php4 -f
<?php
/**
* create_docman.php
*
* Francisco Gimeno <address@hidden>
*
* @version $Id
*/
require ('squal_pre.php');
// /path/to/svn/bin/
$svn_path='/usr/local/svn/bin';
// Owner of files - apache
$file_owner='nobody:nogroup';
// Where is the docman SVN repository?
$docman='/var/docman';
// Whether to separate directories by first letter like /m/mygroup /a/apple
$first_letter = false;
/*
This script create the gforge dav/svn/docman repositories
*/
echo "Creating Groups at ". $docman."\n";
$res = db_query("SELECT is_public,enable_anoncvs,unix_group_name
FROM groups WHERE status != 'P';");
if (!$res) {
echo "Error!\n";
}
system("[ ! -d ".$docman." ] && mkdir $docman");
while ( $row =& db_fetch_array($res) ) {
echo "Name:".$row["unix_group_name"]." \n";
if ($first_letter) {
//
// Create the docman repository for versioning of docs
//
system ("[ ! -d
$docman/".$row["unix_group_name"][0]."/".$row["unix_group_name"]." ] && mkdir
-p $docman/".$row["unix_group_name"][0]."/ && $svn_path/svnadmin create
$docman/".$row["unix_group_name"][0]."/".$row["unix_group_name"]);
} else {
system ("[ ! -d $docman/".$row["unix_group_name"]." ] &&
$svn_path/svnadmin create $docman/".$row["unix_group_name"]);
}
}
system("chown $file_owner -R $docman");
system("cd $docman/ ; find -type d -exec chmod 700 {} \;");
system("cd $docman/ ; find -type f -exec chmod 600 {} \;");
?>
--- NEW FILE: create_group_home.php ---
#! /usr/bin/php4 -f
<?php
/**
* create_group_home.php
*
* Francisco Gimeno <address@hidden>
*
* @version $Id
*/
require ('squal_pre.php');
//
// Owner of files - apache
//
$file_owner='nobody:nogroup';
$first_letter = false;
/*
This script create the gforge/upload directory for users
*/
if ($argc < 2 ) {
echo "Usage ".$argv[0]." <path> <-f>\n";
echo "-f First Letter activated... do groups/m/myprojec\n";
exit (0);
}
if ( $argv[2]=='-f' ) {
$first_letter = true;
}
$upload_path = $argv[1];
echo "Creating Groups at ". $upload_path."\n";
$res = db_query("SELECT unix_group_name FROM groups WHERE status != 'P';");
if (!$res) {
echo "Error!\n";
}
system("[ ! -d ".$upload_path."/groups ] && mkdir $upload_path/groups");
while ( $row = db_fetch_array($res) ) {
echo "Name:".$row["unix_group_name"]." \n";
if ($first_letter) {
system ("[ ! -d
$upload_path/groups/".$row["unix_group_name"][0]."/".$row["unix_group_name"]."
] && mkdir -p
$upload_path/groups/".$row["unix_group_name"][0]."/".$row["unix_group_name"]);
system ("cp default_page.php
$upload_path/groups/".$row["unix_group_name"][0]."/".$row["unix_group_name"]."/index.php");
} else {
system ("[ ! -d $upload_path/groups/".$row["unix_group_name"]."
] && mkdir $upload_path/groups/".$row["unix_group_name"]);
system ("cp default_page.php
$upload_path/groups/".$row["unix_group_name"]."/index.php");
}
}
system("chown $file_owner -R $upload_path/groups");
system("cd $upload_path/groups ; find -type d -exec chmod 700 {} \;");
system("cd $upload_path/groups ; find -type f -exec chmod 600 {} \;");
?>
--- NEW FILE: create_groups.php ---
#! /usr/bin/php4 -f
<?php
/**
* create_groups.php
*
* Francisco Gimeno <address@hidden>
*
* @version $Id
*/
require ('squal_pre.php');
//
// Owner of files - apache
//
$file_owner='nobody:nogroup';
$first_letter = false;
/*
This script create the gforge/upload directory for users
*/
if ($argc < 2 ) {
echo "Usage ".$argv[0]." <path> <-f>\n";
echo "-f First Letter activated... do groups/m/myprojec\n";
exit (0);
}
if ( $argv[2]=='-f' ) {
$first_letter = true;
}
$upload_path = $argv[1];
echo "Creating Groups at ". $upload_path."\n";
$res = db_query("SELECT unix_group_name FROM groups WHERE status != 'P';");
if (!$res) {
echo "Error!\n";
}
system("[ ! -d ".$upload_path."/groups ] && mkdir $upload_path/groups");
while ( $row = db_fetch_array($res) ) {
echo "Name:".$row["unix_group_name"]." \n";
if ($first_letter) {
system ("[ ! -d
$upload_path/groups/".$row["unix_group_name"][0]."/".$row["unix_group_name"]."
] && mkdir -p
$upload_path/groups/".$row["unix_group_name"][0]."/".$row["unix_group_name"]);
} else {
system ("[ ! -d $upload_path/groups/".$row["unix_group_name"]."
] && mkdir $upload_path/groups/".$row["unix_group_name"]);
}
}
system("chown $file_owner -R $upload_path/groups");
system("cd $upload_path/groups ; find -type d -exec chmod 700 {} \;");
system("cd $upload_path/groups ; find -type f -exec chmod 600 {} \;");
?>
--- NEW FILE: create_svn.php ---
#! /usr/bin/php4 -f
<?php
/**
* create_docman.php
*
* Francisco Gimeno <address@hidden>
*
* @version $Id
*/
require ('squal_pre.php');
// /path/to/svn/bin/
$svn_path='/usr/local/svn/bin';
// Owner of files - apache
$file_owner='nobody:nogroup';
// Where is the SVN repository?
$svn='/var/svn';
// Whether to separate directories by first letter like /m/mygroup /a/apple
$first_letter = false;
/*
This script create the gforge dav/svn/docman repositories
*/
echo "Creating Groups at ". $svn."\n";
$res = db_query("SELECT is_public,enable_anonscm,unix_group_name
FROM groups WHERE status != 'P';");
if (!$res) {
echo "Error!\n";
}
system("[ ! -d ".$svn." ] && mkdir $svn");
while ( $row =& db_fetch_array($res) ) {
echo "Name:".$row["unix_group_name"]." \n";
if ($first_letter) {
//
// 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"]);
} else {
system ("[ ! -d $svn/".$row["unix_group_name"]." ] &&
$svn_path/svnadmin create $svn/".$row["unix_group_name"]);
}
}
system("chown $file_owner -R $svn");
system("cd $svn/ ; find -type d -exec chmod 700 {} \;");
system("cd $svn/ ; find -type f -exec chmod 600 {} \;");
?>
--- NEW FILE: create_users.php ---
#! /usr/bin/php4 -f
<?php
/**
* create_users.php
*
* Francisco Gimeno <address@hidden>
*
* @version $Id
*/
require ('squal_pre.php');
//
// Owner of files - apache
//
$file_owner='nobody:nogroup';
$first_letter = false;
if ($argc < 2 ) {
echo "Usage ".$argv[0]." <path> <-f>\n";
echo "-f First Letter activated: users/a/abel\n";
exit (0);
}
$upload_path = $argv[1];
if ($argv[2]=='-f') {
$first_letter = true;
}
/*
This script create the gforge/upload directory for users
*/
/*
Get users
*/
$res = db_query("SELECT user_name FROM users WHERE status='A';");
if (!$res) {
echo "Error!\n";
}
system("[ ! -d $upload_path/users ] && mkdir $upload_path/users");
while ( $row = db_fetch_array($res) ) {
echo "Name:".$row["user_name"]." \n";
if ($first_letter) {
system ("[ ! -d
$upload_path/users/".$row["user_name"][0]."/".$row["user_name"]." ] && mkdir -p
$upload_path/users/".$row["user_name"][0]."/".$row["user_name"]);
system ("[ ! -d
$upload_path/users/".$row["user_name"][0]."/".$row["user_name"]."/private ] &&
mkdir -p
$upload_path/users/".$row["user_name"][0]."/".$row["user_name"]."/private");
system ("[ ! -d
$upload_path/users/".$row["user_name"][0]."/".$row["user_name"]."/www ] &&
mkdir -p
$upload_path/users/".$row["user_name"][0]."/".$row["user_name"]."/www");
} else {
system ("[ ! -d $upload_path/users/".$row["user_name"]." ] && mkdir
-p $upload_path/users/".$row["user_name"]);
system ("[ ! -d $upload_path/users/".$row["user_name"]."/private ]
&& mkdir -p $upload_path/users/".$row["user_name"]."/private");
system ("[ ! -d $upload_path/users/".$row["user_name"]."/www ] &&
mkdir -p $upload_path/users/".$row["user_name"]."/www");
}
}
system("chown $file_owner -R $upload_path/users");
system("cd $upload_path/users ; find -type d -exec chmod 700 {} \;");
system("cd $upload_path/users ; find -type f -exec chmod 600 {} \;");
?>
--- NEW FILE: default_page.php ---
<?php
$domain=ereg_replace('[^\.]*\.(.*)$','\1',$GLOBALS['HTTP_HOST']);
$group_name=ereg_replace('([^\.]*)\..*$','\1',$GLOBALS['HTTP_HOST']);
echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en ">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><?php echo $project_name; ?></title>
<script language="JavaScript" type="text/javascript">
<!--
function help_window(helpurl) {
HelpWin = window.open(
helpurl,'HelpWindow','scrollbars=yes,resizable=yes,toolbar=no,height=400,width=400');
}
// -->
</script>
<style type="text/css">
<!--
BODY {
margin-top: 3;
margin-left: 3;
margin-right: 3;
margin-bottom: 3;
background: #01004e;
}
ol,ul,p,body,td,tr,th,form { font-family:
verdana,arial,helvetica,sans-serif; font-size:small;
color: #333333; }
h1 { font-size: x-large; font-family:
verdana,arial,helvetica,sans-serif; }
h2 { font-size: large; font-family: verdana,arial,helvetica,sans-serif;
}
h3 { font-size: medium; font-family:
verdana,arial,helvetica,sans-serif; }
h4 { font-size: small; font-family: verdana,arial,helvetica,sans-serif;
}
h5 { font-size: x-small; font-family:
verdana,arial,helvetica,sans-serif; }
h6 { font-size: xx-small; font-family:
verdana,arial,helvetica,sans-serif; }
pre,tt { font-family: courier,sans-serif }
a:link { text-decoration:none }
a:visited { text-decoration:none }
a:active { text-decoration:none }
a:hover { text-decoration:underline; color:red }
.titlebar { color: black; text-decoration: none; font-weight: bold; }
a.tablink { color: black; text-decoration: none; font-weight: bold;
font-size: x-small; }
a.tablink:visited { color: black; text-decoration: none; font-weight:
bold; font-size: x-small; }
a.tablink:hover { text-decoration: none; color: black; font-weight:
bold; font-size: x-small; }
a.tabsellink { color: black; text-decoration: none; font-weight: bold;
font-size: x-small; }
a.tabsellink:visited { color: black; text-decoration: none;
font-weight: bold; font-size: x-small; }
a.tabsellink:hover { text-decoration: none; color: black; font-weight:
bold; font-size: x-small; }
-->
</style>
</head>
<body>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td><a href="/"><img src="http://<?php echo $domain;
?>/themes/gforge/images/logo.png" border="0" alt="" width="198" height="52"
/></a></td>
</tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td colspan="3">
<!-- start tabs -->
<tr>
<td align="left" bgcolor="#E0E0E0" width="9"><img
src="http://<?php echo $domain; ?>/themes/gforge/images/tabs/topleft.png"
height="9" width="9" alt="" /></td>
<td bgcolor="#E0E0E0" width="30"><img src="http://<?php echo
$domain; ?>/themes/gforge/images/clear.png" width="30" height="1" alt="" /></td>
<td bgcolor="#E0E0E0"><img src="http://<?php echo $domain;
?>/themes/gforge/images/clear.png" width="1" height="1" alt="" /></td>
<td bgcolor="#E0E0E0" width="30"><img src="http://<?php echo
$domain; ?>/themes/gforge/images/clear.png" width="30" height="1" alt="" /></td>
<td align="right" bgcolor="#E0E0E0" width="9"><img
src="http://<?php echo $domain; ?>/themes/gforge/images/tabs/topright.png"
height="9" width="9" alt="" /></td>
</tr>
<tr>
<!-- Outer body row -->
<td bgcolor="#E0E0E0"><img src="http://<?php echo $domain;
?>/themes/gforge/images/clear.png" width="10" height="1" alt="" /></td>
<td valign="top" width="99%" bgcolor="#E0E0E0" colspan="3">
<!-- Inner Tabs / Shell -->
<table border="0" width="100%" cellspacing="0"
cellpadding="0">
<tr>
<td align="left" bgcolor="#ffffff"
width="9"><img src="http://<?php echo $domain;
?>/themes/gforge/images/tabs/topleft-inner.png" height="9" width="9" alt=""
/></td>
<td bgcolor="#ffffff"><img src="http://<?php
echo $domain; ?>/themes/gforge/images/clear.png" width="1" height="1" alt=""
/></td>
<td align="right" bgcolor="#ffffff"
width="9"><img src="http://<?php echo $domain;
?>/themes/gforge/images/tabs/topright-inner.png" height="9" width="9" alt=""
/></td>
</tr>
<tr>
<td bgcolor="#ffffff"><img src="http://<?php
echo $domain; ?>/themes/gforge/images/clear.png" width="10" height="1" alt=""
/></td>
<td valign="top" width="99%" bgcolor="white">
<!-- whole page table -->
<table width="100%" cellpadding="5" cellspacing="0" border="0">
<tr><td width="65%" valign="top">
<?php if
($handle=fopen('http://'.$domain.'/export/projtitl.php?group_name='.$group_name,'r')){
$contents = '';
while (!feof($handle)) {
$contents .= fread($handle, 8192);
}
fclose($handle);
echo $contents; } ?>
<?php if
($handle=fopen('http://'.$domain.'/export/projnews.php?group_name='.$group_name,'r')){
$contents = '';
while (!feof($handle)) {
$contents .= fread($handle, 8192);
}
fclose($handle);
$contents=str_replace('href="/','href="http://'.$domain.'/',$contents);
echo $contents; } ?>
</td>
<td width="35%" valign="top">
<table cellspacing="0" cellpadding="1" width="100%" border="0"
bgcolor="#d5d5d7">
<tr><td>
<table cellspacing="0" cellpadding="2" width="100%"
border="0" bgcolor="#eaecef">
<tr style="background-color:#d5d5d7"
align="center">
<td colspan="2"><span
class="titlebar">Project Summary</span></td>
</tr>
<tr align="left">
<td colspan="2">
<?php
if($handle=fopen('http://'.$domain.'/export/projhtml.php?group_name='.$group_name,'r')){
$contents = '';
while (!feof($handle)) {
$contents .= fread($handle, 8192);
}
fclose($handle);
$contents=str_replace('href="/','href="http://'.$domain.'/',$contents);
$contents=str_replace('src="/','src="http://'.$domain.'/',$contents);
echo $contents; } ?>
</td>
</tr>
</table>
</td></tr>
</table><p> </p>
</td></tr></table>
<p>
<center>
<a href="http://gforgegroup.com/"><img
src="http://gforge.org/pro/gforgebanner.jpg" height="60" width="468" border="0"
alt="GForge Group Professional Services" /></a><br /><br />
</center>
<!-- end main body row -->
</td>
<td width="10" bgcolor="#ffffff"><img
src="http://<?php echo $domain; ?>/themes/gforge/images/clear.png" width="2"
height="1" alt="" /></td>
</tr>
<tr>
<td align="left" bgcolor="#E0E0E0"
width="9"><img src="http://<?php echo $domain;
?>/themes/gforge/images/tabs/bottomleft-inner.png" height="11" width="11"
alt="" /></td>
<td bgcolor="#ffffff"><img src="http://<?php
echo $domain; ?>/themes/gforge/images/clear.png" width="1" height="1" alt=""
/></td>
<td align="right" bgcolor="#E0E0E0"
width="9"><img src="http://<?php echo $domain;
?>/themes/gforge/images/tabs/bottomright-inner.png" height="11" width="11"
alt="" /></td>
</tr>
</table>
<!-- end inner body row -->
</td>
<td width="10" bgcolor="#E0E0E0"><img src="http://<?php echo
$domain; ?>/themes/gforge/images/clear.png" width="2" height="1" alt="" /></td>
</tr>
<tr>
<td align="left" bgcolor="#E0E0E0" width="9"><img
src="http://<?php echo $domain; ?>/themes/gforge/images/tabs/bottomleft.png"
height="9" width="9" alt="" /></td>
<td bgcolor="#E0E0E0" colspan="3"><img src="http://<?php echo
$domain; ?>/themes/gforge/images/clear.png" width="1" height="1" alt="" /></td>
<td align="right" bgcolor="#E0E0E0" width="9"><img
src="http://<?php echo $domain; ?>/themes/gforge/images/tabs/bottomright.png"
height="9" width="9" alt="" /></td>
</tr>
</table>
<!-- PLEASE LEAVE "Powered By GForge" on your site -->
<br />
<center>
<a href="http://gforge.org/"><img src="http://gforge.org/images/pow-gforge.png"
alt="Powered By GForge Collaborative Development Environment" border="0" /></a>
</center>
</body>
</html>
--- NEW FILE: svn-index.php ---
<?php
require_once('/usr/share/gforge/www/include/squal_pre.php'); // Initial db
and session library, opens session
?>
<html>
<head>
<title>Subversion Repositories at <?php echo $sys_name; ?></title>
</head>
<body>
<h2>Subversion Repositories at <?php echo $sys_name; ?> </h2>
<p><?php
$svnparentpath = "/var/lib/gforge/docman/groups";
$svnparenturl = "/groups";
db_begin();
$res = db_query("SELECT unix_group_name,group_name FROM groups WHERE
status='A' AND is_public='1' AND use_cvs='1';");
if (!$res) {
echo "Error!\n";
}
while ( $row = db_fetch_array($res) ) {
$svndir = $svnparentpath . "/" . $row["unix_group_name"];
if ( is_dir ($svndir) ) {
echo "<a href=\"" . $svnparenturl . "/".
$row["unix_group_name"] ."\">";
echo $row["group_name"]. "</a><br />\n";
}
}
?>
</p>
</body>
</html>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gforge-commits] gforge/cronjobs/dav-svn README, NONE, 1.1 create_docman.php, NONE, 1.1 create_group_home.php, NONE, 1.1 create_groups.php, NONE, 1.1 create_svn.php, NONE, 1.1 create_users.php, NONE, 1.1 default_page.php, NONE, 1.1 svn-index.php, NONE, 1.1,
tperdue <=