Files
archived-web-bugs/scripts/cron/no-feedback
2019-05-22 02:41:51 +02:00

45 lines
1.4 KiB
PHP
Executable File

#!/usr/bin/env php
<?php /* vim: set ft=phpbugdb noet ts=4 sw=4 : */
# this script closes bugs due to lack of feedback.
use App\Repository\BugRepository;
use App\Repository\ReasonRepository;
require __DIR__.'/../../include/prepend.php';
# Set "input" array
$in = ['status' => 'No Feedback'];
# Update relevant reports
$reasonRepository = $container->get(ReasonRepository::class);
list($RESOLVE_REASONS, $FIX_VARIATIONS) = $reasonRepository->findByProject($site);
foreach ($container->get(BugRepository::class)->findAllWithoutFeedback() as $bug)
{
list($mailto, $mailfrom, $bcc, $params) = get_package_mail($bug['package_name'], false, $bug['bug_type']);
// No feedback message
if (isset($FIX_VARIATIONS) && isset($FIX_VARIATIONS['nofeedback'][$bug['package_name']])) {
$message = $FIX_VARIATIONS['nofeedback'][$bug['package_name']];
} elseif (isset($RESOLVE_REASONS['nofeedback'])) {
$message = $RESOLVE_REASONS['nofeedback']['message'];
} else {
die('[no-feedback] Could not find resolve reason! (this should not happen!)');
}
bugs_add_comment($bug['id'], $mailfrom, '', $message, 'comment');
// Update status
$dbh->prepare('
UPDATE bugdb
SET status = "No Feedback", ts2 = NOW()
WHERE id = ?
')->execute([
$bug['id'],
]);
// Send emails
mail_bug_updates($bug, $in, $mailfrom, $message);
}