summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEudyptula <eitan@mosenkis.net>2009-08-10 17:01:41 -0400
committerEudyptula <eitan@mosenkis.net>2009-08-10 17:01:41 -0400
commit302d7b2991f22b9d5cb85de8bd7a2062948ef9fa (patch)
treebf6ab88f51cbf1342569bfd51832458e27102ec2
parentMajor backend reorganization - moved much of backend.php into build class, re... (diff)
downloadingenue-302d7b2991f22b9d5cb85de8bd7a2062948ef9fa.tar.gz
ingenue-302d7b2991f22b9d5cb85de8bd7a2062948ef9fa.tar.bz2
ingenue-302d7b2991f22b9d5cb85de8bd7a2062948ef9fa.zip
Have upload respond in plaintext, not HTML (so long as authentication succeeds)
-rw-r--r--frontend/pages/upload.php25
-rw-r--r--shared/classes/build.php4
-rw-r--r--todo1
3 files changed, 11 insertions, 19 deletions
diff --git a/frontend/pages/upload.php b/frontend/pages/upload.php
index 5f71eb3..d8dd4ec 100644
--- a/frontend/pages/upload.php
+++ b/frontend/pages/upload.php
@@ -15,25 +15,20 @@ function init_upload(&$S) {
debug('upload', 'invalid upload key');
return '404';
}
+ contenttype('text/plain');
+}
+function body_upload(&$S) {
debug('upload', 'error code: '.$_FILES['file']['error']);
- if ($_FILES['file']['error'] != UPLOAD_ERR_OK) {
- return '404';
- }
+ if ($_FILES['file']['error'] != UPLOAD_ERR_OK)
+ die('Upload failed');
debug('upload', 'Got uploaded file '.$_FILES['file']['name'].' at '.$_FILES['file']['tmp_name']);
$name=basename($_FILES['file']['name']);
$ext=substr($name, strpos($name, '.'));
debug('upload', $_FILES['file']['tmp_name'].' -> '.COMPLETED."/build-$build->id$ext");
- if (!is_writable(COMPLETED)) {
- debug('upload', 'Web server needs write permissions for '.COMPLETED);
- return '404';
- }
- if (!move_uploaded_file($_FILES['file']['tmp_name'], COMPLETED."/build-$build->id$ext")) {
- debug('Move file failed');
- return '404';
- }
- return array('title' => 'Upload Successful');
-}
-function body_upload() {
- echo print_success('Upload successful');
+ if (!is_writable(COMPLETED))
+ die('No write permissions');
+ if (!move_uploaded_file($_FILES['file']['tmp_name'], COMPLETED."/build-$build->id$ext"))
+ die('Move file failed');
+ echo 'Upload successful';
}
?>
diff --git a/shared/classes/build.php b/shared/classes/build.php
index 10b2043..3c65f9b 100644
--- a/shared/classes/build.php
+++ b/shared/classes/build.php
@@ -219,7 +219,6 @@ class sql_build extends conf_build_common {
default:
return $file;
}
- print_r($S['build_steps']);
while ($step < count($S['build_steps'])) {
require(BACKEND."/bundlers/$bundler/{$S['build_steps'][$step]}.php");
$step++;
@@ -249,8 +248,7 @@ class sql_build extends conf_build_common {
));
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
$result=curl_exec($c);
- $result($result !== false && strpos($result, 'Upload successful') !== false);
- if ($result) {
+ if (trim($result) == 'Upload successful') {
$this->status='complete';
$this->finish=time();
$this->write();
diff --git a/todo b/todo
index cca8939..f1381e4 100644
--- a/todo
+++ b/todo
@@ -23,4 +23,3 @@ Ask someone to add the necessary USE flags to php on tinderbox
Add rollback to backend so it can resume after a partial task
Offer option in frontend to submit a failed build for resume
Change builds->display() to handle `failed` column
-Confirm that backend stops after success