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
|
<?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:sqliterate name="users" recordname="user" datasource="postgres">
<sql>
select ut.userid, ut.useremail from
(select e.ebuildid, u.userid, u.useremail
from files f, ebuilds e, user_packages up, users u
where e.packageid = up.packageid
and f.fileid = e.ebuildid
and u.userid = up.userid
and f.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:sendmail to="^useremail" server="smtp.random.lan:25" subject="Gentoo Browse - New package versions"
present="newpackageversions" from="noreply@gentoobrowse.randomdan.homeip.net" />
<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 files f, ebuilds e, user_packages up, users u
where e.packageid = up.packageid
and f.fileid = e.ebuildid
and u.userid = up.userid
and u.userid = ?
and f.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 bind="0" value="^userid" />
</parameters>
</project2:sqltask>
</project2:sqliterate>
</emailebuild>
|