function getInstructionsForRW ($project) {
$b = '' ;
- if ($this->use_ssh) {
- $b .= _('<p><b>Developer Subversion Access via SSH</b></p><p>Only project developers can access the SVN tree via this method. SSH must be installed on your client machine. Substitute <i>developername</i> with the proper values. Enter your site password when prompted.</p>');
- $b .= '<p><tt>svn checkout svn+ssh://<i>'._('developername').'</i>@' . $project->getSCMBox() . $this->svn_root .'/'. $project->getUnixName().'</tt></p>' ;
- }
- if ($this->use_dav) {
- $b .= _('<p><b>Developer Subversion Access via DAV</b></p><p>Only project developers can access the SVN tree via this method. Substitute <i>developername</i> with the proper values. Enter your site password when prompted.</p>');
- $b .= '<p><tt>svn checkout --username <i>'._('developername').'</i> http'.(($this->use_ssl) ? 's' : '').'://'. $project->getSCMBox() . $this->svn_root .'/'.$project->getUnixName().'</tt></p>' ;
+ if (session_loggedin()) {
+ $u =& user_get_object(user_getid()) ;
+ $d = $u->getUnixName() ;
+ if ($this->use_ssh) {
+ $b .= _('<p><b>Developer Subversion Access via SSH</b></p><p>Only project developers can access the SVN tree via this method. SSH must be installed on your client machine. Enter your site password when prompted.</p>');
+ $b .= '<p><tt>svn checkout svn+ssh://'.$d.'@' . $project->getSCMBox() . $this->svn_root .'/'. $project->getUnixName().'</tt></p>' ;
+ }
+ if ($this->use_dav) {
+ $b .= _('<p><b>Developer Subversion Access via DAV</b></p><p>Only project developers can access the SVN tree via this method. Enter your site password when prompted.</p>');
+ $b .= '<p><tt>svn checkout --username '.$d.' http'.(($this->use_ssl) ? 's' : '').'://'. $project->getSCMBox() . $this->svn_root .'/'.$project->getUnixName().'</tt></p>' ;
+ }
+ } else {
+ if ($this->use_ssh) {
+ $b .= _('<p><b>Developer Subversion Access via SSH</b></p><p>Only project developers can access the SVN tree via this method. SSH must be installed on your client machine. Substitute <i>developername</i> with the proper values. Enter your site password when prompted.</p>');
+ $b .= '<p><tt>svn checkout svn+ssh://<i>'._('developername').'</i>@' . $project->getSCMBox() . $this->svn_root .'/'. $project->getUnixName().'</tt></p>' ;
+ }
+ if ($this->use_dav) {
+ $b .= _('<p><b>Developer Subversion Access via DAV</b></p><p>Only project developers can access the SVN tree via this method. Substitute <i>developername</i> with the proper values. Enter your site password when prompted.</p>');
+ $b .= '<p><tt>svn checkout --username <i>'._('developername').'</i> http'.(($this->use_ssl) ? 's' : '').'://'. $project->getSCMBox() . $this->svn_root .'/'.$project->getUnixName().'</tt></p>' ;
+ }
}
-
return $b ;
}
'<td width="25%" align="right"><strong>'.$total['commits'].'</strong></td>';
$b .= '</tr>';
$b .= $HTML->listTableBottom();
- $b .= '<hr size="1" />';
}
return $b ;
$unix_group = 'scm_' . $project->getUnixName() ;
if (!is_dir ($repo) || !is_file ("$repo/format")) {
- system ("svnadmin create --fs-type fsfs $repo") ;
+ system ("svnadmin create $repo") ;
system ("svn mkdir -m'Init' file:///$repo/trunk file:///$repo/tags file:///$repo/branches") ;
system ("find $repo -type d | xargs chmod g+s") ;
}
system ("chmod -R g+wX,o-rwx $repo") ;
}
} else {
- $unix_user = $sys_apache_user ;
+ $unix_user = $GLOBALS['sys_apache_user'];
system ("chown -R $unix_user:$unix_group $repo") ;
if ($project->enableAnonSCM()) {
system ("chmod -R g+wX,o+rX-w $repo") ;
global $last_user, $last_time, $last_tag, $time_ok, $start_time, $end_time,
$adds, $deletes, $updates, $commits, $date_key,
$usr_adds, $usr_deletes, $usr_updates;
+
+ $time_ok = true ;
$project = $this->checkParams ($params) ;
if (!$project) {
return false ;
}
- $pipe = popen ("svn log file://$repo --xml -v -q 2> /dev/null", 'r' ) ;
+ $d1 = date ('Y-m-d', $start_time - 150000) ;
+ $d2 = date ('Y-m-d', $end_time + 150000) ;
+
+ $pipe = popen ("svn log file://$repo --xml -v -q -r '".'{'.$d2.'}:{'.$d1.'}'."' 2> /dev/null", 'r' ) ;
// cleaning stats_cvs_* table for the current day
$res = db_query_params ('DELETE FROM stats_cvs_group WHERE month=$1 AND day=$2 AND group_id=$3',
return false ;
break;
}
-
- if (!$time_ok && $last_time && $last_time < $start_time) {
- break;
- }
}
xml_parser_free ($xml_parser);
// inserting group results in stats_cvs_groups
- if (!db_query_params ('INSERT INTO stats_cvs_group (month,day,group_id,checkouts,commits,adds) VALUES ($1,$2,$3,$4,$5,$6)',
- array ($month_string,
- $day,
- $project->getID(),
- 0,
- $updates,
- $adds))) {
- echo "Error while inserting into stats_cvs_group\n" ;
- db_rollback () ;
- return false ;
+ if ($updates > 0 || $adds > 0) {
+ if (!db_query_params ('INSERT INTO stats_cvs_group (month,day,group_id,checkouts,commits,adds) VALUES ($1,$2,$3,$4,$5,$6)',
+ array ($month_string,
+ $day,
+ $project->getID(),
+ 0,
+ $updates,
+ $adds))) {
+ echo "Error while inserting into stats_cvs_group\n" ;
+ db_rollback () ;
+ return false ;
+ }
}
// building the user list
} else {
continue;
}
-
- if (!db_query_params ('INSERT INTO stats_cvs_user (month,day,group_id,user_id,commits,adds) VALUES ($1,$2,$3,$4,$5,$6)',
- array ($month_string,
- $day,
- $project->getID(),
- $user_id,
- $usr_updates[$user] ? $usr_updates[$user] : 0,
- $usr_adds[$user] ? $usr_adds[$user] : 0))) {
- echo "Error while inserting into stats_cvs_user\n" ;
- db_rollback () ;
- return false ;
+
+ $uu = $usr_updates[$user] ? $usr_updates[$user] : 0 ;
+ $ua = $usr_adds[$user] ? $usr_adds[$user] : 0 ;
+ if ($uu > 0 || $ua > 0) {
+ if (!db_query_params ('INSERT INTO stats_cvs_user (month,day,group_id,user_id,commits,adds) VALUES ($1,$2,$3,$4,$5,$6)',
+ array ($month_string,
+ $day,
+ $project->getID(),
+ $user_id,
+ $uu,
+ $ua))) {
+ echo "Error while inserting into stats_cvs_user\n" ;
+ db_rollback () ;
+ return false ;
+ }
}
}
+ db_commit();
}
- db_commit();
}
function generateSnapshots ($params) {