forked from lolli42/TYPO3-Travis-Integration
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-helper.sh
executable file
·93 lines (83 loc) · 1.62 KB
/
install-helper.sh
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
#!/bin/bash
export phpConfigFile=`php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`
function addOptionToPhpConfig() {
if grep -q "$1" $phpConfigFile
then
echo "Option $1 already added"
else
echo "$1" >> $phpConfigFile
fi
}
function addModuleToPhpConfig() {
if grep -q "$1.so" $phpConfigFile
then
echo "Module $1 already added"
else
addOptionToPhpConfig "extension=$1.so"
fi
}
function installPhpModule() {
case "$1" in
-y)
printf "no\n" | pecl install $2 > /dev/null
shift
;;
redis)
installRedis > /dev/null
;;
*)
pecl install $1 > /dev/null
;;
esac
addModuleToPhpConfig $1
if [[ "$1" == "apc" ]]
then
addOptionToPhpConfig "apc.enable_cli=1"
addOptionToPhpConfig "apc.slam_defense=0"
fi
}
function installRedis() {
_pwd=$PWD
mkdir build-environment/phpredis-build
cd build-environment/phpredis-build
git clone --depth 1 git://github.com/nicolasff/phpredis.git
cd phpredis
phpize
./configure
make
sudo make install
cd $_pwd
}
function phpLint {
if [ $@ = "All" ]; then
for file in `find . -name *.php`
do
echo -en "\r\033[KChecking: $file"
if ! php -l $file > /dev/null
then
echo -en "\r\033[K"
echo -e "\e[00;31mSyntax errors detected in file: $file\e[00m"
ERR=1
[ -z "$1" ] && break
fi
done
else
for file in `find $@ -name '*.php'`
do
echo -en "\r\033[KChecking: $file "
if ! php -l $file > /dev/null
then
echo -en "\r\033[K"
echo -e "\e[00;31mSyntax errors detected in file: $file\e[00m"
ERR=1
[ -z "$1" ] && break
fi
done
fi
echo -e "\r\033[K"
if [ -n "$ERR" ]
then
return 99
fi
return 0
}