svn: /pear/packages/Bugtracker/trunk/include/classes/ bug_patchtracker.php
| From: | Jani Taskinen | Date: | Fri, 05 Mar 2010 23:52:52 +0000 |
| Subject: | svn: /pear/packages/Bugtracker/trunk/include/classes/ bug_patchtracker.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-cvs+get-59007@lists.php.net to get a copy of this message | ||
jani Fri, 05 Mar 2010 23:52:52 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=295871
Log:
- Reorder: No sense to create directories and such if no valid file is uploaded.
Changed paths:
U pear/packages/Bugtracker/trunk/include/classes/bug_patchtracker.php
Modified: pear/packages/Bugtracker/trunk/include/classes/bug_patchtracker.php
===================================================================
--- pear/packages/Bugtracker/trunk/include/classes/bug_patchtracker.php 2010-03-05 23:47:16 UTC (rev
295870)
+++ pear/packages/Bugtracker/trunk/include/classes/bug_patchtracker.php 2010-03-05 23:52:52 UTC (rev
295871)
@@ -137,27 +137,30 @@
if (!is_array($obsoletes)) {
return PEAR::raiseError('Invalid obsoleted patches');
}
- $newobsoletes = array();
- foreach ($obsoletes as $who) {
- if (!$who) {
- continue; // remove (none)
- }
- $who = explode('#', $who);
- if (count($who) != 2) {
- continue;
- }
- if (file_exists($this->getPatchFullpath($bugid, $who[0], $who[1]))) {
- $newobsoletes[] = $who;
- }
- }
- if (PEAR::isError($e = $this->setupPatchDir($bugid, $name))) {
- return $e;
- }
+
$file = $this->_upload->getFiles($patch);
if (PEAR::isError($file)) {
return $file;
}
+
if ($file->isValid()) {
+ $newobsoletes = array();
+ foreach ($obsoletes as $who) {
+ if (!$who) {
+ continue; // remove (none)
+ }
+ $who = explode('#', $who);
+ if (count($who) != 2) {
+ continue;
+ }
+ if (file_exists($this->getPatchFullpath($bugid, $who[0], $who[1]))) {
+ $newobsoletes[] = $who;
+ }
+ }
+ if (PEAR::isError($e = $this->setupPatchDir($bugid, $name))) {
+ return $e;
+ }
+
$res = $this->newPatchFileName($bugid, $name, $handle);
if (PEAR::isError($res)) {
return $res;
@@ -219,7 +222,7 @@
}
return $id;
} elseif ($file->isMissing()) {
- return PEAR::raiseError('No patch has been uploaded.');
+ return PEAR::raiseError('Uploaded file is empty or nothing was uploaded.');
} elseif ($file->isError()) {
return PEAR::raiseError($file->errorMsg());
}