Sophie

Sophie

distrib > Mageia > 3 > i586 > media > core-release-src > by-pkgid > 16689e6072cc20431bd14dd8b98d1621 > files > 4

mediawiki-1.20.5-1.mga3.src.rpm

#! /bin/sh

path="$(echo $1 | sed -e 's|/$||')"
update="$2"

if dirname "$1" | grep '^[^/]' > /dev/null || test ! -d `dirname "$1"`; then
  cat >&2 <<EOF
$0: invalid parameter
Usage: $0 PATH
  PATH is the path of the instance's wiki root
  The parent directories must exist.
EOF
exit 1
fi

# test if the path is already an instance
if [[ "$(cat @sysconfdir@/mediawiki/instances | grep ^$path$)" = ""  || "$update" = "update" ]] ; then

if ! test -e "$path"; then
  mkdir "$path"
fi

if ! test -e "$path"/LocalSettings.php; then
  ln -s "@datadir@"/mediawiki/mw-config "$path"/mw-config
fi

if ! test -e "$path"/images; then
  mkdir "$path"/images
  chown apache:apache "$path"/images
fi
if ! test -e "$path"/extensions; then
  mkdir "$path"/extensions
  chown apache:apache "$path"/extensions
fi
if ! test -e "$path"/skins; then
  mkdir "$path"/skins
  chown apache:apache "$path"/skins
fi
if ! test -e "$path"/images; then
  mkdir "$path"/images
  chown apache:apache "$path"/images
fi

filelist="StartProfiler.sample api.php api.php5 bin cache img_auth.php img_auth.php5 includes index.php index.php5"
filelist=$filelist" languages load.php load.php5 maintenance opensearch_desc.php opensearch_desc.php5 profileinfo.php"
filelist=$filelist" redirect.php redirect.php5 redirect.phtml resources serialized thumb.php thumb.php5 thumb_handler.php"
filelist=$filelist" thumb_handler.php5 wiki.phtml"
mkdir -p $path/{extensions,skins}
for f in $filelist; do
  rm -rf "$path"/$f
  ln -s "@datadir@"/mediawiki/$f "$path"/$f
done

extensionlist="ConfirmEdit Gadgets Nuke ParserFunctions Renameuser Vector WikiEditor"
skinlist="Chick.deps.php Chick.php CologneBlue.php Modern.deps.php Modern.php MonoBook.deps.php MonoBook.php"
skinlist=$skinlist" MySkin.deps.php MySkin.php Nostalgia.php Simple.deps.php Simple.php Standard.php"
skinlist=$skinlist" Vector.deps.php Vector.php chick cologneblue common modern monobook myskin nostalgia simple vector"
for e in $extensionlist; do
    rm -rf "$path"/extensions/"$e"
    ln -s "@datadir@"/mediawiki/extensions/$e "$path"/extensions/"$e"
done
for s in $skinlist; do
    rm -rf "$path"/skins/"$s"
    ln -s "@datadir@"/mediawiki/skins/"$s" "$path"/skins/"$s"
done

if [[ $update != "update" ]]; then
    # register the new instance
    echo "$path" >> @sysconfdir@/mediawiki/instances
fi

else
cat >&2 <<EOF
The chosen path $path does already exist as a mediawiki instance
EOF
exit 1
fi