echo "No Download available";
}else{
$name=substr($_GET["p"],0,strlen($_GET["p"])-4);
- if(file_exists("/usr/share/gitweb/dl/".$name."-".substr($hash, 0, -1).".tar.gz")) {
- echo "<a href='http://git.nexus-irc.de/dl/".$name."-".substr($hash, 0, -1).".tar.gz'>".$name."-".substr($hash, 0, -1)." (tar.gz)</a>";
- } else {
- echo "No Download available (<a href='http://git.nexus-irc.de/git_download.php?build=".$_GET["p"]."'>Build snapshot</a>)";
- }
- }
- }else{
- echo "unknown project";
- }
-}elseif(isset($_GET['git'])){
- if(file_exists("/home/git/".$_GET['git'])){
- $hash = shell_exec("git --git-dir=/home/git/".$_GET["git"]." rev-list -n 1 --pretty='format:%h' --header master | grep '^[0-9a-f]*$'");
- $con= shell_exec('git --git-dir=/home/git/'.$_GET["git"].' rev-list --oneline --header master | wc -l | sed "s/[ \t]//g"');
- if(!$hash){
- echo "<p>".$_GET["git"].": No Download available</p>";
- }else{
- $name=substr($_GET["git"],0,strlen($_GET["git"])-4);
- if(file_exists("/usr/share/gitweb/dl/".$name."-".substr($hash, 0, -1).".tar.gz")) {
- echo "<p><a href='http://git.nexus-irc.de/dl/".$name."-".substr($hash, 0, -1).".tar.gz'>".$name."-".substr($hash, 0, -1)." (tar.gz)</a></p>";
- } else {
- echo "<p>No Download available (<a href='http://git.nexus-irc.de/git_download.php?build=".$_GET["git"]."'>Build snapshot</a>)</p>";
- }
+ echo "<a href='http://git.nexus-irc.de/git_download.php?build=".$_GET["p"]."'>".$name."-".substr($hash, 0, -1)." (tar.gz)</a>";
}
}else{
echo "unknown project";
}
}elseif(isset($_GET['build'])){
+
if(file_exists("/home/git/".$_GET['build'])){
- $hash = shell_exec("git --git-dir=/home/git/".$_GET['build']." rev-list -n 1 --pretty='format:%h' --header master | grep '^[0-9a-f]*$'");
- $con= shell_exec('git --git-dir=/home/git/'.$_GET['build'].' rev-list --oneline --header master | wc -l | sed "s/[ \t]//g"');
$name=substr($_GET['build'],0,strlen($_GET['build'])-4);
- if(file_exists("/usr/share/gitweb/dl/".$name."-".substr($hash, 0, -1).".tar.gz")) {
- echo '<meta http-equiv="refresh" content="0; URL='.$_SERVER['HTTP_REFERER'].'"> ';
- }else{
- $b = shell_exec("cd /usr/share/gitweb/dl; git clone git://git.nexus-irc.de/".$_GET['build']);
- if($_GET['build'] != "gitweb.git") {
- scandir_replace("/usr/share/gitweb/dl/".$name,"git-".substr($con, 0, -1)."-".substr($hash, 0, -1));
+ if(isset($_GET['h'])){
+ if(strtolower($_GET['h']) == "head") {
+ $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, -1);
+ }else{
+ $hash = substr($_GET['h'], 0, 7);
}
- $c = shell_exec("cd /usr/share/gitweb/dl; tar czfv ".$name."-".substr($hash, 0, -1).".tar.gz ".$name);
- $d = shell_exec("rm -r /usr/share/gitweb/dl/".$name);
- echo '<meta http-equiv="refresh" content="0; URL='.$_SERVER['HTTP_REFERER'].'"> ';
- }
- }else{
- echo "unknown project";
- }
-}elseif(isset($_GET['build2']) && isset($_GET['h'])){
- if(file_exists("/home/git/".$_GET['build2'])){
- $name=substr($_GET['build2'],0,strlen($_GET['build2'])-4);
- if(strtolower($_GET['h']) == "head") {
- $hash = substr(shell_exec("git --git-dir=/home/git/".$_GET['build2']." rev-list -n 1 --pretty='format:%h' --header master | grep '^[0-9a-f]*$'"), 0, -1);
}else{
- $hash = substr($_GET['h'], 0, 7);
+ $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['build2']);
+ $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['build2'].' rev-list --oneline --header master | wc -l | sed "s/[ \t]//g"');
- if($_GET['build2'] != "gitweb.git") {
+ $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);
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{
echo "unknown project";
}
}else{
+ echo "<table class='project_list'>";
+ echo "<tr><th>Project</th><th>Download</th></tr>";
$a = file_get_contents("http://git.nexus-irc.de/index.cgi?a=project_index2");
$b = explode("\n",$a);
foreach($b as $id => $v) {
$hash = shell_exec("git --git-dir=/home/git/".$v." rev-list -n 1 --pretty='format:%h' --header master | grep '^[0-9a-f]*$'");
$con= shell_exec('git --git-dir=/home/git/'.$v.' rev-list --oneline --header master | wc -l | sed "s/[ \t]//g"');
if(!$hash){
- echo "<p>".$v.": No Download available</p>";
+ echo "<tr><td>".$v."</td><td>No Download available</td></tr>";
}else{
$name=substr($v,0,strlen($v)-4);
- if(file_exists("/usr/share/gitweb/dl/".$name."-".substr($hash, 0, -1).".tar.gz")) {
- echo "<p>".$v.": Download <a href='http://git.nexus-irc.de/dl/".$name."-".substr($hash, 0, -1).".tar.gz'>".$name."-".substr($hash, 0, -1)." (tar.gz)</a></p>";
- } else {
- echo "<p>".$v.": No Download available (<a href='http://git.nexus-irc.de/git_download.php?build=".$v."'>Build snapshot</a>)</p>";
- }
+ echo "<tr><td>".$v."</td><td><a href='http://git.nexus-irc.de/git_download.php?build=".$v."'>".$name."-".substr($hash, 0, -1)." (tar.gz)</a></td></tr>";
}
}
}
+ echo "</table>";
}
?>
\ No newline at end of file