Skip to content
This repository was archived by the owner on Sep 23, 2022. It is now read-only.

Commit fb923cd

Browse files
committed
CS
1 parent fdab45a commit fb923cd

File tree

7 files changed

+592
-592
lines changed

7 files changed

+592
-592
lines changed

LICENSE

Lines changed: 201 additions & 201 deletions
Large diffs are not rendered by default.

build.xml

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,66 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project name="Project helper" basedir="." default="help">
3-
<!-- Load environment specific configuration default is build.properties -->
4-
<if>
5-
<available file="config/build.${build.env}.properties" property="" />
6-
<then>
7-
<property file="config/build.${build.env}.properties" override="true" />
8-
</then>
9-
<else>
10-
<if>
11-
<available file="config/build.properties" property="" />
12-
<then>
13-
<property file="config/build.properties"/>
14-
</then>
15-
<else>
16-
<fail message="Property file does not defined! Please create build.properties from config/samples/SAMPLE.build.properties" />
17-
</else>
18-
</if>
19-
</else>
20-
</if>
3+
<!-- Load environment specific configuration default is build.properties -->
4+
<if>
5+
<available file="config/build.${build.env}.properties" property="" />
6+
<then>
7+
<property file="config/build.${build.env}.properties" override="true" />
8+
</then>
9+
<else>
10+
<if>
11+
<available file="config/build.properties" property="" />
12+
<then>
13+
<property file="config/build.properties"/>
14+
</then>
15+
<else>
16+
<fail message="Property file does not defined! Please create build.properties from config/samples/SAMPLE.build.properties" />
17+
</else>
18+
</if>
19+
</else>
20+
</if>
2121

22-
<import file="./config/phing/helper.xml" />
23-
<import file="./config/phing/database.xml" />
24-
<import file="./config/phing/wordpress.xml" />
22+
<import file="./config/phing/helper.xml" />
23+
<import file="./config/phing/database.xml" />
24+
<import file="./config/phing/wordpress.xml" />
2525

2626
<!--################################################################################-->
27-
<target name="help" description="Print help for current phing command">
28-
<echo msg="This tool use externals builders for specific actions:" />
29-
<echo msg=" - config/phing/database.xml" />
30-
<echo msg=" - config/phing/helper.xml" />
31-
<echo msg=" - config/phing/wordpress.xml" />
32-
<echo msg="Feel free to use db:help, wp:help, helper:help for more details on each one." />
33-
<echo msg="" />
34-
<echo msg="These shortcuts are available:" />
35-
<echo msg=' - help -> Print tool command description' />
36-
<echo msg=' - env:init -> Initialize current environment by preparing configurations and dependencies' />
37-
<echo msg=' - env:restore -> Restore backuped date in the current environement' />
38-
<echo msg=' - env:backup -> Backup current data' />
39-
<echo msg=' - env:wp:install -> Initialize WordPress database from the defined configuration' />
40-
</target>
27+
<target name="help" description="Print help for current phing command">
28+
<echo msg="This tool use externals builders for specific actions:" />
29+
<echo msg=" - config/phing/database.xml" />
30+
<echo msg=" - config/phing/helper.xml" />
31+
<echo msg=" - config/phing/wordpress.xml" />
32+
<echo msg="Feel free to use db:help, wp:help, helper:help for more details on each one." />
33+
<echo msg="" />
34+
<echo msg="These shortcuts are available:" />
35+
<echo msg=' - help -> Print tool command description' />
36+
<echo msg=' - env:init -> Initialize current environment by preparing configurations and dependencies' />
37+
<echo msg=' - env:restore -> Restore backuped date in the current environement' />
38+
<echo msg=' - env:backup -> Backup current data' />
39+
<echo msg=' - env:wp:install -> Initialize WordPress database from the defined configuration' />
40+
</target>
4141
<!--################################################################################-->
42-
<target name="env:init" description="Initialize current environment by preparing configurations and dependencies">
43-
<exec command="git submodule update --force" logoutput="true" />
44-
<phingcall target="wp:init" />
45-
</target>
42+
<target name="env:init" description="Initialize current environment by preparing configurations and dependencies">
43+
<exec command="git submodule update --force" logoutput="true" />
44+
<phingcall target="wp:init" />
45+
</target>
4646
<!--################################################################################-->
47-
<target name="env:install" description="Install current environment">
48-
<phingcall target="env:init" />
49-
<phingcall target="wp:install" />
50-
</target>
47+
<target name="env:install" description="Install current environment">
48+
<phingcall target="env:init" />
49+
<phingcall target="wp:install" />
50+
</target>
5151
<!--################################################################################-->
52-
<target name="env:wp:update" description="Update local wordpress version instance to the most recent one">
53-
<exec command="cd public/wp-cms &amp;&amp; git fetch --tags &amp;&amp; git checkout `git tag | tail -1`" logoutput="true" />
54-
</target>
52+
<target name="env:wp:update" description="Update local wordpress version instance to the most recent one">
53+
<exec command="cd public/wp-cms &amp;&amp; git fetch --tags &amp;&amp; git checkout `git tag | tail -1`" logoutput="true" />
54+
</target>
5555
<!--################################################################################-->
56-
<target name="env:restore" description="Restore backuped date in the current environement">
57-
<phingcall target="db:restore" />
58-
<phingcall target="wp:uploads:restore" />
59-
</target>
56+
<target name="env:restore" description="Restore backuped date in the current environement">
57+
<phingcall target="db:restore" />
58+
<phingcall target="wp:uploads:restore" />
59+
</target>
6060
<!--################################################################################-->
61-
<target name="env:backup" description="Restore backuped date in the current environement">
62-
<phingcall target="db:backup" />
63-
<phingcall target="wp:uploads:backup" />
64-
</target>
61+
<target name="env:backup" description="Restore backuped date in the current environement">
62+
<phingcall target="db:backup" />
63+
<phingcall target="wp:uploads:backup" />
64+
</target>
6565
<!--################################################################################-->
66-
</project>
66+
</project>

config/phing/database.xml

Lines changed: 87 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,96 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project name="DataBase project builder" basedir="." default="help">
3-
<!-- Load environment specific configuration default is build.properties -->
4-
<target name="db:check-configuration">
5-
<if>
6-
<available file="config/db.${build.env}.properties" property="" />
7-
<then>
8-
<property file="config/db.${build.env}.properties" override="false" />
9-
</then>
10-
<else>
11-
<if>
12-
<available file="config/db.properties" property="" />
13-
<then>
14-
<property file="config/db.properties" override="false" />
15-
</then>
16-
<else>
17-
<fail message="Property file does not defined! Please create db.properties!" />
18-
</else>
19-
</if>
20-
</else>
21-
</if>
22-
</target>
3+
<!-- Load environment specific configuration default is build.properties -->
4+
<target name="db:check-configuration">
5+
<if>
6+
<available file="config/db.${build.env}.properties" property="" />
7+
<then>
8+
<property file="config/db.${build.env}.properties" override="false" />
9+
</then>
10+
<else>
11+
<if>
12+
<available file="config/db.properties" property="" />
13+
<then>
14+
<property file="config/db.properties" override="false" />
15+
</then>
16+
<else>
17+
<fail message="Property file does not defined! Please create db.properties!" />
18+
</else>
19+
</if>
20+
</else>
21+
</if>
22+
</target>
2323

24-
<if>
25-
<os family="unix"/>
26-
<then>
27-
<php expression="str_replace(array('(', ')'), array('\(', '\)'), '${db.pass}');" returnProperty="db.pass.cmd" />
28-
</then>
29-
<else>
30-
<property name="db.pass.cmd" value="${db.pass}" />
31-
</else>
32-
</if>
24+
<if>
25+
<os family="unix"/>
26+
<then>
27+
<php expression="str_replace(array('(', ')'), array('\(', '\)'), '${db.pass}');" returnProperty="db.pass.cmd" />
28+
</then>
29+
<else>
30+
<property name="db.pass.cmd" value="${db.pass}" />
31+
</else>
32+
</if>
3333

3434
<!--################################################################################-->
35-
<target name="db:help" depends="db:check-configuration" description="Print help for current phing command">
36-
<echo msg="Specific database commands:" />
37-
<echo msg=' - db:help -> Print current help' />
38-
<echo msg=' - db:backup -> Backup current database to a .sql file' />
39-
<echo msg=' - db:restore -> Restore currently backuped database' />
40-
<echo msg=' - db:execute -> Execute a query inside the current database' />
41-
<echo msg=' - db:details -> Show current configuration' />
42-
</target>
35+
<target name="db:help" depends="db:check-configuration" description="Print help for current phing command">
36+
<echo msg="Specific database commands:" />
37+
<echo msg=' - db:help -> Print current help' />
38+
<echo msg=' - db:backup -> Backup current database to a .sql file' />
39+
<echo msg=' - db:restore -> Restore currently backuped database' />
40+
<echo msg=' - db:execute -> Execute a query inside the current database' />
41+
<echo msg=' - db:details -> Show current configuration' />
42+
</target>
4343
<!--################################################################################-->
44-
<target name="db:details" depends="db:check-configuration" description="Show current configuration">
45-
<echo msg="These are current db variables:" />
46-
<echo msg='Credentials:' />
47-
<echo msg='- db.user -> ${db.user}' />
48-
<echo msg='- db.pass -> ${db.pass}' />
49-
<echo msg='- db.name -> ${db.name}' />
50-
<echo msg='- db.host -> ${db.host}' />
51-
<echo msg='' />
52-
<echo msg='Configuration:' />
53-
<echo msg='- db.charset -> ${db.charset}' />
54-
<echo msg='- db.prefix -> ${db.prefix}' />
55-
<echo msg='- db.collate -> ${db.collate}' />
56-
<echo msg='' />
57-
<echo msg='Programs path:' />
58-
<echo msg='- db.program.mysql -> ${db.program.mysql}' />
59-
<echo msg='- db.program.mysqldump -> ${db.program.mysqldump}' />
60-
<echo msg='' />
61-
<echo msg='Backup and restore file:' />
62-
<echo msg='- db.path.backupfolder -> ${db.path.backupfolder}' />
63-
<echo msg='- db.path.backupfile -> ${db.path.backupfile}' />
64-
</target>
44+
<target name="db:details" depends="db:check-configuration" description="Show current configuration">
45+
<echo msg="These are current db variables:" />
46+
<echo msg='Credentials:' />
47+
<echo msg='- db.user -> ${db.user}' />
48+
<echo msg='- db.pass -> ${db.pass}' />
49+
<echo msg='- db.name -> ${db.name}' />
50+
<echo msg='- db.host -> ${db.host}' />
51+
<echo msg='' />
52+
<echo msg='Configuration:' />
53+
<echo msg='- db.charset -> ${db.charset}' />
54+
<echo msg='- db.prefix -> ${db.prefix}' />
55+
<echo msg='- db.collate -> ${db.collate}' />
56+
<echo msg='' />
57+
<echo msg='Programs path:' />
58+
<echo msg='- db.program.mysql -> ${db.program.mysql}' />
59+
<echo msg='- db.program.mysqldump -> ${db.program.mysqldump}' />
60+
<echo msg='' />
61+
<echo msg='Backup and restore file:' />
62+
<echo msg='- db.path.backupfolder -> ${db.path.backupfolder}' />
63+
<echo msg='- db.path.backupfile -> ${db.path.backupfile}' />
64+
</target>
6565
<!--################################################################################-->
66-
<target name="db:backup" depends="db:check-configuration" description="Backup the current database inside a content archive">
67-
<!-- If dump folder does not exists, add it -->
68-
<if>
69-
<not>
70-
<available file="${db.path.backupfolder}" type="dir" property="" />
71-
</not>
72-
<then>
73-
<fail message="Database backup folder does not exists : ${db.path.backupfolder}" />
74-
</then>
75-
</if>
76-
<!-- Dump Current DB -->
77-
<exec command="${db.program.mysqldump} --delayed-insert --skip-extended-insert --host=${db.host} --user=${db.user} --password=${db.pass.cmd} ${db.name} --result-file=${db.path.backupfolder}/${db.path.backupfile}" />
78-
</target>
66+
<target name="db:backup" depends="db:check-configuration" description="Backup the current database inside a content archive">
67+
<!-- If dump folder does not exists, add it -->
68+
<if>
69+
<not>
70+
<available file="${db.path.backupfolder}" type="dir" property="" />
71+
</not>
72+
<then>
73+
<fail message="Database backup folder does not exists : ${db.path.backupfolder}" />
74+
</then>
75+
</if>
76+
<!-- Dump Current DB -->
77+
<exec command="${db.program.mysqldump} --delayed-insert --skip-extended-insert --host=${db.host} --user=${db.user} --password=${db.pass.cmd} ${db.name} --result-file=${db.path.backupfolder}/${db.path.backupfile}" />
78+
</target>
7979
<!--################################################################################-->
80-
<target name="db:restore" depends="db:check-configuration,helper:secure-by-input" description="Restore backuped database">
81-
<exec command='${db.program.mysql} --user=${db.user} --password=${db.pass.cmd} --host=${db.host} --skip-column-names --silent --execute="SHOW TABLES LIKE \"${db.prefix}\";" ${db.name} | while read table; do ${db.program.mysql} --user=${db.user} --password=${db.pass.cmd} --host=${db.host} --execute="DROP TABLE $table;" ${db.name}; done' logoutput="true" />
82-
<exec command="${db.program.mysql} --user=${db.user} --password=${db.pass.cmd} --host=${db.host} ${db.name} &lt; ${db.path.backupfolder}/${db.path.backupfile}" logoutput="true" />
83-
</target>
80+
<target name="db:restore" depends="db:check-configuration,helper:secure-by-input" description="Restore backuped database">
81+
<exec command='${db.program.mysql} --user=${db.user} --password=${db.pass.cmd} --host=${db.host} --skip-column-names --silent --execute="SHOW TABLES LIKE \"${db.prefix}\";" ${db.name} | while read table; do ${db.program.mysql} --user=${db.user} --password=${db.pass.cmd} --host=${db.host} --execute="DROP TABLE $table;" ${db.name}; done' logoutput="true" />
82+
<exec command="${db.program.mysql} --user=${db.user} --password=${db.pass.cmd} --host=${db.host} ${db.name} &lt; ${db.path.backupfolder}/${db.path.backupfile}" logoutput="true" />
83+
</target>
8484
<!--################################################################################-->
85-
<target name="db:execute" depends="db:check-configuration" description="Execute a query in the current database">
86-
<if>
87-
<isset property="query" />
88-
<then>
89-
<exec command='${db.program.mysql} --user=${db.user} --password=${db.pass.cmd} --host=${db.host} --execute="${query};" ${db.name}' logoutput="true" />
90-
</then>
91-
<else>
92-
<echo message="You need to call this target with query parameter set" />
93-
</else>
94-
</if>
95-
</target>
96-
</project>
85+
<target name="db:execute" depends="db:check-configuration" description="Execute a query in the current database">
86+
<if>
87+
<isset property="query" />
88+
<then>
89+
<exec command='${db.program.mysql} --user=${db.user} --password=${db.pass.cmd} --host=${db.host} --execute="${query};" ${db.name}' logoutput="true" />
90+
</then>
91+
<else>
92+
<echo message="You need to call this target with query parameter set" />
93+
</else>
94+
</if>
95+
</target>
96+
</project>

0 commit comments

Comments
 (0)