svn: /pear/packages/Bugtracker/trunk/ include/functions.php scripts/cron/no-feedback

From: Date: Wed, 03 Mar 2010 17:44:18 +0000
Subject: svn: /pear/packages/Bugtracker/trunk/ include/functions.php scripts/cron/no-feedback
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-9255@lists.php.net to get a copy of this message
jani Wed, 03 Mar 2010 17:44:18 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=295798 Log: - Added missing "no-feedback cron job Changed paths: U pear/packages/Bugtracker/trunk/include/functions.php A pear/packages/Bugtracker/trunk/scripts/cron/no-feedback Modified: pear/packages/Bugtracker/trunk/include/functions.php =================================================================== --- pear/packages/Bugtracker/trunk/include/functions.php 2010-03-03 17:43:57 UTC (rev 295797) +++ pear/packages/Bugtracker/trunk/include/functions.php 2010-03-03 17:44:18 UTC (rev 295798) @@ -746,7 +746,7 @@ * * @return void */ -function mail_bug_updates($bug, $in, $from, $ncomment, $edit = 1, $id) +function mail_bug_updates($bug, $in, $from, $ncomment, $edit = 1, $id = false) { global $tla, $bug_types, $siteBig, $site_url, $basedir; Added: pear/packages/Bugtracker/trunk/scripts/cron/no-feedback =================================================================== --- pear/packages/Bugtracker/trunk/scripts/cron/no-feedback (rev 0) +++ pear/packages/Bugtracker/trunk/scripts/cron/no-feedback 2010-03-03 17:44:18 UTC (rev 295798) @@ -0,0 +1,57 @@ +#!/local/bin/php -q +<?php /* vim: set ft=phpbugdb noet ts=4 sw=4 : */ + +# this script closes bugs due to lack of feedback. + +require dirname(__FILE__).'/../../include/prepend.php'; + +$message = +'No feedback was provided for this bug for over a week, so it is +being suspended automatically. If you are able to provide the +information that was originally requested, please do so and change +the status of the bug back to "Open".'; + +# date interval to close after +$after = "7 DAY"; + +# fetch info about the bug into $bug +$query = " + SELECT id, package_name, bug_type, email, passwd, sdesc, ldesc, php_version, + php_os, status, ts1, ts2, assign, UNIX_TIMESTAMP(ts1) AS submitted, UNIX_TIMESTAMP(ts2) AS modified + FROM bugdb + WHERE status = 'Feedback' AND ts2 < DATE_SUB(NOW(), INTERVAL {$after})"; + +# Set "input" array +$in = array('status' => 'No Feedback'); + +# Update relevant reports +if ($dbh) +{ + $res = $dbh->prepare($query)->execute(array()); + if (PEAR::isError($res)) { + throw new Exception("SQL Error in no-feedback"); + } + while ($bug = $res->fetchRow(MDB2_FETCHMODE_ASSOC)) + { + list($mailto, $mailfrom) = get_package_mail($bug['package_name']); + + $dbh->prepare(' + INSERT INTO bugdb_comments (bug, email, comment, reporter_name, ts) + VALUES (?, ?, ?, "", NOW()) + ')->execute(array( + $bug['id'], + $mailfrom, + $message, + )); + + $dbh->prepare(' + UPDATE bugdb + SET status = "No Feedback", ts2 = NOW() + WHERE id = ? + ')->execute(array( + $bug['id'], + )); + + mail_bug_updates($bug, $in, $mailfrom, $message); + } +} Property changes on: pear/packages/Bugtracker/trunk/scripts/cron/no-feedback ___________________________________________________________________ Added: svn:executable + *

« previous php.pear.core (#9255) next »