@unlink($tempDir); mkdir($tempDir); // Create the name of the directory being archived $archiveName = $path; $isDir = substr($archiveName, -1) == '/'; if ($isDir) { $archiveName = substr($archiveName, 0, -1); } $archiveName = basename($archiveName); if ($archiveName == '') { $archiveName = $rep->name; } $plainfilename = $archiveName; $archiveName .= '.r' . $rev; // Export the requested path from SVN repository to the temp directory $svnExportResult = $svnrep->exportRepositoryPath($path, $tempDir . DIRECTORY_SEPARATOR . $archiveName, $rev, $peg); if ($svnExportResult != 0) { header('HTTP/1.x 500 Internal Server Error', true, 500); error_log('svn export failed for: ' . $archiveName); print 'svn export failed for "' . $archiveName . '".'; removeDirectory($tempDir); exit(0); } // Set timestamp of exported directory (and subdirectories) to timestamp of // the revision so every archive of a given revision has the same timestamp. $revDate = $logEntry->date; $timestamp = mktime(substr($revDate, 11, 2), substr($revDate, 14, 2), substr($revDate, 17, 2), substr($revDate, 5, 2), substr($revDate, 8, 2), substr($revDate, 0, 4)); // year setDirectoryTimestamp($tempDir, $timestamp); // Change to temp directory so that only relative paths are stored in archive. $oldcwd = getcwd();