[aur-dev] [PATCH] FS#34843: Send AUR notifications directly to user to make it more visible

Anatol Pomozov anatol.pomozov at gmail.com
Sat Apr 20 13:58:01 EDT 2013


Hi

On Sat, Apr 20, 2013 at 10:50 AM, Anatol Pomozov
<anatol.pomozov at gmail.com> wrote:
> Signed-off-by: Anatol Pomozov <anatol.pomozov at gmail.com>
> ---
>  web/lib/pkgfuncs.inc.php | 24 +++++++++++++-----------
>  1 file changed, 13 insertions(+), 11 deletions(-)
>
> diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php
> index 53b7e54..ee150ca 100644
> --- a/web/lib/pkgfuncs.inc.php
> +++ b/web/lib/pkgfuncs.inc.php
> @@ -260,11 +260,11 @@ function add_package_comment($pkgid, $uid, $comment) {
>         $q.= "AND CommentNotify.UserID != " . $uid . " ";
>         $q.= "AND CommentNotify.PkgID = " . intval($pkgid);
>         $result = $dbh->query($q);
> -       $bcc = array();
> +       $recipients = array();
>
>         if ($result) {
>                 while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
> -                       array_push($bcc, $row['Email']);
> +                       array_push($recipients, $row['Email']);
>                 }
>
>                 $q = "SELECT Packages.* ";
> @@ -282,9 +282,10 @@ function add_package_comment($pkgid, $uid, $comment) {
>                 . $comment
>                 . "\n\n---\nIf you no longer wish to receive notifications about this package, please go the the above package page and click the UnNotify button.";
>                 $body = wordwrap($body, 70);
> -               $bcc = implode(', ', $bcc);
> -               $headers = "Bcc: $bcc\nReply-to: nobody at archlinux.org\nFrom: aur-notify at archlinux.org\nX-Mailer: AUR\n";
> -               @mail('undisclosed-recipients: ;', "AUR Comment for " . $row['Name'], $body, $headers);
> +               $headers = "Reply-to: nobody at archlinux.org\nFrom: aur-notify at archlinux.org\nX-Mailer: AUR\n";
> +               foreach ($recipients as $to) {
> +                       @mail($to, "AUR Comment for " . $row['Name'], $body, $headers);
> +               }
>         }
>  }
>
> @@ -873,12 +874,12 @@ function pkg_delete ($atype, $ids, $mergepkgid) {
>                 $q.= "AND CommentNotify.UserID != " . uid_from_sid($_COOKIE['AURSID']) . " ";
>                 $q.= "AND CommentNotify.PkgID = " . $pkgid;
>                 $result = $dbh->query($q);
> -               $bcc = array();
> +               $recipients = array();
>
>                 while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
> -                       array_push($bcc, $row['Email']);
> +                       array_push($recipients, $row['Email']);
>                 }
> -               if (!empty($bcc)) {
> +               if (!empty($recipients)) {
>                         $pkgname = pkgname_from_id($pkgid);
>
>                         # TODO: native language emails for users, based on their prefs
> @@ -893,9 +894,10 @@ function pkg_delete ($atype, $ids, $mergepkgid) {
>                                 $body .= "You will no longer receive notifications about this package.";
>                         }
>                         $body = wordwrap($body, 70);
> -                       $bcc = implode(', ', $bcc);
> -                       $headers = "Bcc: $bcc\nReply-to: nobody at archlinux.org\nFrom: aur-notify at archlinux.org\nX-Mailer: AUR\n";
> -                       @mail('undisclosed-recipients: ;', "AUR Package deleted: " . $pkgname, $body, $headers);
> +                       $headers = "Reply-to: nobody at archlinux.org\nFrom: aur-notify at archlinux.org\nX-Mailer: AUR\n";
> +                       foreach ($recipients as $to) {
> +                               @mail($to, "AUR Package deleted: " . $pkgname, $body, $headers);
> +                       }
>                 }
>         }

Before I am going to do more testing I would like to clarify what do
you think about this change in general. Does the idea look fine for
you?

Also I think that for mass mailing some background send mechanism
should be used. I am not an expert in php but it seems Mail_Queue is
recommended in this case. What do you think?


More information about the aur-dev mailing list