svn: /pear/pearweb/trunk/include/bugs/ patchtracker.php
| From: | Christian Weiske | Date: | Sat, 15 Aug 2009 08:46:30 +0000 |
| Subject: | svn: /pear/pearweb/trunk/include/bugs/ patchtracker.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-cvs+get-57142@lists.php.net to get a copy of this message | ||
cweiske Sat, 15 Aug 2009 08:46:30 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=287315
Log:
use detach method to clean up, and clean up when finfo is not available and throw notice when dir
does not exist
Changed paths:
U pear/pearweb/trunk/include/bugs/patchtracker.php
Modified: pear/pearweb/trunk/include/bugs/patchtracker.php
===================================================================
--- pear/pearweb/trunk/include/bugs/patchtracker.php 2009-08-15 07:34:37 UTC (rev 287314)
+++ pear/pearweb/trunk/include/bugs/patchtracker.php 2009-08-15 08:46:30 UTC (rev 287315)
@@ -10,6 +10,11 @@
{
if (!file_exists(PEAR_PATCHTRACKER_TMPDIR)) {
if (!@mkdir(PEAR_PATCHTRACKER_TMPDIR)) {
+ trigger_error(
+ 'Could not create directory for patches:'
+ . PEAR_PATCHTRACKER_TMPDIR,
+ E_USER_NOTICE
+ );
$this->_upload = false;
$this->_dbh = &$GLOBALS['dbh'];
return;
@@ -183,6 +188,10 @@
);
// return mime type ala mimetype extension
+ if (!class_exists('finfo')) {
+ $this->detach($bugid, $name, $id);
+ return PEAR::raiseError('Error: finfo missing (fileinfo extension)');
+ }
$finfo = new finfo(FILEINFO_MIME);
if (!$finfo) {
return PEAR::raiseError('Error: Opening fileinfo database failed');
@@ -195,9 +204,7 @@
$mime = $t[0];
if (!in_array($mime, $allowed_mime_types)) {
- $this->_dbh->query('DELETE FROM bugdb_patchtracker
- WHERE bugdb_id = ? and patch = ? and revision = ?',
- array($bugid, $name, $id));
+ $this->detach($bugid, $name, $id);
return PEAR::raiseError('Error: uploaded patch file must be text'
. ' file (save as e.g. "patch.txt" or
"package.diff")'
. ' (detected "' . htmlspecialchars($mime) . '")'
@@ -205,9 +212,7 @@
}
$tmpfile = $file->moveTo($this->patchDir($bugid, $name));
if (PEAR::isError($tmpfile)) {
- $this->_dbh->query('DELETE FROM bugdb_patchtracker
- WHERE bugdb_id = ? and patch = ? and revision = ?',
- array($bugid, $name, $id));
+ $this->detach($bugid, $name, $id);
return $tmpfile;
}
if (!$file->getProp('size')) {