cvs: SVNROOT / run-conversion.php
[email protected] ("Gwynne Raskind")
| Newsgroups | svn.migration |
|---|---|
| Message-ID | <cvsgwynne1226899949@cvsserver> |
gwynne Mon Nov 17 05:32:29 2008 UTC
Modified files:
/SVNROOT run-conversion.php
Log:
Install post-commit hooks and authz DB per-repository, install global users digest file, install Apache config files
http://cvs.php.net/viewvc.cgi/SVNROOT/run-conversion.php?r1=1.42&r2=1.43&diff_format=u
Index: SVNROOT/run-conversion.php
diff -u SVNROOT/run-conversion.php:1.42 SVNROOT/run-conversion.php:1.43
--- SVNROOT/run-conversion.php:1.42 Wed Nov 12 22:55:21 2008
+++ SVNROOT/run-conversion.php Mon Nov 17 05:32:28 2008
@@ -7,7 +7,7 @@
// -----------------------------------------------------------------------------------------------------------------------------
// Constants
-$version = substr('$Revision: 1.42 $', strlen('$Revision: '), -2);
+$version = substr('$Revision: 1.43 $', strlen('$Revision: '), -2);
$passes = array(
'processcvs', // Process CVS modules
@@ -383,8 +383,48 @@
public function installAdminFiles()
{
v(1, "Installing administrative files for repository '{$this->repositoryName}'...\n");
+ v(2, "Installing e-mail post-commit hook...\n");
+ symlink($GLOBALS['options']['svnroot'] . DIR_SEP . 'SVNROOT' . DIR_SEP . 'commit-email.php',
+ $this->svnRepositoryPath . DIR_SEP . 'hooks' . DIR_SEP . 'post-commit');
+ $authzDB = $this->svnRepositoryPath . DIR_SEP . 'conf' . DIR_SEP . 'authz.db';
+ if (!file_exists($authzDB)) {
+ v(2, "Installing authz database...\n");
+ file_put_contents($authzDB, <<<EOAUTHZ
+[groups]
+
+[aliases]
+
+[/]
+svnread = r
+EOAUTHZ
+ );
+ } else {
+ v(2, "Not overwriting existing authz database.\n");
+ }
+ v(2, "Installing Apache 2.2 config file...\n");
+ $usersDB = $GLOBALS['options']['svnroot'] . DIR_SEP . 'svn.users';
+ file_put_contents($this->svnRepositoryPath . DIR_SEP . 'conf' . DIR_SEP . 'httpd.conf', <<<EOHTTPD
+# This file is intended to be Included from inside an Apache 2.2 VirtualHost section.
+ <Location "/{$this->repositoryName}">
+ DAV svn
+ SVNPath "{$this->svnRepositoryPath}"
+ AuthzSVNAccessFile "{$authzDB}"
+ Satisfy All
+ Require valid-user
+ AuthType Digest
+ AuthName "PHP Subversion Repositories"
+ AuthUserFile "{$usersDB}"
+ AuthDigestDomain "/{$this->repositoryName}"
+ </Location>
+EOHTTPD
+ );
v(1, "Done installing administrative files.\n");
}
+
+ public function getHTTPDConfPath()
+ {
+ return $this->svnRepositoryPath . DIR_SEP . 'conf' . DIR_SEP . 'httpd.conf';
+ }
}
// -----------------------------------------------------------------------------------------------------------------------------
@@ -597,21 +637,35 @@
foreach ($GLOBALS['repoList'] as $repo) {
$repo->installAdminFiles();
}
- if (!file_exists($GLOBALS['options']['svnroot'] . DIR_SEP . 'svn.authz')) {
- file_put_contents($GLOBALS['options']['svnroot'] . DIR_SEP . 'svn.authz', <<<EOAUTHZ
-[groups]
-
-[aliases]
+ v(1, "Installing global administrative files...\n");
+ $usersDB = $GLOBALS['options']['svnroot'] . DIR_SEP . 'svn.users';
+ if (!file_exists($usersDB)) {
+ v(2, "Installing global user database...\n");
+ $svnreadpass = md5('svnread');
+ file_put_contents($usersDB, <<<EOUSERS
+svnread:PHP Subversion Repositories:{$svnreadpass}
-[/]
-svnread = r
-EOAUTHZ
- );
+EOUSERS
+ );
+ } else {
+ v(2, "Not overwriting existing global user database.\n");
}
- if (!file_exists($GLOBALS['options']['svnroot'] . DIR_SEP . 'svn.users')) {
- $command = 'htpasswd -bcm ' . escapeshellarg($GLOBALS['options']['svnroot'] . DIR_SEP . 'svn.users') . ' svnread svnread';
- run_command($command);
+ v(2, "Installing global Apache 2.2 configuration file....\n");
+ $apacheConf = $GLOBALS['options']['svnroot'] . DIR_SEP . 'httpd.conf';
+ $confContents = <<<EOHTTPD
+<VirtualHost *:80>
+ ServerName svn.php.net
+ LogLevel debug
+ CustomLog /home/svn/svn.svn-log "%t %u ${SVN-ACTION}e" env=SVN-ACTION
+ CustomLog /home/svn/svn.access-log combined
+ ErrorLog /home/svn/svn.error-log
+EOHTTPD;
+ foreach ($GLOBALS['repoList'] as $repo) {
+ $confContents .= " Include " . $repo->getHTTPDConfPath() . "\n";
}
+ $confContents .= "</VirtualHost>";
+ file_put_contents($apacheConf, $confContents);
+ v(1, "Done installing global administrative files.\n");
}
// -----------------------------------------------------------------------------------------------------------------------------