blob: 6854602f3f232843b59a869e8a90e291e0db4633 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
<?xml version="1.0"?>
<emailebuild name="emailebuild" xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:project2="http://project2.randomdan.homeip.net">
<xi:include href="../datasources/postgres.xml" />
<project2:sqlrows name="usersToEmail" datasource="postgres">
<sql>
select ut.userid, ut.useremail from
(select e.ebuildid, u.userid, u.useremail
from ebuilds e, user_packages up, users u
where e.packageid = up.packageid
and u.userid = up.userid
and e.firstseen > up.trackedsince) as ut left outer join user_ebuild_emails ebe
on ebe.userid = ut.userid and ebe.ebuildid = ut.ebuildid
where ebe.userid is null
group by ut.userid, ut.useremail
</sql>
</project2:sqlrows>
<project2:iterate name="users" source="usersToEmail">
<project2:sendmail server="smtp.random.lan:25" subject="Gentoo Browse - New package versions"
present="newpackageversions" from=""Gentoo Browse" <noreply@gentoobrowse.randomdan.homeip.net>">
<to source="parent" name="useremail" depth="1" />
</project2:sendmail>
<project2:sqltask datasource="postgres">
<sql>
insert into user_ebuild_emails(ebuildid, userid, sentat)
select ut.ebuildid, ut.userid, now()
from (
select e.ebuildid, up.userid
from ebuilds e, user_packages up, users u
where e.packageid = up.packageid
and u.userid = up.userid
and u.userid = ?
and e.firstseen > up.trackedsince) as ut left outer join user_ebuild_emails ebe
on ebe.userid = ut.userid and ebe.ebuildid = ut.ebuildid
where ebe.userid is null
</sql>
<parameters>
<param name="0"><value source="parent" name="userid" depth="1" /></param>
</parameters>
</project2:sqltask>
</project2:iterate>
</emailebuild>
|