-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathphpbb.sh
executable file
·21 lines (17 loc) · 959 Bytes
/
phpbb.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
# Locate phpBB viewforum.php
for file in `locate viewforum.php | grep -v "language"`
do
# Get phpBB config file path
config=`echo $file | sed -e "s/viewforum\.php/config.php/g"`
# Get connection details
host=`cat $config | grep "\\$dbhost" | awk -F " = '" '{print $2}' | sed -e "s/';//g"`
dbname=`cat $config | grep "\\$dbname" | awk -F " = '" '{print $2}' | sed -e "s/';//g"`
dbuser=`cat $config | grep "\\$dbuser" | awk -F " = '" '{print $2}' | sed -e "s/';//g"`
dbpass=`cat $config | grep "\\$dbpasswd" | awk -F " = '" '{print $2}' | sed -e "s/';//g"`
dbprefix=`cat $config | grep "\\$table_prefix" | awk -F " = '" '{print $2}' | sed -e "s/';//g"`
# Get version number
InstalledVersion=`mysql -u $dbuser -D $dbname -p$dbpass -h $host --skip-column-names -e "select config_value from ${dbprefix}config config where config_name='version';" | grep '[\d\.]*'`
# Output
echo "$InstalledVersion $config" | sed -e "s/config.php//g"
done