2 InstallDir
=$
(dirname $0)
3 FarmDir
=${InstallDir}/..
/
5 # Nom du wiki en paramètre ou en read
7 echo "Nom du nouveau champs wiki (doit pouvoir être un nom de dossier) :"
13 FieldDir
=${FarmDir}${NomDuWiki}
15 # Vérification de l'existance du champs
16 if [ -d
$FieldDir ]; then
17 echo "Ce champs existe déjà."
21 # Récupération de l'url
22 echo "Url du wiki (http://$NomDuWiki.polytechnique.org/):"
24 if [ -z
"$FieldUrl" ]; then
25 FieldUrl
=http
://$NomDuWiki.polytechnique.org
/
28 if [ "$FieldUrl" = "ok" ]; then
29 echo "url invalide ok"
32 if [ $
(echo $FieldUrl |
sed -e
"s,^http://[^/]*/.*$,ok,") != "ok" ]; then
36 # suppression du / final dans l'url
37 FieldUrl
=$
(echo $FieldUrl |
sed -e
"s,/$,,")
38 FieldUrlFolder
=$
(echo $FieldUrl |
sed -e
"s,^http://[^/]*\(/.*\)$,\\1/,")
42 echo "Création du champs wiki $NomDuWiki"
43 echo " dossier : $FieldDir"
44 echo " url : $FieldUrl"
45 echo " url relatif : $FieldUrlFolder"
48 cp -Ra
${InstallDir}/NomDuWiki
$FieldDir
50 # application des dossiers et url spécifiques au champs
51 sed -e
"s,^RewriteBase .*$,RewriteBase $FieldUrlFolder," ${InstallDir}/NomDuWiki
/.htaccess
> $FieldDir/.htaccess
52 sed -e
"s,^.*ScriptUrl.*$, \$ScriptUrl = '$FieldUrl';," ${InstallDir}/NomDuWiki
/local/config.php
> ${FieldDir}/local/config.php
54 #création des dossiers et fichiers attribués à l'utilisateur www-data
55 #wget --quiet ${FieldUrl}/Site/Admin?createconf=1 -O /dev/null
56 #wget --quiet ${FieldUrl}/Site/Admin?createconf=1 -O /dev/null