gwynne Fri Nov 7 20:10:51 2008 UTC Modified files: /SVNROOT run-conversion.php Log: make more sensible temp file names http://cvs.php.net/viewvc.cgi/SVNROOT/run-conversion.php?r1=1.12&r2=1.13&diff_format=u Index: SVNROOT/run-conversion.php diff -u SVNROOT/run-conversion.php:1.12 SVNROOT/run-conversion.php:1.13 --- SVNROOT/run-conversion.php:1.12 Fri Nov 7 19:39:12 2008 +++ SVNROOT/run-conversion.php Fri Nov 7 20:10:51 2008 @@ -2,7 +2,7 @@ // ----------------------------------------------------------------------------------------------------------------------------- // Constants -$version = substr('$Revision: 1.12 $', strlen('$Revision: '), -2); +$version = substr('$Revision: 1.13 $', strlen('$Revision: '), -2); $passes = array( 'processcvs', // Process CVS modules @@ -138,11 +138,13 @@ { private $optionsFileContents = NULL; private $outputPath = NULL; + private $seed = 0; - public function __construct() + public function __construct($seed = NULL) { $this->optionsFileContents = file_get_contents($GLOBALS['options']['skeleton']); $this->optionsFileContents = str_replace('@@@TEMPDIR@@@', $GLOBALS['temp_path'], $this->optionsFileContents); + $this->seed = ($seed === NULL ? mt_rand() : $seed); } public function setOutputPath($path) @@ -189,17 +191,14 @@ public function run() { $this->optionsFileContents = str_replace('@@@OUTPUT_PATH@@@', $this->outputPath, $this->optionsFileContents); - do { - $seed = mt_rand(); - $filename = $GLOBALS['temp_path'] . DIRECTORY_SEPARATOR . 'cvs2svn.options.' . $seed; - } while (file_exists($filename)); + $filename = $GLOBALS['temp_path'] . DIRECTORY_SEPARATOR . 'cvs2svn.options.' . $this->seed; file_put_contents($filename, $this->optionsFileContents); $command = "exec cvs2svn --options=" . escapeshellarg($filename); v(2, "Running: '{$command}'..."); $cvs2svn_process = proc_open($command, array( 0 => array('pipe', 'r'), - 1 => array('file', $GLOBALS['temp_path'] . DIRECTORY_SEPARATOR . 'phpsvn.conversion.' . $seed, 'a'), + 1 => array('file', $GLOBALS['temp_path'] . DIRECTORY_SEPARATOR . 'phpsvn.conversion.' . $this->seed, 'w'), 2 => array('pipe', 'w'), ), $pipes, NULL, NULL); fclose($pipes[0]); @@ -283,7 +282,7 @@ } v(1, "Running cvs2svn for '{$this->repositoryName}'...\n"); - $converter = new CVS2SVNConverter; + $converter = new CVS2SVNConverter($this->repositoryName); $converter->setOutputPath($this->svnRepositoryPath); foreach ($this->cvsModuleList as $cvs_module => $isMeta) { $converter->addCVSModule($cvs_module, $isMeta);
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php