forked from Fabrik/fabrik
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_updateserver_xml.xml
203 lines (178 loc) · 7.93 KB
/
build_updateserver_xml.xml
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
<?xml version="1.0" encoding="UTF-8"?>
<project name="fabrik_updateserver" default="build_updateserver_xml">
<!--
builds the individual plugin xml files which contain the update information.
ftps up xml and plugin zips to server
-->
<target name="updater.testfiles">
<dirset id="dist.contents" dir="${basedir}/plugins/fabrik_${folder}/" includes="*"/>
<property name="prop.dist.contents" refid="dist.contents"/>
<foreach list="${prop.dist.contents}" delimiter=";" param="plugin" target="updater.makefile" inheritall="true" inheritrefs="true"/>
</target>
<target name="updater.makefile">
<echo message=" updater.makefile ${update_source}plg_${folder}_${plugin}.xml" />
<if>
<available file="${update_source}plg_${folder}_${plugin}.xml"/>
<then>
<!-- found -->
<xmltask source="${update_source}plg_${folder}_${plugin}.xml" dest="${update_source}plg_${folder}_${plugin}.xml">
<remove path="/updates/update[version='${version}']" />
</xmltask>
<xmltask source="${update_source}plg_${folder}_${plugin}.xml" dest="${update_source}plg_${folder}_${plugin}.xml">
<insert path="/updates">
<![CDATA[ <update>
<name>${update.product_name} ${folder}: ${plugin}</name>
<description>${update.product_name} ${folder}: ${plugin}</description>
<element>plg_${folder}_${plugin}</element>
<type>plugin</type>
<folder>${update.product_code}_${folder}</folder>
<version>${version}</version>
<downloads>
<downloadurl type="full" format="zip">${update.download_folder}/plg_${update.product_code}_${folder}_${plugin}_${version}.zip</downloadurl>
</downloads>
<maintainer>${update.maintainer}</maintainer>
<maintainerurl>${update.url}</maintainerurl>
<targetplatform name="${update.target_platform}" version="${update.target_platform_version.dotted}" />
</update>
]]>
</insert>
</xmltask>
</then>
<else>
<!-- not found create a new extension update xml file -->
<xmltask dest="${update_source}plg_${folder}_${plugin}.xml">
<insert path="/" >
<![CDATA[<updates>
<update>
<name>${update.product_name} ${folder}: ${plugin}</name>
<description>Fabrik ${folder}: ${plugin}</description>
<element>plg_${folder}_${plugin}</element>
<type>plugin</type>
<folder>${update.product_code}_${folder}</folder>
<version>${version}</version>
<downloads>
<downloadurl type="full" format="zip">${update.download_folder}/plg_${update.product_code}_${folder}_${plugin}_${version}.zip</downloadurl>
</downloads>
<maintainer>${update.maintainer}</maintainer>
<maintainerurl>${update.url}</maintainerurl>
<targetplatform name="${update.target_platform}" version="${update.target_platform_version.dotted}" />
</update>
</updates>
]]>
</insert>
</xmltask>
</else>
</if>
</target>
<target name="updater.ftp">
<input message="Export XML to fabrik.com update server. This will allow users to see updates in the Joomla admin?" addproperty="updater.do" validargs="y,n" defaultvalue="n" />
<if>
<equals arg1="${updater.do}" arg2="y" />
<then>
<!-- upload the modified extension updater files -->
<ftp passive ="yes" server="${ftp.server}" userid="${ftp.user}" password="${ftp.password}" verbose="yes" remotedir="${ftp.updatedir}" retriesAllowed="3" depends="false" skipFailedTransfers="true">
<fileset dir="${update_dir}">
<include name="**/*.xml" />
</fileset>
</ftp>
<echo>uploaded update server xml files to ${ftp.updatedir}</echo>
</then>
</if>
<input message="FTP extension zips to download folder ${ftp.downloaddir}?" addproperty="updater.ftp.zips" validargs="y,n" defaultvalue="y" />
<if>
<equals arg1="${updater.ftp.zips}" arg2="y" />
<then>
<antcall target="updater.downloaddb.add" />
<!-- upload the plugin zips -->
<ftp passive ="yes" server="${ftp.server}" userid="${ftp.user}" password="${ftp.password}" verbose="yes" remotedir="${ftp.downloaddir}" retriesAllowed="3" depends="false" skipFailedTransfers="true">
<fileset dir="${cfg.destdir}/pkg_fabrik_sink/packages/">
<include name="**/*.zip" />
</fileset>
</ftp>
<echo>uploaded zip files to ${ftp.downloaddir}</echo>
</then>
</if>
<input message="FTP Update server XML files and SQL updates to ${sql.downloads_table}?" addproperty="updater.ftp" validargs="y,n" defaultvalue="y" />
<if>
<equals arg1="${updater.ftp}" arg2="y" />
<then>
<antcall target="updater.downloaddb.add" />
<!-- upload the plugin zips -->
<ftp passive ="yes" server="${ftp.server}" userid="${ftp.user}" password="${ftp.password}" verbose="yes" remotedir="${ftp.downloaddir}" retriesAllowed="3" depends="false" skipFailedTransfers="true">
<fileset dir="${cfg.destdir}/pkg_fabrik_sink/packages/">
<include name="**/*.zip" />
</fileset>
</ftp>
<echo>uploaded zip files to ${ftp.downloaddir}</echo>
</then>
</if>
</target>
<target name="updater.downloaddb.add">
<for list="${plugin.folders}" param="plugin.type">
<sequential>
<dirname property="plugins.@{plugin.type}" file="@{plugin.type}"/>
<echo>@{plugin.type}</echo>
<echo>${plugins.@{plugin.type}}</echo>
<for list="${plugins.@{plugin.type}}" param="plugin.name">
<sequential>
<var name="filename" value="plg_fabrik_@{plugin.type}_@{plugin.name}_${version}.zip" />
<!-- GET THE PLUGIN DESCRIPTION -->
<echo>
SELECT IFNULL(
(SELECT CONCAT('current.plugin.description=',`description`) from ${sql.downloads_table} WHERE
`download` LIKE "%plg_fabrik_@{plugin.type}_@{plugin.name}%"
AND description != ''
AND `joomla_version` = "${update.target_platform_version}"
ORDER BY create_date DESC LIMIT 1),
'current.plugin.description=-')
</echo>
<sql
driver="${sql.driver}"
url="${sql.url}"
userid="${sql.user}"
password="${sql.password}"
expandProperties="true"
output="temp.properties"
showheaders="false" showtrailers="false"
print="yes" >
<transaction>
<![CDATA[
SELECT IFNULL(
(SELECT CONCAT('current.plugin.description=',`description`) from ${sql.downloads_table} WHERE
`download` LIKE "%plg_fabrik_@{plugin.type}_@{plugin.name}%"
AND description != '' AND description != ''
AND `joomla_version` = "${update.target_platform_version}"
ORDER BY create_date DESC LIMIT 1),
'current.plugin.description=-')
]]>
</transaction>
</sql>
<var file="temp.properties" />
<delete file="temp.properties" />
<echo message="description: ${current.plugin.description}" />
<sql
driver="${sql.driver}"
url="${sql.url}"
userid="${sql.user}"
password="${sql.password}"
expandProperties="true"
print="yes" >
<transaction><![CDATA[
INSERT INTO ${sql.downloads_table} (`title`, `type`, `download`, `version`, `published`, `create_date`, `digg`, `acl`, `joomla_version`, `like`, `description`, `author`, `hits`, `slug`)
VALUES ("@{plugin.type} - @{plugin.name} plug-in", "@{plugin.type}", "/media/downloads/${filename}", "${version}", "1", NOW(), "0", "19", "${update.target_platform_version}", "0", "${current.plugin.description}", "62", "0", "")
ON DUPLICATE KEY UPDATE `description` = "${current.plugin.description}", download = "/media/downloads/${filename}", version = "${version}"
]]>
</transaction>
<transaction>
<![CDATA[
UPDATE ${sql.downloads_table} SET `published` = "1" WHERE
download = "/media/downloads/${filename}" AND version != "${version}" AND `joomla_version` = "${update.target_platform_version}"
]]>
</transaction>
</sql>
</sequential>
</for>
</sequential>
</for>
</target>
</project>