1
by Usman Akeju
- initial commit; migrating to new branch internally |
1 |
#!/bin/bash
|
1.1.545
by Usman Akeju
- clean-project.sh update (removed backticks) |
2 |
PROJECT_ROOT=$(dirname $0) |
1
by Usman Akeju
- initial commit; migrating to new branch internally |
3 |
|
1.19.129
by Chad Heuschober
Updated installer and clean-project to allow switch-on / off of sample data. |
4 |
usage(){
|
5 |
echo "This script can be used by developers to effectively re-build a post-install Mayon system. It is not intended as a command-line installation/configuration option as several important steps taken by the web-based installer / configurator are missed. |
|
6 |
|
|
7 |
Example #1: Clean out the project and only load default data
|
|
8 |
user@pc:/project/root$ ./clean-project.sh |
|
9 |
|
|
10 |
Example #2: Cleans out the project and also load sample data
|
|
11 |
user@pc:/project/root$ ./clean-project.sh -s |
|
12 |
||
13 |
Parameters (Required):
|
|
14 |
-s Load sample data in addition to default data
|
|
15 |
-h Prints this help statement"
|
|
16 |
exit 1 |
|
17 |
}
|
|
18 |
||
19 |
# accept the sample-data parameter
|
|
20 |
SAMPLEDATA=false |
|
21 |
while getopts "s" option |
|
22 |
do
|
|
23 |
case "$option" in |
|
24 |
"s") |
|
25 |
SAMPLEDATA=true |
|
26 |
;;
|
|
27 |
"h") |
|
28 |
usage |
|
29 |
exit 1 |
|
30 |
;;
|
|
31 |
"?") |
|
32 |
echo "Invalid option: -$OPTARG" >&2 |
|
33 |
exit 1 |
|
34 |
;;
|
|
35 |
*)
|
|
36 |
echo "Unkown error processing options" >&2 |
|
37 |
exit 1 |
|
38 |
;;
|
|
39 |
esac
|
|
40 |
done
|
|
41 |
||
1.1.87
by Usman Akeju
- adds improvements to clean-project.sh, makes it executable again |
42 |
# echoes commands as they're executed
|
43 |
set -x
|
|
44 |
||
45 |
# exits on error
|
|
46 |
set -e
|
|
47 |
||
48 |
# Tries to infer the web user from a running Apache instance
|
|
1.1.1115
by Usman Akeju
- updates clean-project.sh apache user detection |
49 |
WEB_USER=$(ps axho user,comm|grep -E "httpd|apache"|uniq|grep -v "root"|awk 'END {print $1}') |
1.1.228
by Usman Akeju
- clean-project now resets directory perms |
50 |
WEB_GROUP=$WEB_USER |
1.1.87
by Usman Akeju
- adds improvements to clean-project.sh, makes it executable again |
51 |
|
1
by Usman Akeju
- initial commit; migrating to new branch internally |
52 |
# This will drop your database, your data, and recreate everything anew
|
53 |
# This file should only be used for development of Sahana Agasti, as you
|
|
54 |
# can see the models, forms and filters are specific to Agasti (prefix ag)
|
|
55 |
||
1.1.87
by Usman Akeju
- adds improvements to clean-project.sh, makes it executable again |
56 |
# Tries to prompt for sudo password early on
|
57 |
# so as not to interrupt the process later
|
|
58 |
sudo -u $WEB_USER echo |
|
59 |
||
60 |
# reverses exit-on-error behavior, since some errors might be expected
|
|
61 |
set +e
|
|
62 |
||
1.1.228
by Usman Akeju
- clean-project now resets directory perms |
63 |
# removes all old models, forms, and filters
|
1.5.5
by charles wisniewski
modified clean-project.sh to take into account new package structure |
64 |
rm -rf $PROJECT_ROOT/lib/model/doctrine/ag*
|
1
by Usman Akeju
- initial commit; migrating to new branch internally |
65 |
rm -rf $PROJECT_ROOT/lib/model/doctrine/base/Baseag*
|
1.5.5
by charles wisniewski
modified clean-project.sh to take into account new package structure |
66 |
rm -rf $PROJECT_ROOT/lib/form/doctrine/ag*
|
1
by Usman Akeju
- initial commit; migrating to new branch internally |
67 |
rm -rf $PROJECT_ROOT/lib/form/doctrine/base/Baseag*
|
68 |
rm -rf $PROJECT_ROOT/lib/filter/doctrine/base/Baseag*
|
|
1.5.5
by charles wisniewski
modified clean-project.sh to take into account new package structure |
69 |
rm -rf $PROJECT_ROOT/lib/filter/doctrine/ag*
|
1
by Usman Akeju
- initial commit; migrating to new branch internally |
70 |
|
1.1.228
by Usman Akeju
- clean-project now resets directory perms |
71 |
# clears the cache
|
72 |
$PROJECT_ROOT/symfony cc
|
|
73 |
||
1.1.1152
by Usman Akeju
- more work on polling, import batching, related routing |
74 |
# purges the logs
|
75 |
#$PROJECT_ROOT/symfony log:clear
|
|
76 |
# instead:
|
|
77 |
||
78 |
# rotates the logs
|
|
1.1.1187
by Usman Akeju
- fixes log rotation in clean-project.sh |
79 |
$PROJECT_ROOT/symfony log:rotate --period=1 --history=8 frontend all |
1.1.1152
by Usman Akeju
- more work on polling, import batching, related routing |
80 |
|
1.1.228
by Usman Akeju
- clean-project now resets directory perms |
81 |
# removes search index files to avoid pollution from previous installs
|
1.1.760
by Usman Akeju
- changes rm in clean-project.sh to be done as root, not WEB_USER |
82 |
sudo rm -rf $PROJECT_ROOT/data/search/*
|
1.1.190
by Nils Stolpe
Added a line to clean=project.sh to delete all old index files from data/search/lucene.index |
83 |
|
1.1.1097
by Usman Akeju
- secured upload directory |
84 |
# removes any leftover uploaded files
|
1.19.146
by Chad Heuschober
Fixed some hangovers from the additions of the downloads directory that didn't include data/downloads in cleanup / permissions setting. |
85 |
sudo rm -rf $PROJECT_ROOT/data/uploads/* $PROJECT_ROOT/data/downloads/* |
1.1.1097
by Usman Akeju
- secured upload directory |
86 |
|
1.1.1041
by Usman Akeju
- modified clean-project.sh to be more specific with perms |
87 |
# resets file and directory perms
|
1.19.146
by Chad Heuschober
Fixed some hangovers from the additions of the downloads directory that didn't include data/downloads in cleanup / permissions setting. |
88 |
sudo chgrp -R $WEB_GROUP $PROJECT_ROOT/cache/ $PROJECT_ROOT/log/ $PROJECT_ROOT/config/ $PROJECT_ROOT/apps/*/config/ $PROJECT_ROOT/data/search/ $PROJECT_ROOT/data/sql/ $PROJECT_ROOT/data/uploads/ $PROJECT_ROOT/data/downloads/ $PROJECT_ROOT/web/wiki/conf/ $PROJECT_ROOT/web/wiki/data/ $PROJECT_ROOT/web/wiki/lib/plugins/dw2pdf/mpdf/tmp/ |
89 |
sudo chmod -cR g+wr $PROJECT_ROOT/data/search/ $PROJECT_ROOT/data/uploads/ $PROJECT_ROOT/data/downloads/ $PROJECT_ROOT/web/wiki/data/ |
|
1.1.1041
by Usman Akeju
- modified clean-project.sh to be more specific with perms |
90 |
# NOTE: chmod should NOT recurse for these, for security's sake:
|
1.1.1212
by Usman Akeju
- fixes wiki export perms |
91 |
chmod -c g+wr $PROJECT_ROOT/config/ $PROJECT_ROOT/apps/*/config/ $PROJECT_ROOT/data/sql/ $PROJECT_ROOT/web/wiki/conf/ $PROJECT_ROOT/web/wiki/lib/plugins/dw2pdf/mpdf/tmp/ |
1.1.228
by Usman Akeju
- clean-project now resets directory perms |
92 |
#considered harmful?:
|
93 |
#sudo $PROJECT_ROOT/symfony project:permissions
|
|
94 |
||
95 |
# reindexes wiki pages
|
|
96 |
sudo -u $WEB_GROUP $PROJECT_ROOT/web/wiki/bin/indexer.php -c |
|
97 |
||
98 |
# generates new models, forms, and filters from the yml files
|
|
1
by Usman Akeju
- initial commit; migrating to new branch internally |
99 |
$PROJECT_ROOT/symfony doctrine:clean --no-confirmation
|
100 |
$PROJECT_ROOT/symfony doctrine:build-model
|
|
101 |
$PROJECT_ROOT/symfony doctrine:drop-db --no-confirmation
|
|
102 |
$PROJECT_ROOT/symfony doctrine:create-db
|
|
1.1.87
by Usman Akeju
- adds improvements to clean-project.sh, makes it executable again |
103 |
sudo -u $WEB_USER $PROJECT_ROOT/symfony doctrine:build-sql |
1
by Usman Akeju
- initial commit; migrating to new branch internally |
104 |
$PROJECT_ROOT/symfony doctrine:insert-sql
|
105 |
$PROJECT_ROOT/symfony doctrine:build-forms
|
|
106 |
$PROJECT_ROOT/symfony doctrine:build-filters
|
|
1.1.228
by Usman Akeju
- clean-project now resets directory perms |
107 |
|
108 |
# loads sample data and fixtures from the yml files in the data directory
|
|
1.19.129
by Chad Heuschober
Updated installer and clean-project to allow switch-on / off of sample data. |
109 |
if $SAMPLEDATA |
110 |
then
|
|
111 |
sudo -u $WEB_USER $PROJECT_ROOT/symfony doctrine:data-load data/fixtures data/samples |
|
112 |
else
|
|
113 |
sudo -u $WEB_USER $PROJECT_ROOT/symfony doctrine:data-load data/fixtures |
|
114 |
fi
|
|
115 |
||
1.1.228
by Usman Akeju
- clean-project now resets directory perms |
116 |
|
1.1.664
by charles wisniewski
facility deletion is now possible if that facility is not in an event or scenario |
117 |
#indexes the data loaded so it is searchable to the user
|
1.22.7
by Shirley Chan
Making organization lucene searchable |
118 |
sudo -u $WEB_USER $PROJECT_ROOT/symfony lucene:reindex --application="frontend" --connection="doctrine" agScenario agStaff agFacility agScenarioFacilityGroup agOrganization |
1.1.1041
by Usman Akeju
- modified clean-project.sh to be more specific with perms |
119 |