From: dinesh Date: Wed, 13 Aug 2008 09:47:27 +0000 (+0530) Subject: committing changes for web pages after update of create_tar_ball X-Git-Url: https://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=a46b454ed1d73420464f1dec32e6d05c5c36f198 committing changes for web pages after update of create_tar_ball --- diff --git a/web/configuration b/web/configuration index 7d0cc15e..d29bed87 100644 --- a/web/configuration +++ b/web/configuration @@ -40,4 +40,7 @@ $bzr_clone = 'bzr clone /home/dinesh/testwebsite/ '; //bzr push $bzr_push = 'bzr push /home/dinesh/testwebsite/ '; + +//tar home dir +$tar_dir = 'tarball/'; ?> \ No newline at end of file diff --git a/web/db/ccan.db b/web/db/ccan.db index 8d582d44..77ba6a01 100755 Binary files a/web/db/ccan.db and b/web/db/ccan.db differ diff --git a/web/dispmoduleinfo.php b/web/dispmoduleinfo.php index b6f08172..b0aba20e 100644 --- a/web/dispmoduleinfo.php +++ b/web/dispmoduleinfo.php @@ -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); - -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(".."); -} - - ?> - - +
/.tar>Download/_dep.tar>Download Dependencies + Download'; + ?> + + Download Dependencies'; + ?> +
@@ -42,7 +37,21 @@ if (!file_exists($repopath . $ccan_home_dir.$_GET['module']."/".$_GET['module']. + + + +

Author:

>

Dependencies:

Description:


+ +" . $msg . "Contact ccan admin. "; + exit(); + } +} +?> \ No newline at end of file diff --git a/web/tarball/.tar b/web/tarball/.tar new file mode 100644 index 00000000..54203d2c Binary files /dev/null and b/web/tarball/.tar differ diff --git a/web/uploader.php b/web/uploader.php index 102ac1dc..0cb1c184 100644 --- a/web/uploader.php +++ b/web/uploader.php @@ -22,12 +22,10 @@ if($_FILES["uploadedfile"]["type"] == "application/x-gzip" $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); - } - else { + else exec('tar -xf '.$tempfolder.$_FILES["uploadedfile"]["name"].' -C '.$tempfolder, $op, $status); - } 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"; - $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"); - echo "
Stored to temporary repository. Mail will be send to admin to get verification of the code."; + echo "
Stored to temporary repository. + Mail will be send to admin to get verification of the code."; 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'])) - echo "
". $ccan_home_dir . $folder . " already exists. Renaming to " . $folder . "-" . $_SESSION['susername'] . "
"; + echo "
". $ccan_home_dir . $folder . + " already exists. Renaming to " . $folder . "-" . $_SESSION['susername'] . "
"; else - echo "
". $ccan_home_dir . $folder . "-" . $_SESSION['susername'] . " already exists. Overwriting " . $folder. "-" . $_SESSION['susername'] . "
"; + echo "
". $ccan_home_dir . $folder . + "-" . $_SESSION['susername'] . " already exists. Overwriting " . + $folder. "-" . $_SESSION['susername'] . "
"; $rename = $folder."-".$_SESSION['susername']; } else - echo "
".$repopath. $ccan_home_dir. $folder. " already exists(uploaded by you). Overwriting ". $repopath. $folder."
"; + echo "
".$repopath. $ccan_home_dir. $folder. + " already exists(uploaded by you). Overwriting ". $repopath. $folder."
"; } @@ -93,18 +97,25 @@ if($_FILES["uploadedfile"]["type"] == "application/x-gzip" 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."); - 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."); + 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 "
Stored to ". $ccan_home_dir . $rename . "
"; @@ -119,7 +130,9 @@ if($_FILES["uploadedfile"]["type"] == "application/x-gzip" if($score == '') $msg = 'Below is details for test.'; - echo "
Score for code is low. Cannot copy to repository. Moving to ". $junkcode.$folder.'-'.$_SESSION['susername']."...

". $msg ."

"; + echo "
Score for code is low. + Cannot copy to repository. Moving to ". $junkcode.$folder.'-'. + $_SESSION['susername']."...

". $msg ."

"; foreach($score as $disp) echo "$disp
";