2 /** FusionForge CPOLD plugin
4 * Copyright 2009, Roland Mas
6 * This file is part of FusionForge.
8 * FusionForge is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published
10 * by the Free Software Foundation; either version 2 of the License,
11 * or (at your option) any later version.
13 * FusionForge is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with FusionForge; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24 class CpoldPlugin extends SCMPlugin {
25 function CpoldPlugin () {
28 $this->name = 'scmcpold';
29 $this->text = 'CPOLD';
30 $this->hooks[] = 'scm_cpold_do_nothing' ;
32 require_once $gfconfig.'plugins/scmcpold/config.php' ;
34 $this->default_cpold_server = $default_cpold_server ;
35 $this->enabled_by_default = $enabled_by_default ;
36 $this->cpold_root = $cpold_root;
41 function CallHook ($hookname, $params) {
45 case 'scm_cpold_do_nothing':
49 parent::CallHook ($hookname, $params) ;
53 function getDefaultServer() {
54 return $this->default_cpold_server ;
57 function getBlurb () {
58 return _('<p>This CPOLD plugin is only intended as a proof of concept.</p>') ;
61 function getInstructionsForAnon ($project) {
62 $b = _('<p><b>Anonymous CPOLD Access</b></p><p>This project\'s CPOLD repository cannot be anonymously checked out yet.</p>');
66 function getInstructionsForRW ($project) {
67 $b = _('<p><b>Developer CPOLD Access via SSH</b></p><p>Only project developers can access the CPOLD 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>');
68 $b .= '<p><tt>scp -r <i>'._('developername').'</i>@' . $project->getSCMBox() . ':'. $this->cpold_root .'/'. $project->getUnixName().'/ .</tt></p>' ;
72 function getSnapshotPara ($project) {
76 function getBrowserBlock ($project) {
80 function getStatsBlock ($project) {
84 function createOrUpdateRepo ($params) {
85 $project = $this->checkParams ($params) ;
90 if (! $project->usesPlugin ($this->name)) {
94 $repo = $this->cpold_root . '/' . $project->getUnixName() ;
95 $unix_group = 'scm_' . $project->getUnixName() ;
97 system ("mkdir -p $repo") ;
98 system ("chgrp -R $unix_group $repo") ;
99 if ($project->enableAnonSCM()) {
100 system ("chmod -R g+wXs,o+rX-w $repo") ;
102 system ("chmod -R g+wXs,o-rwx $repo") ;
109 // c-file-style: "bsd"