mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
send emails when delteing packages
Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
parent
c7a9c2f3d3
commit
54d5dcc6e8
1 changed files with 38 additions and 0 deletions
|
@ -709,6 +709,44 @@ function pkg_delete ($atype, $ids, $mergepkgid, $dbh=NULL) {
|
||||||
$dbh = db_connect();
|
$dbh = db_connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($mergepkgid) {
|
||||||
|
$mergepkgname = pkgname_from_id($mergepkgid, $dbh);
|
||||||
|
}
|
||||||
|
|
||||||
|
# Send email notifications
|
||||||
|
foreach ($ids as $pkgid) {
|
||||||
|
$q = 'SELECT CommentNotify.*, Users.Email ';
|
||||||
|
$q.= 'FROM CommentNotify, Users ';
|
||||||
|
$q.= 'WHERE Users.ID = CommentNotify.UserID ';
|
||||||
|
$q.= 'AND CommentNotify.UserID != ' . uid_from_sid($_COOKIE['AURSID']) . ' ';
|
||||||
|
$q.= 'AND CommentNotify.PkgID = ' . $pkgid;
|
||||||
|
$result = db_query($q, $dbh);
|
||||||
|
$bcc = array();
|
||||||
|
|
||||||
|
while ($row = mysql_fetch_assoc($result)) {
|
||||||
|
array_push($bcc, $row['Email']);
|
||||||
|
}
|
||||||
|
if (!empty($bcc)) {
|
||||||
|
$pkgname = pkgname_from_id($pkgid);
|
||||||
|
|
||||||
|
# TODO: native language emails for users, based on their prefs
|
||||||
|
# Simply making these strings translatable won't work, users would be
|
||||||
|
# getting emails in the language that the user who posted the comment was in
|
||||||
|
$body = "";
|
||||||
|
if ($mergepkgid) {
|
||||||
|
$body .= username_from_sid($_COOKIE['AURSID']) . " merged \"".$pkgname."\" into \"$mergepkgname\".\n\n";
|
||||||
|
$body .= "You will no longer receive notifications about this package, please go to https://aur.archlinux.org/packages.php?ID=".$mergepkgid." and click the Notify button if you wish to recieve them again.";
|
||||||
|
} else {
|
||||||
|
$body .= username_from_sid($_COOKIE['AURSID']) . " deleted \"".$pkgname."\".\n\n";
|
||||||
|
$body .= "You will no longer receive notifications about this package.";
|
||||||
|
}
|
||||||
|
$body = wordwrap($body, 70);
|
||||||
|
$bcc = implode(', ', $bcc);
|
||||||
|
$headers = "Bcc: $bcc\nReply-to: nobody@archlinux.org\nFrom: aur-notify@archlinux.org\nX-Mailer: AUR\n";
|
||||||
|
@mail(' ', "AUR Package deleted: " . $pkgname, $body, $headers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($mergepkgid) {
|
if ($mergepkgid) {
|
||||||
/* Merge comments */
|
/* Merge comments */
|
||||||
$q = "UPDATE PackageComments ";
|
$q = "UPDATE PackageComments ";
|
||||||
|
|
Loading…
Add table
Reference in a new issue