com web/bugs: - Fixed bug #63068 (Auto bug closing via commit messages don't update the bug history): include/functions.php www/rpc.php
| From: | Felipe Pena | Date: | Wed, 12 Sep 2012 15:07:54 +0000 |
| Subject: | com web/bugs: - Fixed bug #63068 (Auto bug closing via commit messages don't update the bug history): include/functions.php www/rpc.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-14704@lists.php.net to get a copy of this message | ||
Commit: 4a031e576841b49ed7b7182e8aedd84a9b8e290d
Author: Felipe Pena <felipensp@gmail.com> Wed, 12 Sep 2012 12:07:54 -0300
Parents: 31876f44191dd7e4544f1dfa947fae408b7f67a4
Branches: master
Link: http://git.php.net/?p=web/bugs.git;a=commitdiff;h=4a031e576841b49ed7b7182e8aedd84a9b8e290d
Log:
- Fixed bug #63068 (Auto bug closing via commit messages don't update the bug history)
Bugs:
https://bugs.php.net/63068
Changed paths:
M include/functions.php
M www/rpc.php
Diff:
diff --git a/include/functions.php b/include/functions.php
index 6d1b892..2a8647c 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -1654,6 +1654,18 @@ function bugs_add_comment ($bug_id, $from, $from_name, $comment, $type =
'commen
}
/**
+ * Change bug status
+ */
+function bugs_status_change ($bug_id, $new_status)
+{
+ global $dbh;
+
+ return $dbh->prepare("
+ UPDATE bugdb SET status = ? WHERE id = ? LIMIT 1
+ ")->execute(array($new_status, $bug_id));
+}
+
+/**
* Verify bug password
*
* @return bool
diff --git a/www/rpc.php b/www/rpc.php
index 60f5da0..a4c3d1e 100644
--- a/www/rpc.php
+++ b/www/rpc.php
@@ -45,31 +45,34 @@ if (!bugs_has_access($bug_id, $bug, $pwd, $user_flags)) {
if (!empty($_POST['ncomment']) && !empty($_POST['user'])) {
$user = htmlspecialchars(trim($_POST['user']));
$ncomment = htmlspecialchars(trim($_POST['ncomment']));
- $prep = $dbh->prepare("
- INSERT INTO bugdb_comments (bug, email, ts, comment, reporter_name, comment_type)
- VALUES (?, ?, NOW(), ?, ?, 'svn')
- ");
- $res = $prep->execute(array ($bug_id, "{$user}@php.net", $ncomment, $user));
+ $from = "{$user}@php.net";
+
+ /* svn log comment */
+ bugs_add_comment($bug_id, $from, $user, $ncomment, 'svn');
if ($res) {
/* Close the bug report as requested if it is not already closed */
if (!empty($_POST['status'])
&& $bug['status'] !== 'Closed'
&& $_POST['status'] === 'Closed') {
- $prep = $dbh->prepare("
- UPDATE bugdb
- SET status = 'Closed'
- WHERE id = ?
- LIMIT 1
- ");
- $prep->execute(array($bug_id));
+ /* Change the bug status to Closed */
+ bugs_status_change($bug_id, 'Closed');
$in = $bug;
/* Just change the bug status */
$in['status'] = $_POST['status'];
+ $changed = bug_diff($bug, $in);
+ if (!empty($changed)) {
+ $log_comment = bug_diff_render_html($changed);
+ if (!empty($log_comment)) {
+ /* Add a log of status change */
+ $res = bugs_add_comment($bug_id, $from, '', $log_comment, 'log');
+ }
+ }
+
/* Send a mail notification when automatically closing a bug */
- mail_bug_updates($bug, $in, "{$user}@php.net", $ncomment, 2, $bug_id);
+ mail_bug_updates($bug, $in, $from, $ncomment, 2, $bug_id);
}
echo json_encode(array('result' => array('status' => $bug)));