summaryrefslogtreecommitdiff
path: root/bin/reevotech/PullPages.sh
blob: 29071c24e361c05c76ac3f9686a188e3e0bb1ad6 (plain)
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
#!/bin/bash
# Use: ./bin/reevotech/PullPages.sh ecoversities Help

if [ $# -eq 0 ]
  then
    echo "Missing parameters. Use: ./bin/reevotech/PullPages.sh ecoversities Help"
    exit
fi

cd /srv/reevotech

DEPLOY=$1
DEPLOYFILE=`ls ./etc | grep $DEPLOY | grep -v '.test' | grep -v '.old'`
DOMAIN=`cat ./etc/$DEPLOYFILE  | grep 'REEVO_URL =' | cut -d'"' -f 2`


# echo $DEPLOY
# echo $DEPLOYFILE
# echo $DOMAIN

cd ./www/wiki/deployments/$DEPLOY

update_ns () {
  if [[ -d pages_tmp/$1 ]]
  then
    echo ""
    cd pages_tmp/$1
    git pull
    cd ../../
  else
    git clone -c remote.origin.namespaces="$1" mediawiki::http://$DOMAIN pages_tmp/$1
  fi

  cp -rf pages_tmp/$1 pages
  rm -rf pages/$1/.git
}

NS=$2

if [ -z "$2" ]
then
  echo "This script download the wikipages in the DB to text files..."
  echo "I am going to process all the active NameSpaces for the specified deployment:"
  ls pages
  echo ""
  echo "Enter to continue..."
  read
  for i in `ls pages`
  do
    update_ns $i
  done

else
  echo "This script download the wikipages in the DB to text files..."
  echo "I am going to process only the specificed NameSpace: $NS"
  update_ns $NS
fi