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
|
#!/bin/bash
PROJECT_ROOT=$(dirname $0)
# echoes commands as they're executed
set -x
# exits on error
set -e
# Tries to infer the web user from a running Apache instance
WEB_USER=$(ps axho user,comm|grep -E "httpd|apache"|uniq|awk 'END {print $1}')
WEB_GROUP=$WEB_USER
# This will drop your database, your data, and recreate everything anew
# This file should only be used for development of Sahana Agasti, as you
# can see the models, forms and filters are specific to Agasti (prefix ag)
# Tries to prompt for sudo password early on
# so as not to interrupt the process later
sudo -u $WEB_USER echo
# reverses exit-on-error behavior, since some errors might be expected
set +e
# removes all old models, forms, and filters
rm -rf $PROJECT_ROOT/lib/model/doctrine/ag*
rm -rf $PROJECT_ROOT/lib/model/doctrine/base/Baseag*
rm -rf $PROJECT_ROOT/lib/form/doctrine/ag*
rm -rf $PROJECT_ROOT/lib/form/doctrine/base/Baseag*
rm -rf $PROJECT_ROOT/lib/filter/doctrine/base/Baseag*
rm -rf $PROJECT_ROOT/lib/filter/doctrine/ag*
# clears the cache
$PROJECT_ROOT/symfony cc
# removes search index files to avoid pollution from previous installs
sudo rm -rf $PROJECT_ROOT/data/search/*
# resets file and directory perms (NOTE: chmod does NOT recurse in this case)
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/web/wiki/conf/ $PROJECT_ROOT/web/wiki/data/
chmod -c g+wr $PROJECT_ROOT/config/ $PROJECT_ROOT/apps/*/config/ $PROJECT_ROOT/data/search/ $PROJECT_ROOT/data/sql/ $PROJECT_ROOT/web/wiki/conf/ $PROJECT_ROOT/web/wiki/data/
#considered harmful?:
#sudo $PROJECT_ROOT/symfony project:permissions
# reindexes wiki pages
sudo -u $WEB_GROUP $PROJECT_ROOT/web/wiki/bin/indexer.php -c
# generates new models, forms, and filters from the yml files
$PROJECT_ROOT/symfony doctrine:clean --no-confirmation
$PROJECT_ROOT/symfony doctrine:build-model
$PROJECT_ROOT/symfony doctrine:drop-db --no-confirmation
$PROJECT_ROOT/symfony doctrine:create-db
sudo -u $WEB_USER $PROJECT_ROOT/symfony doctrine:build-sql
$PROJECT_ROOT/symfony doctrine:insert-sql
$PROJECT_ROOT/symfony doctrine:build-forms
$PROJECT_ROOT/symfony doctrine:build-filters
# loads sample data and fixtures from the yml files in the data directory
sudo -u $WEB_USER $PROJECT_ROOT/symfony doctrine:data-load
#indexes the data loaded so it is searchable to the user
sudo -u $WEB_USER $PROJECT_ROOT/symfony lucene:reindex --application="frontend" --connection="doctrine" agScenario agStaff agFacility agScenarioFacilityGroup
|