]> git.ozlabs.org Git - ccan/commitdiff
committing changes for web pages after update of create_tar_ball
authordinesh <dinesh@dinesh-laptop>
Wed, 13 Aug 2008 09:47:27 +0000 (15:17 +0530)
committerdinesh <dinesh@dinesh-laptop>
Wed, 13 Aug 2008 09:47:27 +0000 (15:17 +0530)
web/configuration
web/db/ccan.db
web/dispmoduleinfo.php
web/tarball/.tar [new file with mode: 0644]
web/uploader.php

index 7d0cc15e714a642d7d1e8b11357c07660ee74bd5..d29bed87e294e6df753f5a98e8cf65eeb657f4ad 100644 (file)
@@ -40,4 +40,7 @@ $bzr_clone = 'bzr clone /home/dinesh/testwebsite/ ';
 
 //bzr push 
 $bzr_push = 'bzr push /home/dinesh/testwebsite/ ';
 
 //bzr push 
 $bzr_push = 'bzr push /home/dinesh/testwebsite/ ';
+
+//tar home dir
+$tar_dir = 'tarball/';
 ?>
\ No newline at end of file
 ?>
\ No newline at end of file
index 8d582d443992153c0cfa9b8897f91ef4652d78c2..77ba6a0124043f33651ca520d14f848fa4d6fc46 100755 (executable)
Binary files a/web/db/ccan.db and b/web/db/ccan.db differ
index b6f0817286c6b6c48bdbf31aa7e247071111b44e..b0aba20e0097b4694b92f3992b122ec5523abee6 100644 (file)
@@ -8,25 +8,20 @@ $handle = sqlite3_open($db) or die("Could not open database");
 $query = "select * from search where module=\"".$_GET['module']."\"";
 $result = sqlite3_query($handle, $query) or die("Error in query: ".sqlite3_error($handle));
 $row = sqlite3_fetch_array($result);
 $query = "select * from search where module=\"".$_GET['module']."\"";
 $result = sqlite3_query($handle, $query) or die("Error in query: ".sqlite3_error($handle));
 $row = sqlite3_fetch_array($result);
-
-if (!file_exists($repopath . $ccan_home_dir.$_GET['module']."/".$_GET['module'].".tar")) {
-       chdir($repopath);
-       exec("tar -cvvf ".$ccan_home_dir. $_GET['module']. "/". $_GET['module'].".tar ". $ccan_home_dir.$_GET['module'], $status);
-       chdir("..");
-}
-
-if (!file_exists($repopath . $ccan_home_dir.$_GET['module']."/".$_GET['module']."_dep.tar")) {
-       chdir($repopath);
-       exec($create_dep_tar." ".$ccan_home_dir.$_GET['module'], $status);
-       chdir("..");
-}
-
-
 ?>
 <table align="center" bgcolor="lightblue" width="70%" border="0" cellpadding="3" cellspacing="1">
 <tr align="center" bgcolor="FFFFCC">
 ?>
 <table align="center" bgcolor="lightblue" width="70%" border="0" cellpadding="3" cellspacing="1">
 <tr align="center" bgcolor="FFFFCC">
-<td width="50%"><a href=<?=$repopath . $ccan_home_dir.$_GET['module']?>/<?=$_GET['module']?>.tar>Download</a></td>
-<td><a href=<?=$repopath . $ccan_home_dir.$_GET['module']?>/<?=$_GET['module']?>_dep.tar>Download Dependencies</a></td>
+<td width="50%">
+       <?php 
+               if(file_exists($tar_dir . $_GET['module']."_dependencies.tar"))
+                       echo '<a href='. $tar_dir . $_GET['module'] . '.tar>Download</a>';
+       ?>
+<td>
+       <?php 
+               if(file_exists($tar_dir . $_GET['module']."_dependencies.tar"))
+                       echo '<a href='. $tar_dir . $_GET['module'] . '_dependencies.tar>Download Dependencies</a>';
+       ?>
+</td>
 </tr>
 </table>
 <table align="center" bgcolor="lightblue" width="70%" border="0" cellpadding="8" cellspacing="1">
 </tr>
 </table>
 <table align="center" bgcolor="lightblue" width="70%" border="0" cellpadding="8" cellspacing="1">
@@ -42,7 +37,21 @@ if (!file_exists($repopath . $ccan_home_dir.$_GET['module']."/".$_GET['module'].
 <td><h3>Author: </h3> <pre><a href=search.php?author=<?=$row['author'];?>><?=$row['author'];?></a></pre></td>
 </tr>
 
 <td><h3>Author: </h3> <pre><a href=search.php?author=<?=$row['author'];?>><?=$row['author'];?></a></pre></td>
 </tr>
 
+<tr align="left" bgcolor="FFFFCC">
+<td><h3>Dependencies: </h3> <pre><?=$row['depends'];?></pre></td>
+</tr>
+
 <tr align="left" bgcolor="FFFFCC">
 <td><h3>Description: </h3> <pre><?=$row['desc'];?></pre></td>
 </tr>
 </table><hr>
 <tr align="left" bgcolor="FFFFCC">
 <td><h3>Description: </h3> <pre><?=$row['desc'];?></pre></td>
 </tr>
 </table><hr>
+
+<?php 
+function checkerror($status, $msg)
+{
+       if($status != 0) {
+                   echo "<div align=\"center\">" . $msg . "Contact ccan admin. </div>";
+                   exit();
+       }
+} 
+?>
\ No newline at end of file
diff --git a/web/tarball/.tar b/web/tarball/.tar
new file mode 100644 (file)
index 0000000..54203d2
Binary files /dev/null and b/web/tarball/.tar differ
index 102ac1dc0f855c9523757af966cfddaef4b53726..0cb1c18409b5c030d263160f996d474fc53c399b 100644 (file)
@@ -22,12 +22,10 @@ if($_FILES["uploadedfile"]["type"] == "application/x-gzip"
                $tempfolder . $_FILES["uploadedfile"]["name"]);
        
        //extracting code
                $tempfolder . $_FILES["uploadedfile"]["name"]);
        
        //extracting code
-       if($_FILES["uploadedfile"]["type"] == "application/zip") {
+       if($_FILES["uploadedfile"]["type"] == "application/zip")
                exec('unzip '.$tempfolder.$_FILES["uploadedfile"]["name"].' -d '.$tempfolder, $op, $status);
                exec('unzip '.$tempfolder.$_FILES["uploadedfile"]["name"].' -d '.$tempfolder, $op, $status);
-       }
-       else {
+       else
                exec('tar -xf '.$tempfolder.$_FILES["uploadedfile"]["name"].' -C '.$tempfolder, $op, $status);
                exec('tar -xf '.$tempfolder.$_FILES["uploadedfile"]["name"].' -C '.$tempfolder, $op, $status);
-       }
        checkerror($status,"Error: cannot extract(tar error).");        
 
        //if user not logged in
        checkerror($status,"Error: cannot extract(tar error).");        
 
        //if user not logged in
@@ -39,11 +37,13 @@ if($_FILES["uploadedfile"]["type"] == "application/x-gzip"
                
                //send mail for review to admins 
                $subject = "Review: code upload at temporary repository"; 
                
                //send mail for review to admins 
                $subject = "Review: code upload at temporary repository"; 
-               $message = "Some developer has uploaded code who has not logged in.\n\nModule is stored in ".$temprepo.$folder.".\n\nOutput of ccanlint: \n";
+               $message = "Some developer has uploaded code who has not logged in.\n\nModule is stored in ".
+                                                       $temprepo.$folder.".\n\nOutput of ccanlint: \n";
                        
        $toaddress = getccanadmin($db);
        mail($toaddress, $subject, $message, "From: $frommail");
                        
        $toaddress = getccanadmin($db);
        mail($toaddress, $subject, $message, "From: $frommail");
-       echo "<div align=\"center\"> Stored to temporary repository. Mail will be send to admin to get verification of the code.<//div>";
+       echo "<div align=\"center\"> Stored to temporary repository. 
+                               Mail will be send to admin to get verification of the code.<//div>";
        unlink($tempfolder.$_FILES["uploadedfile"]["name"]);
        exit();
        } 
        unlink($tempfolder.$_FILES["uploadedfile"]["name"]);
        exit();
        } 
@@ -73,14 +73,18 @@ if($_FILES["uploadedfile"]["type"] == "application/x-gzip"
                        // if owner is not same 
                        if(!(getowner($ccan_home_dir . $folder, $db) == $_SESSION['susername'])) {      
                                if(!file_exists($repopath . $ccan_home_dir . $folder . '-' . $_SESSION['susername']))                           
                        // if owner is not same 
                        if(!(getowner($ccan_home_dir . $folder, $db) == $_SESSION['susername'])) {      
                                if(!file_exists($repopath . $ccan_home_dir . $folder . '-' . $_SESSION['susername']))                           
-                               echo "<div align=\"center\">". $ccan_home_dir . $folder . " already exists. Renaming to " . $folder . "-" . $_SESSION['susername'] . "</div>";
+                               echo "<div align=\"center\">". $ccan_home_dir . $folder . 
+                                               " already exists. Renaming to " . $folder . "-" . $_SESSION['susername'] . "</div>";
                else
                else
-                               echo "<div align=\"center\">". $ccan_home_dir . $folder . "-" . $_SESSION['susername'] . " already exists. Overwriting " . $folder. "-" . $_SESSION['susername'] . "</div>";
+                               echo "<div align=\"center\">". $ccan_home_dir . $folder . 
+                                               "-" . $_SESSION['susername'] . " already exists. Overwriting " . 
+                                                       $folder. "-" . $_SESSION['susername'] . "</div>";
                        $rename = $folder."-".$_SESSION['susername'];
                }
                
                else
                        $rename = $folder."-".$_SESSION['susername'];
                }
                
                else
-                       echo "<div align=\"center\">".$repopath. $ccan_home_dir. $folder. " already exists(uploaded by you). Overwriting ". $repopath. $folder."</div>";
+                       echo "<div align=\"center\">".$repopath. $ccan_home_dir. $folder.
+                                        " already exists(uploaded by you). Overwriting ". $repopath. $folder."</div>";
                                
                }
 
                                
                }
 
@@ -93,18 +97,25 @@ if($_FILES["uploadedfile"]["type"] == "application/x-gzip"
           rename($tempfolder . $folder, $exactpath . $ccan_home_dir . $rename);
                
        chdir($exactpath);
           rename($tempfolder . $folder, $exactpath . $ccan_home_dir . $rename);
                
        chdir($exactpath);
-               unset($op); exec($infotojson . $ccan_home_dir . $rename . " " . $ccan_home_dir. $rename."/_info.c ". $ccan_home_dir . $rename . "/json_" . $rename . " " . $_SESSION['susername']. " ../../" . $db, $op, $status);
+               unset($op); exec($infotojson . $ccan_home_dir . $rename . " " . $ccan_home_dir.
+                                                $rename."/_info.c ". $ccan_home_dir . $rename . "/json_" . $rename . " " 
+                                                       . $_SESSION['susername']. " ../../" . $db, $op, $status);
                checkerror($status,"Error: In infotojson.");
                
                unset($op); exec('bzr add', $op, $status);
                checkerror($status,"Error: bzr add error.");
                
                checkerror($status,"Error: In infotojson.");
                
                unset($op); exec('bzr add', $op, $status);
                checkerror($status,"Error: bzr add error.");
                
-               unset($op); exec('bzr commit --unchanged -m "commiting from ccan web ' . $rename . " " . $_SESSION['susername'] . '"', $op, $status);
+               unset($op); exec('bzr commit --unchanged -m "commiting from ccan web ' . $rename . 
+                                                       " " . $_SESSION['susername'] . '"', $op, $status);
                checkerror($status,"Error: bzr commit error."); 
                        
                unset($op); exec($bzr_push, $op, $status);
                checkerror($status,"Error: bzr push error.");
                
                checkerror($status,"Error: bzr commit error."); 
                        
                unset($op); exec($bzr_push, $op, $status);
                checkerror($status,"Error: bzr push error.");
                
+               unset($op); exec($create_dep_tar . " " . $ccan_home_dir. $rename . " ../../" . 
+                                                       $tar_dir . " ../../" . $db , $op, $status); 
+               checkerror($status,"Error: bzr push error.");
+               
                chdir('../..');
                rmdirr($exactpath);
        echo "<div align=\"center\"> Stored to ". $ccan_home_dir . $rename . "</div>";
                chdir('../..');
                rmdirr($exactpath);
        echo "<div align=\"center\"> Stored to ". $ccan_home_dir . $rename . "</div>";
@@ -119,7 +130,9 @@ if($_FILES["uploadedfile"]["type"] == "application/x-gzip"
                if($score == '')
                        $msg =  'Below is details for test.';
                        
                if($score == '')
                        $msg =  'Below is details for test.';
                        
-               echo "<div align=\"center\"><table><tr><td> Score for code is low. Cannot copy to repository. Moving to ". $junkcode.$folder.'-'.$_SESSION['susername']."... </br></br>". $msg ." </br></br></td></tr><tr><td>";
+               echo "<div align=\"center\"><table><tr><td> Score for code is low.
+                                Cannot copy to repository. Moving to ". $junkcode.$folder.'-'.
+                                       $_SESSION['susername']."... </br></br>". $msg ." </br></br></td></tr><tr><td>";
 
                foreach($score as $disp)
                        echo "$disp</br>";
 
                foreach($score as $disp)
                        echo "$disp</br>";