svn: /pear/pearweb/trunk/ include/DataObject/Bugdb.php include/DataObject/Bugdb_comments.php include/bugs/pear-bugs.php public_html/bugs/bug.php

[email protected] ("Daniel O'Connor") Sun, 11 Sep 2011 02:06:35 +0000
Newsgroups php.pear.cvs,php.pear.core
Message-ID <[email protected]>
--c5c595080d35c04f7d3459732b6fc6710085af53
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit

clockwerx                                Sun, 11 Sep 2011 02:06:35 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=316481

Log:
Bug #18788 Ensure that queries relating to bugdb_comments are aware of active/inactive

Bug: http://pear.php.net/bugs/18788 (unknown) 
      
Changed paths:
    U   pear/pearweb/trunk/include/DataObject/Bugdb.php
    U   pear/pearweb/trunk/include/DataObject/Bugdb_comments.php
    U   pear/pearweb/trunk/include/bugs/pear-bugs.php
    U   pear/pearweb/trunk/public_html/bugs/bug.php

Modified: pear/pearweb/trunk/include/DataObject/Bugdb.php
===================================================================
--- pear/pearweb/trunk/include/DataObject/Bugdb.php	2011-09-10 18:28:59 UTC (rev 316480)
+++ pear/pearweb/trunk/include/DataObject/Bugdb.php	2011-09-11 02:06:35 UTC (rev 316481)
@@ -33,4 +33,4 @@
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
 }
-?>
\ No newline at end of file
+?>

Modified: pear/pearweb/trunk/include/DataObject/Bugdb_comments.php
===================================================================
--- pear/pearweb/trunk/include/DataObject/Bugdb_comments.php	2011-09-10 18:28:59 UTC (rev 316480)
+++ pear/pearweb/trunk/include/DataObject/Bugdb_comments.php	2011-09-11 02:06:35 UTC (rev 316481)
@@ -16,6 +16,7 @@
     var $handle;                          // string(20)  not_null
     var $ts;                              // datetime(19)
     var $comment;                         // blob(65535)  not_null blob
+    var $active;                          // bool

     /* Static get */
     function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Bugs_DBDataObject_Bugdb_Comments',$k,$v); }
@@ -23,4 +24,4 @@
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
 }
-?>
\ No newline at end of file
+?>

Modified: pear/pearweb/trunk/include/bugs/pear-bugs.php
===================================================================
--- pear/pearweb/trunk/include/bugs/pear-bugs.php	2011-09-10 18:28:59 UTC (rev 316480)
+++ pear/pearweb/trunk/include/bugs/pear-bugs.php	2011-09-11 02:06:35 UTC (rev 316481)
@@ -103,7 +103,7 @@
         $opened = $this->_dbh->getOne('SELECT COUNT(*) FROM bugdb WHERE
             handle=?', array($handle));
         $commented = $this->_dbh->getOne('SELECT COUNT(*) FROM bugdb_comments WHERE
-            handle=?', array($handle));
+            handle=? AND active = 1', array($handle));
         $opencount = $this->_dbh->getOne('SELECT COUNT(*)
              FROM bugdb b, maintains m, packages p
              WHERE
@@ -222,13 +222,14 @@
                   b.status NOT IN ("Spam", "Bogus")
                  GROUP BY u.handle
                  ORDER BY u.handle', false, array(), DB_FETCHMODE_ASSOC);
-        $comments = $this->_dbh->getAssoc('SELECT u.handle, COUNT(*) as c
+        $comments = $this->_dbh->getAssoc('SELECT u.handle, COUNT(0) as c
                  FROM bugdb_comments b, bugdb d, users u
                  WHERE
                   b.handle = u.handle AND
                   u.registered = 1 AND
                   d.id = b.bug AND
-                  d.status NOT IN ("Spam", "Bogus")
+                  d.status NOT IN ("Spam", "Bogus") AND
+                  b.active = 1
                  GROUP BY u.handle
                  ORDER BY u.handle', false, array(), DB_FETCHMODE_ASSOC);
         $patches = $this->_dbh->getAssoc('SELECT u.handle, COUNT(*) as c
@@ -255,4 +256,4 @@
         arsort($bugs);
         return $bugs;
     }
-}
\ No newline at end of file
+}

Modified: pear/pearweb/trunk/public_html/bugs/bug.php
===================================================================
--- pear/pearweb/trunk/public_html/bugs/bug.php	2011-09-10 18:28:59 UTC (rev 316480)
+++ pear/pearweb/trunk/public_html/bugs/bug.php	2011-09-11 02:06:35 UTC (rev 316481)
@@ -325,8 +325,8 @@
             }

             $query = 'INSERT INTO bugdb_comments' .
-                     ' (bug, email, handle, ts, comment, reporter_name) VALUES (' .
-                     '?,?,?,NOW(),?,?)';
+                     ' (bug, email, handle, ts, comment, reporter_name, active) VALUES (' .
+                     '?,?,?,NOW(),?,?, 1)';

             $dbh->query($query, array($id, $_POST['in']['commentemail'], $_POST['in']['handle'],
                 $ncomment, $_POST['in']['name']));
@@ -397,7 +397,7 @@

         if (!empty($ncomment)) {
             $query = 'INSERT INTO bugdb_comments' .
-                     ' (bug, email, comment, ts) VALUES (?, ?, ?. NOW())';
+                     ' (bug, email, comment, ts, active) VALUES (?, ?, ?. NOW(), 1)';
             $dbh->query($query, array($id, $from, $ncomment));
         }
     }
@@ -532,7 +532,7 @@

         if (!empty($ncomment)) {
             $query = 'INSERT INTO bugdb_comments' .
-                     ' (bug, email, ts, comment, reporter_name, handle) VALUES (?, ?, NOW(), ?, ?, ?)';
+                     ' (bug, email, ts, comment, reporter_name, handle, active) VALUES (?, ?, NOW(), ?, ?, ?, 1)';
             $dbh->query($query, array($id, $from, $ncomment, $comment_name, $auth_user->handle));
         }
     }
@@ -1260,7 +1260,7 @@
     u.showemail, u.handle,c.handle as bughandle
     FROM bugdb_comments c
     LEFT JOIN users u ON u.handle = c.handle
-    WHERE c.bug = ?
+    WHERE c.bug = ? AND c.active = 1
     GROUP BY c.id ORDER BY c.ts';
 $res = $dbh->query($query, array($id));
 if ($res) {

--c5c595080d35c04f7d3459732b6fc6710085af53--