/[drupal]/contributions/modules/DAST/site-configure.xml
ViewVC logotype

Contents of /contributions/modules/DAST/site-configure.xml

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (show annotations) (download) (as text)
Mon Mar 17 10:58:49 2008 UTC (20 months, 1 week ago) by allisterbeharry
Branch: MAIN
CVS Tags: DRUPAL-5--2-1, HEAD
Branch point for: DRUPAL-5--2
Changes since 1.3: +70 -3 lines
File MIME type: text/xml
Committed for 5.x-2.1 release.
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- <![CDATA[
3 $Id: site-configure.xml,v 1.10 2008/03/08 13:13:37 allisterbeharry Exp $
4 ]]> -->
5
6 <!-- ==================================================================================================== -->
7 <!-- @file This is the base site-configure task in DAST. It writes any required directives for hosting -->
8 <!-- the Drupal site to web, database and PHP/application server config files and creates the database. -->
9 <!-- It will also scan for and report if the required directives are set within the recommended limits -->
10 <!-- @author Allister Beharry -->
11 <!-- @package org.drupal.dast.tasks -->
12 <!-- ==================================================================================================== -->
13
14 <project name="site-configure" default="main">
15 <taskdef name="CreoleSQLExec" classname="phing.tasks.ext.CreoleSQLExecTask"/>
16 <taskdef name="CVS" classname="phing.tasks.system.CVSTask"/>
17 <taskdef name="warn" classname="phing.tasks.system.WarnTask"/>
18 <taskdef name="DumpProperties" classname="DumpPropertiesTask" />
19 <taskdef name="ApacheHttpdConf" classname="ApacheHttpdConfTask" />
20 <typedef name="ApacheHttpdConfSection" classname="ApacheHttpdConfSection" />
21 <typedef name="ApacheHttpdConfDirective" classname="ApacheHttpdConfDirective" />
22
23 <!-- =================================
24 target: create-database
25 ================================= -->
26 <target name="create-database" depends="configure-create-database" description="--> Creates the database for the Drupal site">
27 <!--Copy script file template to tmp directory replacing tokens with property values -->
28 <copy todir="${dast.tmp}" overwrite="true">
29 <filterchain>
30 <expandproperties />
31 </filterchain>
32 <fileset dir="${dast.ext}">
33 <include name="${drupal.database.CreateScript}" />
34 </fileset>
35 </copy>
36
37 <!--Recreate drupal db and user -->
38 <echo>Running ${drupal.database.CreateScript} on ${drupal.database.CreateUrl}...</echo>
39 <CreoleSQLExec Url="${drupal.database.CreateUrl}" Print="true" Showheaders="false" Src="${dast.tmp}${php.directory_separator}${drupal.database.CreateScript}"/>
40
41 <!--Check if drupal database url is now valid-->
42 <echo>Checking connection to ${drupal.database.Url}...</echo>
43 <CreoleSQLExec Url="${drupal.database.Url}" Print="true" Showheaders="false">
44 SELECT "${drupal.database.Url} is now available." as MSG;
45 </CreoleSQLExec>
46
47 <!--Keep db script file if testing -->
48 <if><not><equals arg1="${build.testing}" arg2="yes" /></not><then>
49 <delete file="${dast.tmp}${php.directory_separator}${drupal.database.CreateScript}" />
50 </then></if>
51 </target>
52
53 <!--Create the files subdirectory and set permission-->
54 <!-- =================================
55 target: create-files-dir
56 ================================= -->
57 <target name="create-files-dir" depends="configure-create-files-dir" description="--> Create the Drupal files directory ">
58 <mkdir dir="${drupal.filesDirPath}"/>
59 <echo> Created directory ${drupal.filesDirPath}.</echo>
60 <!--
61 <php function = "chmod" returnProperty="chmodfilesDirResult" >
62 <param value = "${drupal.filesDirPath}" />
63 <param value = "${drupal.filesDirPermision}" />
64 </php>
65 <if><equals arg1="${build.testing}" arg2="yes" /><then>
66 <echo>PHP chmod returned: ${chmodfilesDirResult}</echo></then>
67 </if>
68 <if><equals arg1="${chmodfilesDirResult}" arg2="1"/><then>
69 <echo>chmoded ${drupal.filesDirPath} to ${drupal.filesDirPermission}.</echo></then>
70 <else>
71 <warn>Could not chmod ${drupal.filesDirPath} to ${drupal.filesDirPermission}. You will have to change permissions on this directory manually.</warn>
72 </else>
73 </if>
74 -->
75 <!--
76 <if><or><equals arg1="${host.fstype}" arg2="UNIX" /><equals arg1="${build.usechmod}" arg2="yes" /></or><then>
77 <exec command="chmod ${drupal.filesDirPermission} &quot;${drupal.filesDirPath}&quot;"
78 Output="${build.log.defaultdir}${php.directory_separator}site-configure-create-filesdir-output.log" Error="${build.log.defaultdir}${php.directory_separator}site-configure-create-filesdir.log"
79 dir="${dast.tmp}" escape="false" passthru="false" checkreturn="true"/>
80 <echo>chmoded ${drupal.filesDirPath} to ${drupal.filesDirPermission}.</echo>
81 </then>
82 <else>
83 <warn>Changing permissions on the files directory only works under UNIX-type filesystems; you will have to change permissions on ${drupal.filesDirPath} manually</warn>
84 </else>
85 </if>
86 -->
87 <!--Make files dir writeable-->
88 <if><not><equals arg1="${host.fstype}" arg2="UNIX" /></not><then>
89 <warn>Chmoding permissions on the ${drupal.filesDirPath} directory only works under UNIX-type filesystems; you will have to change permissions on ${drupal.dir} manually if necessary.</warn>
90 </then>
91 <else>
92 <Chmod Mode="0777">
93 <fileset dir="${drupal.filesDirPath}/">
94 <include name="**" />
95 </fileset>
96 </Chmod>
97 </else>
98 </if>
99 </target>
100
101 <!-- =================================
102 target: create-apachehttpd-site
103 ================================= -->
104 <target name="create-apachehttpd-site" depends="configure-create-apachehttpd-site"
105 description="--> This task will create a new Apache httpd site; modify the files and directives written here to suit your httpd setup ">
106
107 <!--Add the port for the our site vhost to ports.conf -->
108 <ApacheHttpdConf File="${apachehttpd.ports.conf}">
109 <ApacheHttpdConfDirective DirectiveName="Listen" DirectiveContent="${apachehttpd.site.port}" DirectiveOverwrite="no"/>
110 </ApacheHttpdConf>
111
112 <!--Make sure the vhost configs in sites-enabled dirs and ports.config is being pulled in in apache2.conf -->
113 <ApacheHttpdConf File="${apachehttpd.apache2.conf}">
114 <ApacheHttpdConfDirective DirectiveName="Include" DirectiveContent="${apachehttpd.ports.conf}" DirectiveOverwrite="yes" />
115 <ApacheHttpdConfDirective DirectiveName="Include" DirectiveContent="${apachehttpd.sites-enabled.dir}" DirectiveOverwrite="yes" />
116
117 </ApacheHttpdConf>
118
119 <!--Create the vhost in a conf file at "${apachehttpd.site.vhost.conf} -->
120 <ApacheHttpdConf File="${apachehttpd.site.vhost.conf}">
121 <ApacheHttpdConfSection SectionType="VirtualHost" SectionName="*:${apachehttpd.site.port}">
122 <ApacheHttpdConfDirective DirectiveName="ServerAdmin" DirectiveContent="${apachehttpd.site.vhost.ServerAdmin}" />
123 <ApacheHttpdConfDirective DirectiveName="DocumentRoot" DirectiveContent="${apachehttpd.site.vhost.DocumentRoot}" />
124 <ApacheHttpdConfDirective DirectiveName="ServerName" DirectiveContent="${apachehttpd.site.vhost.ServerName}" />
125 <ApacheHttpdConfDirective DirectiveName="ErrorLog" DirectiveContent="${apachehttpd.site.vhost.ErrorLog}" />
126 <ApacheHttpdConfDirective DirectiveName="CustomLog" DirectiveContent="${apachehttpd.site.vhost.CustomLog}" />
127
128 <!--Set our vhost / directory settings -->
129 <ApacheHttpdConfSection SectionType="Directory" SectionName = "">
130 <ApacheHttpdConfDirective DirectiveName="Options" DirectiveContent="FollowSymLink MultiViews" />
131 <ApacheHttpdConfDirective DirectiveName="AllowOverride" DirectiveContent="None" />
132 </ApacheHttpdConfSection>
133
134 <!--Then our DocumentRoot directory settings -->
135 <ApacheHttpdConfSection SectionType="Directory" SectionName="${apachehttpd.site.vhost.DocumentRoot}">
136 <ApacheHttpdConfDirective DirectiveName="Options" DirectiveContent="Options Indexes FollowSymLink MultiViews" />
137 <ApacheHttpdConfDirective DirectiveName="AllowOverride" DirectiveContent="None" />
138 <ApacheHttpdConfDirective DirectiveName="Order" DirectiveContent="allow,deny" />
139 <ApacheHttpdConfDirective DirectiveName="Allow" DirectiveContent="from all" />
140 </ApacheHttpdConfSection>
141
142 </ApacheHttpdConfSection>
143 </ApacheHttpdConf>
144
145 <!--Set our vdir directory properties -->
146 <ApacheHttpdConf File="${apachehttpd.site.vhost.conf}">
147
148 </ApacheHttpdConf>
149
150 </target>
151
152 <!-- =================================
153 target: main
154 ================================= -->
155 <target name="main" depends="configure" description="--> description">
156
157 </target>
158
159 <!-- =================================
160 target: configure
161 ================================= -->
162 <target name="configure" description="--> Configures the build with global properties from properties file.">
163 <if><isset property="basePropertiesFile"/><then>
164 <available file="${project.basedir}${php.directory_separator}${basePropertiesFile}" property="basePropertiesFileExists"/>
165 <if><not><isset property="basePropertiesFileExists"/></not><then>
166 <fail>Could not find the specified base properties file ${project.basedir}${php.directory_separator}${basePropertiesFile}. Stopping.</fail>
167 </then>
168 <else>
169 <property name="build.basePropertiesFile" value="${project.basedir}${php.directory_separator}${basePropertiesFile}" />
170 <echo>Using ${build.basePropertiesFile} as base properties file.</echo>
171 </else>
172 </if>
173 </then>
174
175 <else> <!--Use default base properties file -->
176 <available file="${project.basedir}${php.directory_separator}drupalorg_testing-site-base.properties" property="basePropertiesFileExists"/>
177 <if><not><isset property="basePropertiesFileExists"/></not><then>
178 <warn>Could not find the default base properties file ${project.basedir}${php.directory_separator}drupalorg_testing-site-base.properties. Only the user properties file can be used.</warn>
179 </then>
180 <else>
181 <property name="build.basePropertiesFile" value="${project.basedir}${php.directory_separator}drupalorg_testing-site-base.properties" />
182 <echo>Using default base properties file ${build.basePropertiesFile}.</echo>
183 </else>
184 </if>
185 </else>
186 </if>
187
188 <if><isset property="propertiesFile"/><then>
189 <!--Use user properties from specified file -->
190 <available file="${project.basedir}${php.directory_separator}${propertiesFile}" property="propertiesFileExists"/>
191 <if><not><isset property="propertiesFileExists"/></not><then>
192 <fail>Could not find the specified user properties file ${project.basedir}${php.directory_separator}${propertiesFile}. Stopping.</fail>
193 </then>
194 <else>
195 <property name="build.propertiesFile" value="${project.basedir}${php.directory_separator}${propertiesFile}" />
196 <echo>Using ${build.propertiesFile} as user properties file.</echo>
197 </else>
198 </if>
199 </then>
200
201 <else> <!--Use default user properties file -->
202 <available file="${project.basedir}${php.directory_separator}drupalorg_testing-site.properties" property="propertiesFileExists"/>
203 <if><not><isset property="propertiesFileExists"/></not><then>
204 <warn>Could not find the default user properties file ${project.basedir}${php.directory_separator}drupalorg_testing-site.properties. Only the base properties file will be used.</warn>
205 </then>
206 <else>
207 <property name="build.propertiesFile" value="${project.basedir}${php.directory_separator}drupalorg_testing-site.properties" />
208 <echo>Using ${build.propertiesFile} as default user properties file.</echo>
209 </else>
210 </if>
211 </else>
212 </if>
213
214
215 <if><and><not><isset property="build.basePropertiesFile" /></not><not><isset property="build.propertiesFile" /></not></and><then>
216 <fail>Cannot use either the user or base properties files. Stopping </fail>
217 </then>
218 </if>
219
220 <if><isset property="build.basePropertiesFile" /><then>
221 <property file="${build.basePropertiesFile}" override="true"/>
222 </then>
223 <else><echo>No base properties file used.</echo></else>
224 </if>
225
226 <if><isset property="build.propertiesFile" /><then>
227 <if><equals arg1="${build.propertiesFile}" arg2="${dast.home}${php.directory_separator}drupalorg_testing-site.properties" /><then>
228 <if><and><isset property="build.basePropertiesFile" /><not><equals arg1="${build.basePropertiesFile}" arg2="${dast.home}${php.directory_separator}drupalorg_testing-site-base.properties" /></not></and><then>
229 <echo>The base properties file ${build.basePropertiesFile} is not the default so the default user properties file will not be loaded.</echo>
230 </then>
231 <else>
232 <property file="${build.propertiesFile}" override="true"/>
233 <echo>Using default user properties file ${dast.home}${php.directory_separator}drupalorg_testing-site.properties.</echo>
234 </else>
235 </if>
236 </then>
237 <else><property file="${build.propertiesFile}" override="true"/></else>
238 </if>
239 </then>
240 <else><echo>No user properties file used.</echo></else>
241 </if>
242
243 <if><not><isset property="build.log.defaultdir"/></not><then>
244 <fail>build.log.defaultdir property not set, check the ${propertiesFile} file for omissions or bad syntax</fail>
245 </then>
246 </if>
247 <available file="${build.log.defaultdir}" property="build.log.defaultdirExists"/>
248 <if><not><isset property="build.log.defaultdirExists"/></not><then>
249 <echo>${build.log.defaultdir} doesn't exist, attempting to create...</echo>
250 <mkdir dir="${build.log.defaultdir}"/>
251 </then>
252 </if>
253
254 <if>
255 <not><isset property="drupal.dir"/></not>
256 <then>
257 <fail>drupal.dir property not set, check the properties files for omissions or bad syntax</fail>
258 </then>
259 </if>
260
261 <if>
262 <not><isset property="drupal.Url"/></not>
263 <then>
264 <fail>drupal.Url property not set, check the properties files for omissions or bad syntax</fail>
265 </then>
266 </if>
267
268
269
270 </target>
271
272 <!-- =================================
273 target: configure-create-files-dir
274 ================================= -->
275 <target name="configure-create-files-dir" depends="configure" description="--> Configures the create-files-dir task with properties from a properties file.">
276 <if><not><isset property="drupal.filesDirPath"/></not><then>
277 <fail>drupal.filesDirPath property not set, check the properties files for omissions or bad syntax</fail>
278 </then>
279 </if>
280 <if><not><isset property="drupal.filesDirPath"/></not><then>
281 <fail>drupal.filesDirPath property not set, check the properties files for omissions or bad syntax</fail>
282 </then>
283 </if>
284 <if><not><isset property="drupal.filesDirPermission"/></not><then>
285 <fail>drupal.filesDirPath property not set, check the properties files for omissions or bad syntax</fail>
286 </then>
287 </if>
288 </target>
289
290
291 <!-- =================================
292 target: configure-create-database
293 ================================= -->
294 <target name="configure-create-database" depends="configure" description="--> Configures the create-database target with properties from properties file.">
295 <if>
296 <not><isset property="drupal.database.driver"/></not>
297 <then>
298 <fail>drupal.database.driver property not set, check the properties files for omissions or bad syntax</fail>
299 </then>
300 </if>
301
302 <if>
303 <not><isset property="drupal.database.host"/></not>
304 <then>
305 <fail>drupal.database.host property not set, check the properties files for omissions or bad syntax</fail>
306 </then>
307 </if>
308
309 <if>
310 <not><isset property="drupal.database.name"/></not>
311 <then>
312 <fail>drupal.database.name property not set, check the properties files for omissions or bad syntax</fail>
313 </then>
314 </if>
315
316 <if>
317 <not><isset property="drupal.database.user"/></not>
318 <then>
319 <fail>drupal.database.user property not set, check the properties files for omissions or bad syntax</fail>
320 </then>
321 </if>
322
323 <if>
324 <not><isset property="drupal.database.user.host"/></not>
325 <then>
326 <fail>drupal.database.user.host property not set, check the properties files for omissions or bad syntax</fail>
327 </then>
328 </if>
329
330 <if>
331 <not><isset property="drupal.database.user.pass"/></not>
332 <then>
333 <fail>drupal.database.user.pass property not set, check the properties files for omissions or bad syntax</fail>
334 </then>
335 </if>
336
337 <if>
338 <not><isset property="drupal.database.CreateScript"/></not>
339 <then>
340 <fail>drupal.database.CreateScript property not set, check the properties files for omissions or bad syntax</fail>
341 </then>
342 </if>
343
344 <if>
345 <not><isset property="drupal.database.CreateScript.user"/></not>
346 <then>
347 <fail>drupal.database.CreateScript.user property not set, check the properties files for omissions or bad syntax</fail>
348 </then>
349 </if>
350
351 <if>
352 <not><isset property="drupal.database.CreateScript.user.pass"/></not>
353 <then>
354 <fail>drupal.database.CreateScript.user.pass property not set, check the properties files for omissions or bad syntax</fail>
355 </then>
356 </if>
357
358 <if>
359 <not><isset property="drupal.database.CreateScript.name"/></not>
360 <then>
361 <fail>drupal.database.CreateScript.name not set, check the properties files for omissions or bad syntax</fail>
362 </then>
363 </if>
364
365 <property name="drupal.database.Url" value="${drupal.database.driver}://${drupal.database.user}:${drupal.database.user.pass}@${drupal.database.host}/${drupal.database.name}" />
366 <property name="drupal.database.CreateUrl" value="${drupal.database.driver}://${drupal.database.CreateScript.user}:${drupal.database.CreateScript.user.pass}@${drupal.database.host}/${drupal.database.CreateScript.name}" />
367
368 </target>
369
370 <!-- =================================
371 target: configure-create-apachehttpd-site
372 ================================= -->
373 <target name="configure-create-apachehttpd-site" depends="configure" description="--> Configures the create-apache-httpd-site target with properties from properties file.">
374
375 <if>
376 <not><isset property="apachehttpd.apache2.conf"/></not>
377 <then>
378 <fail>apachehttpd.apache2.conf property not set, check the properties files for omissions or bad syntax</fail>
379 </then>
380 </if>
381
382 <if>
383 <not><isset property="apachehttpd.httpd.conf"/></not>
384 <then>
385 <fail>apachehttpd.httpd.conf property not set, check the properties files for omissions or bad syntax</fail>
386 </then>
387 </if>
388
389 <if>
390 <not><isset property="apachehttpd.ports.conf"/></not>
391 <then>
392 <fail>apachehttpd.ports.conf property not set, check the properties files for omissions or bad syntax</fail>
393 </then>
394 </if>
395
396 <if>
397 <not><isset property="apachehttpd.sites-enabled.dir"/></not>
398 <then>
399 <fail>apachehttpd.sites-enabled.dir property not set, check the properties files for omissions or bad syntax</fail>
400 </then>
401 </if>
402
403 <if>
404 <not><isset property="apachehttpd.site.vhost.conf"/></not>
405 <then>
406 <fail>apachehttpd.site.vhost property not set, check the properties files for omissions or bad syntax</fail>
407 </then>
408 </if>
409
410 <if>
411 <not><isset property="apachehttpd.site.vhost"/></not>
412 <then>
413 <fail>apachehttpd.site.vhost property not set, check the properties files for omissions or bad syntax</fail>
414 </then>
415 </if>
416
417 <if>
418 <not><isset property="apachehttpd.site.vhost.ServerAdmin"/></not>
419 <then>
420 <fail>apachehttpd.site.vhost.ServerAdmin property not set, check the properties files for omissions or bad syntax</fail>
421 </then>
422 </if>
423
424 <if>
425 <not><isset property="apachehttpd.site.vhost.DocumentRoot"/></not>
426 <then>
427 <fail>apachehttpd.site.vhost.DocumentRoot property not set, check the properties files for omissions or bad syntax</fail>
428 </then>
429 </if>
430
431 <if>
432 <not><isset property="apachehttpd.site.vhost.ServerName"/></not>
433 <then>
434 <fail>apachehttpd.site.vhost.ServerName property not set, check the properties files for omissions or bad syntax</fail>
435 </then>
436 </if>
437
438 <if>
439 <not><isset property="apachehttpd.site.vhost.ErrorLog"/></not>
440 <then>
441 <fail>apachehttpd.site.vhost.ErrorLog property not set, check the properties files for omissions or bad syntax</fail>
442 </then>
443 </if>
444
445 <if>
446 <not><isset property="apachehttpd.site.vhost.CustomLog"/></not>
447 <then>
448 <fail>apachehttpd.site.vhost.CustomLog property not set, check the properties files for omissions or bad syntax</fail>
449 </then>
450 </if>
451
452 </target>
453
454 <target name="dump-config" depends="configure"><DumpProperties/></target>
455
456 </project>

  ViewVC Help
Powered by ViewVC 1.1.2