SCMPlugin () ; $this->name = 'scmcpold'; $this->text = 'CPOLD'; $this->hooks[] = 'scm_generate_snapshots' ; $this->hooks[] = 'scm_cpold_do_nothing' ; require_once $gfconfig.'plugins/scmcpold/config.php' ; $this->default_cpold_server = $default_cpold_server ; if (isset ($cpold_root)) { $this->cpold_root = $cpold_root; } else { $this->cpold_root = $GLOBALS['sys_chroot'].'/scmrepos/cpold' ; } $this->register () ; } function CallHook ($hookname, $params) { global $HTML; switch ($hookname) { case 'scm_cpold_do_nothing': // Do nothing break; default: parent::CallHook ($hookname, $params) ; } } function getDefaultServer() { return $this->default_cpold_server ; } function getBlurb () { return _('
This CPOLD plugin is only intended as a proof of concept.
') ; } function getInstructionsForAnon ($project) { $b = sprintf (_('Anonymous CPOLD Access
This project\'s CPOLD repository can be accessep anonymously at %s.
'), util_make_link ('/anonscm/cpold/'.$project->getUnixName().'/', util_make_url ('/anonscm/cpold/'.$project->getUnixName().'/'))) ; return $b ; } function getInstructionsForRW ($project) { $b = _('Developer CPOLD Access via SSH
Only project developers can access the CPOLD tree via this method. SSH must be installed on your client machine. Substitute developername with the proper values. Enter your site password when prompted.
'); $b .= 'scp -r '._('developername').'@' . $project->getSCMBox() . ':'. $this->cpold_root .'/'. $project->getUnixName().'/ .
' ; return $b ; } function getSnapshotPara ($project) { return ; } function getBrowserLinkBlock ($project) { return ; } function getStatsBlock ($project) { return ; } function createOrUpdateRepo ($params) { $project = $this->checkParams ($params) ; if (!$project) { return false ; } if (! $project->usesPlugin ($this->name)) { return false; } $repo = $this->cpold_root . '/' . $project->getUnixName() ; $unix_group = 'scm_' . $project->getUnixName() ; system ("mkdir -p $repo") ; system ("chgrp -R $unix_group $repo") ; if ($project->enableAnonSCM()) { system ("chmod -R g+wXs,o+rX-w $repo") ; } else { system ("chmod -R g+wXs,o-rwx $repo") ; } } function generateSnapshots ($params) { global $sys_scm_tarballs_path ; $project = $this->checkParams ($params) ; if (!$project) { return false ; } $group_name = $project->getUnixName() ; $tarball = $sys_scm_tarballs_path.'/'.$group_name.'-scmroot.tar.gz'; if (! $project->usesPlugin ($this->name)) { return false; } if (! $project->enableAnonSCM()) { unlink ($tarball) ; return false; } $toprepo = $this->cpold_root ; $repo = $toprepo . '/' . $project->getUnixName() ; if (!is_dir ($repo)) { unlink ($tarball) ; return false ; } $tmp = trim (`mktemp -d`) ; if ($tmp == '') { return false ; } system ("tar czCf $toprepo $tmp/tarball.tar.gz " . $project->getUnixName()) ; chmod ("$tmp/tarball.tar.gz", 0644) ; copy ("$tmp/tarball.tar.gz", $tarball) ; unlink ("$tmp/tarball.tar.gz") ; system ("rm -rf $tmp") ; } } // Local Variables: // mode: php // c-file-style: "bsd" // End: ?>