1#!/usr/bin/env php 2<?php /* vim: set ft=phpbugdb noet ts=4 sw=4 : */ 3 4# this script closes bugs due to lack of feedback. 5 6use App\Repository\BugRepository; 7use App\Repository\ReasonRepository; 8 9require __DIR__.'/../../include/prepend.php'; 10 11# Set "input" array 12$in = ['status' => 'No Feedback']; 13 14# Update relevant reports 15$reasonRepository = $container->get(ReasonRepository::class); 16 17list($RESOLVE_REASONS, $FIX_VARIATIONS) = $reasonRepository->findByProject($site); 18 19foreach ($container->get(BugRepository::class)->findAllWithoutFeedback() as $bug) 20{ 21 list($mailto, $mailfrom, $bcc, $params) = get_package_mail($bug['package_name'], false, $bug['bug_type']); 22 23 // No feedback message 24 if (isset($FIX_VARIATIONS) && isset($FIX_VARIATIONS['nofeedback'][$bug['package_name']])) { 25 $message = $FIX_VARIATIONS['nofeedback'][$bug['package_name']]; 26 } elseif (isset($RESOLVE_REASONS['nofeedback'])) { 27 $message = $RESOLVE_REASONS['nofeedback']['message']; 28 } else { 29 die('[no-feedback] Could not find resolve reason! (this should not happen!)'); 30 } 31 bugs_add_comment($bug['id'], $mailfrom, '', $message, 'comment'); 32 33 // Update status 34 $dbh->prepare(' 35 UPDATE bugdb 36 SET status = "No Feedback", ts2 = NOW() 37 WHERE id = ? 38 ')->execute([ 39 $bug['id'], 40 ]); 41 42 // Send emails 43 mail_bug_updates($bug, $in, $mailfrom, $message); 44} 45