[aur-dev] [PATCH] Notify users when a package is updated.

Mario Mueller mario at xenji.com
Fri Jul 27 17:24:27 EDT 2012


Just to get a better understanding...
why do you need to select the whole fieldset from CommentNotify if you
do not use a single value of it?

SELECT u.Email FROM Users u
INNER JOIN CommentNotify cn ON u.ID=cn.UserID
AND cn.UserID != $uid
AND cn.PkgID = $packageID

does the same from my point of view and returns only one field or do I
miss something?

-- 
xenji

On 27.07.2012, at 23:11, Nicolas Cornu <nicolac76 at yahoo.fr> wrote:

> Responding to FS #30109
> ---
> web/html/pkgsubmit.php | 33 +++++++++++++++++++++++++++++++++
> 1 file changed, 33 insertions(+)
>
> diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php
> index 84688b4..f7bc430 100644
> --- a/web/html/pkgsubmit.php
> +++ b/web/html/pkgsubmit.php
> @@ -397,6 +397,39 @@ if ($uid):
>                pkg_notify(account_from_sid($_COOKIE["AURSID"], $dbh), array($packageID), true, $dbh);
>            }
>
> +            # If it was a previously created package notify users of this update.
> +            if($pdata) {
> +                $uid = uid_from_sid($uid, $dbh);
> +
> +                # Send email notifications
> +                $q = 'SELECT CommentNotify.*, Users.Email ';
> +                $q.= 'FROM CommentNotify, Users ';
> +                $q.= 'WHERE Users.ID = CommentNotify.UserID ';
> +                $q.= 'AND CommentNotify.UserID != ' . $uid . ' ';
> +                $q.= 'AND CommentNotify.PkgID = ' . intval($packageID);
> +                $result = db_query($q, $dbh);
> +                $bcc = array();
> +
> +                if (mysql_num_rows($result)) {
> +                    while ($row = mysql_fetch_assoc($result)) {
> +                        array_push($bcc, $row['Email']);
> +                    }
> +
> +                    # 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 =
> +                        'from ' . $AUR_LOCATION . '/' . get_pkg_uri($pkg_name) . "\n"
> +                        . username_from_sid($_COOKIE['AURSID'], $dbh) . " update the package to the version: "
> +                        . $pkg_version
> +                        . "\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 Update for " . $pkg_name, $body, $headers);
> +                }
> +            }
> +
>            # Entire package creation process is atomic
>            end_atomic_commit($dbh);
>
> --
> 1.7.11.3
>


More information about the aur-dev mailing list