cvs: pearweb /public_html release-upload.php
| From: | Stig Bakken | Date: | Wed, 26 Dec 2001 03:38:26 +0000 |
| Subject: | cvs: pearweb /public_html release-upload.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-1693@lists.php.net to get a copy of this message | ||
ssb Tue Dec 25 22:38:26 2001 EDT
Modified files:
/pearweb/public_html release-upload.php
Log:
* first working version, still has a few quirks though
Index: pearweb/public_html/release-upload.php
diff -u pearweb/public_html/release-upload.php:1.1 pearweb/public_html/release-upload.php:1.2
--- pearweb/public_html/release-upload.php:1.1 Fri Dec 21 23:41:18 2001
+++ pearweb/public_html/release-upload.php Tue Dec 25 22:38:26 2001
@@ -1,7 +1,10 @@
<?php
+auth_require();
+
define('HTML_FORM_MAX_FILE_SIZE', 16 * 1024 * 1024); // 16 MB
require_once "HTML/Form.php";
+require_once "HTML/Table.php";
$display_form = true;
$display_verification = false;
@@ -15,8 +18,9 @@
$tmpsize = $_FILES['distfile']['size'];
}
if (isset($verify)) {
- $ok = release::upload($package, $version, $state, $relnotes,
- $distfile, md5_file($distfile));
+ $ok = release::upload($package, $version, $release_state,
+ $release_notes, $distfile, md5_file($distfile));
+ @unlink($distfile);
if (PEAR::isError($ok)) {
display_error("Error while uploading package: ".$ok->getMessage());
break;
@@ -24,6 +28,7 @@
response_header("Release Upload Finished");
print "The release of package
$package' version $version' ";
print "was completed successfully.";
+ $display_form = $display_verification = false;
}
} while (false);
@@ -83,8 +88,39 @@
include_once "PEAR/Common.php";
response_header("Upload New Release: Verify");
$util =& new PEAR_Common;
+ $oldcwd = getcwd();
+ $tmpdir = System::tmpdir();
+ chdir($tmpdir);
$info = $util->infoFromTgzFile($tmpfile, false);
- print "<pre>"; var_dump($info); print "</pre>";
+ $util->addTempFile("$tmpdir/$info[package]-$info[version]");
+ chdir($oldcwd);
+ $newtmpfile = System::mktemp("-t $tmpdir pear");
+ // XXX this will leave files in /tmp if users don't complete the
+ // next screen. Janitor cron job recommended!
+ copy($tmpfile, $newtmpfile);
+ $form =& new HTML_Form($PHP_SELF, "POST");
+ $form->addHidden('distfile', $newtmpfile);
+ $form->addSubmit('verify', 'Verify Release');
+ foreach ($info as $name => $value) {
+ if (is_string($value)) {
+ $form->addHidden($name, $value);
+ }
+ }
+// print "<pre>\n"; var_dump($info); print "</pre>\n";
+ // XXX ADD MASSIVE SANITY CHECKS HERE
+ border_box_start("Please verify that the following release information ".
+ "is correct:");
+ print "<table border=\"0\" cellpadding=\"3\"
cellspacing=\"0\">\n";
+ print "<tr><th
align=\"right\">Package:</th><td>$info[package]</td></tr>\n";
+ print "<tr><th
align=\"right\">Version:</th><td>$info[version]</td></tr>\n";
+ print "<tr><th
align=\"right\">Summary:</th><td>$info[summary]</td></tr>\n";
+ print "<tr><th
align=\"right\">Description:</th><td>$info[description]</td></tr>\n";
+ print "<tr><th align=\"right\">Release
State:</th><td>$info[release_state]</td></tr>\n";
+ print "<tr><th align=\"right\">Release
Date:</th><td>$info[release_date]</td></tr>\n";
+ print "<tr><th align=\"right\">Release
Notes:</th><td>$info[release_notes]</td></tr>\n";
+ print "</table>\n";
+ $form->display();
+ border_box_end();
}
response_footer();