1 |
cf6a035a
|
Julien Enselme
|
#!/bin/bash
|
2 |
|
|
|
3 |
|
|
for dir in $(find /users/guest/assos/htmltest/sites -maxdepth 1 -mindepth 1 -type d ! -name all | sort) ; do
|
4 |
|
|
|
5 |
|
|
## Get database name
|
6 |
|
|
site=${dir##*/}
|
7 |
|
|
db=${site##*.}
|
8 |
|
|
if [ $db = 'default' ] ; then
|
9 |
|
|
db='default_assos'
|
10 |
|
|
fi
|
11 |
|
|
|
12 |
|
|
## Look in the variable table
|
13 |
|
|
mysql --defaults-extra-file=~/private/myassos.cnf -N -e "SELECT value FROM $db.variable WHERE CONVERT(value USING utf8) LIKE '%htmltest%'" > ~/tmp/out
|
14 |
|
|
|
15 |
|
|
## If results
|
16 |
|
|
if [ $(cat ~/tmp/out | wc -l) -ne 0 ] ; then
|
17 |
|
|
sed 's/htmltest/drupal7/g' < ~/tmp/out > ~/tmp/in
|
18 |
|
|
|
19 |
|
|
i=$((0))
|
20 |
|
|
while read line ; do
|
21 |
|
|
out[$i]=$line
|
22 |
|
|
i=$((i+1))
|
23 |
|
|
done < ~/tmp/out
|
24 |
|
|
|
25 |
|
|
i=$((0))
|
26 |
|
|
while read line ; do
|
27 |
|
|
in[$i]=$line
|
28 |
|
|
i=$((i+1))
|
29 |
|
|
done < ~/tmp/in
|
30 |
|
|
|
31 |
|
|
for i in $(seq 0 $((${#out[*]}-1))) ; do
|
32 |
|
|
mysql --defaults-extra-file=~/private/myassos.cnf -e "UPDATE $db.variable SET value=${in[$i]} WHERE value = ${out[$i]}"
|
33 |
|
|
done
|
34 |
|
|
|
35 |
|
|
rm ~/tmp/out ~/tmp/in
|
36 |
|
|
fi
|
37 |
|
|
read key
|
38 |
|
|
done |