From 6649978d19dbab36b162159abe919360728d77c0 Mon Sep 17 00:00:00 2001 From: Stricted Date: Mon, 1 Oct 2012 21:05:55 +0200 Subject: [PATCH] fixed coding fails from last commit --- git_download.php | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/git_download.php b/git_download.php index 697c587..74d3851 100644 --- a/git_download.php +++ b/git_download.php @@ -53,25 +53,20 @@ if(isset($_GET['p'])){ }else{ $hash = substr(shell_exec("git --git-dir=/home/git/".$_GET['build']." rev-list -n 1 --pretty='format:%h' --header master | grep '^[0-9a-f]*$'"), 0, 7); } - if(file_exists("/usr/share/gitweb/dl/".$name."-".$hash.".tar.gz")) { - header("Content-Type: application/x-gzip"); - header("Content-Disposition: attachment; filename=".$name."-".$hash.".tar.gz"); - readfile("/usr/share/gitweb/dl/".$name."-".$hash.".tar.gz"); - unlink("/usr/share/gitweb/dl/".$name."-".$hash.".tar.gz"); - }else{ - $b = shell_exec("cd /usr/share/gitweb/dl/; git clone git://git.nexus-irc.de/".$_GET['build']); - $c = shell_exec("cd /usr/share/gitweb/dl/".$name."/; git reset ".$_GET['h']); - $con= shell_exec('git --git-dir=/home/git/'.$_GET['build'].' rev-list --oneline --header master | wc -l | sed "s/[ \t]//g"'); - if($_GET['build'] != "gitweb.git") { - scandir_replace("/usr/share/gitweb/dl/".$name,"git-".substr($con, 0, -1)."-".$hash); - } - $c = shell_exec("cd /usr/share/gitweb/dl; tar czfv ".$name."-".$hash.".tar.gz ".$name); - $d = shell_exec("rm -r /usr/share/gitweb/dl/".$name); - header("Content-Type: application/x-gzip"); - header("Content-Disposition: attachment; filename=".$name."-".$hash.".tar.gz"); - readfile("/usr/share/gitweb/dl/".$name."-".$hash.".tar.gz"); - unlink("/usr/share/gitweb/dl/".$name."-".$hash.".tar.gz"); + $id = sha1(time()); + $b = shell_exec("cd /usr/share/gitweb/dl/; git clone git://git.nexus-irc.de/".$_GET['build']); + $c = shell_exec("cd /usr/share/gitweb/dl/".$name."/; git reset ".$_GET['h']); + $con= shell_exec('git --git-dir=/home/git/'.$_GET['build'].' rev-list --oneline --header master | wc -l | sed "s/[ \t]//g"'); + if($_GET['build'] != "gitweb.git") { + scandir_replace("/usr/share/gitweb/dl/".$name,"git-".substr($con, 0, -1)."-".$hash); } + $c = shell_exec("cd /usr/share/gitweb/dl; tar czfv ".$id." ".$name); + $d = shell_exec("rm -r /usr/share/gitweb/dl/".$name); + header("Content-Type: application/x-gzip"); + header("Content-Disposition: attachment; filename=".$name."-".$hash.".tar.gz"); + readfile("/usr/share/gitweb/dl/".$id); + unlink("/usr/share/gitweb/dl/".$id); + }else{ echo "unknown project"; } -- 2.20.1