Rev 527 Rev 1938
Line 50... Line 50...
50 // Create a temporary directory. Here we have an unavoidable but highly 50 // Create a temporary directory. Here we have an unavoidable but highly
51 // unlikely to occure race condition 51 // unlikely to occure race condition
52   52  
53 if (count(glob("/tmp/wsvn-*"))<=40) // Omezeni na pocet soucasne stahovanych souboru 53 if (count(glob("/tmp/wsvn-*"))<=40) // Omezeni na pocet soucasne stahovanych souboru
54 { 54 {
-   55  
-   56 // Ošetření doběhnutí skriptu i když klient klikne jinam (smazání tmp)
-   57 ignore_user_abort(true);
-   58  
55 $tmpname1 = tempnam("temp", "wsvn-"); 59 $tmpname1 = tempnam("temp", "wsvn-");
56 $tmpname = $tmpname1; 60 $tmpname = $tmpname1;
57 $tmpname .= "dir"; 61 $tmpname .= "dir";
58 if (mkdir($tmpname)) 62 if (mkdir($tmpname))
59 { 63 {
Line 65... Line 69...
65 69
66 $svnrep->exportDirectory($path, $tmpname.DIRECTORY_SEPARATOR.$arcname, $rev); 70 $svnrep->exportDirectory($path, $tmpname.DIRECTORY_SEPARATOR.$arcname, $rev);
67 71
68 // ZIP it up 72 // ZIP it up
69 chdir($tmpname); 73 chdir($tmpname);
-   74 if (! connection_aborted())
70 exec("zip -r ".quote("$arcname")." ."); 75 exec("zip -r ".quote("$arcname")." .");
71 76
72 $size = filesize("$arcname.zip"); 77 $size = filesize("$arcname.zip");
73 78
74 // Give the file to the browser 79 // Give the file to the browser
75 80
76 if ($fp = @fopen("$arcname.zip","rb")) 81 if (!connection_aborted() && $fp = @fopen("$arcname.zip","rb"))
77 { 82 {
78 header("Content-Type: application/zip"); 83 header("Content-Type: application/zip");
79 header("Content-Length: $size"); 84 header("Content-Length: $size");
80 header("Content-Disposition: attachment; filename=\"".$rep->name."-$arcname.zip\""); 85 header("Content-Disposition: attachment; filename=\"".$rep->name."-$arcname.zip\"");
81 // Use a loop to transfer the data 4KB at a time. 86 // Use a loop to transfer the data 4KB at a time.