mirror of
https://github.com/php/web-bugs.git
synced 2026-03-24 07:42:08 +01:00
64 lines
1.9 KiB
PHP
Executable File
64 lines
1.9 KiB
PHP
Executable File
#!/usr/bin/env php
|
|
<?php /* vim: set ft=phpbugdb noet ts=4 sw=4 : */
|
|
|
|
use App\Repository\BugRepository;
|
|
|
|
require __DIR__ . '/../../include/prepend.php';
|
|
|
|
/*
|
|
Many times bugs are assigned to humans but not given the 'Assigned' status. Our bug tracker
|
|
is a little odd that way.
|
|
'No Feedback' was once a part of this, but no longer: https://news.php.net/php.webmaster/8828
|
|
*/
|
|
foreach ($container->get(BugRepository::class)->findAllAssigned() as $assigned => $binfos) {
|
|
|
|
$mbody = format_email_body($binfos);
|
|
$email_user = $assigned . '@php.net';
|
|
|
|
mail($email_user, 'Assigned PHP bugs reminder', $mbody, 'From: php-bugs@lists.php.net', '-fphp-bugs@lists.php.net');
|
|
}
|
|
|
|
function format_email_body($binfos) {
|
|
|
|
$links = '';
|
|
$count = count($binfos);
|
|
$earliest_changed = time();
|
|
$earliest_opened = time();
|
|
|
|
foreach ($binfos as $binfo) {
|
|
|
|
if ($earliest_changed > $binfo['ts_changed']) {
|
|
$earliest_changed = $binfo['ts_changed'];
|
|
}
|
|
if ($earliest_opened > $binfo['ts_opened']) {
|
|
$earliest_opened = $binfo['ts_opened'];
|
|
}
|
|
|
|
$link_title = strlen($binfo['sdesc']) < 65 ? $binfo['sdesc'] : substr($binfo['sdesc'], 0, 65) . '...';
|
|
|
|
$links .= " Title: $link_title\r\n";
|
|
$links .= " Type: {$binfo['bug_type']} with Status: {$binfo['status']}\r\n";
|
|
$links .= " Link: https://bugs.php.net/{$binfo['id']}\r\n\r\n";
|
|
}
|
|
|
|
$assigned = $binfo['assign'];
|
|
$salute = ($count === 1) ? 'one bug report' : "$count bug reports";
|
|
$date_c = date('M d, Y', $earliest_changed);
|
|
$date_o = date('M d, Y', $earliest_opened);
|
|
|
|
$body = <<<MAIL_BODY
|
|
Hello $assigned,
|
|
|
|
This is a gentle reminder about the $salute assigned to you.
|
|
|
|
Dates:
|
|
Earliest opened date: $date_o
|
|
Earliest last change date: $date_c
|
|
|
|
Your assigned bug information:
|
|
$links
|
|
MAIL_BODY;
|
|
|
|
return $body;
|
|
}
|