MediaWiki Howto (1)

From RaySoft

This howto is based on the following documentation:

NOTE:
The following steps Installation, Upgrade and Update can be automated by the deploy-mediawiki.sh script.

Installation

Set some variables:

url_wikimedia='https://gerrit.wikimedia.org/r/mediawiki'
url_gitlab='https://github.com'
branch='REL1_39'
path='<HTDOCS>'

Install Composer:

[[ -d "${HOME}/bin" ]] || mkdir "${HOME}/bin"

curl --output "${HOME}/bin/composer-setup.php" \
     'https://getcomposer.org/installer'

php "${HOME}/bin/composer-setup.php" \
    --install-dir="${HOME}/bin" --filename='composer'

rm "${HOME}/bin/composer-setup.php"

Get MediaWiki core from a defined branch and its PHP libraries dependencies:

cd "${path}"

git clone --branch="${branch}" "${url_wikimedia}/core.git" 'w'

path+='/w'

cd "${path}"

[[ -d 'tests' ]] && rm -r 'tests'

composer update --no-dev

Get a skin from a defined branch:

cd "${path}/skins"

git clone --branch="${branch}" "${url_wikimedia}/skins/Vector.git"

Get some extensions from a defined branch and all their PHP libraries dependencies:

cd "${path}/extensions"

# From WikiMedia
for ext in 'Cite' 'OATHAuth' 'ParserFunctions' 'ReplaceText' \
           'SyntaxHighlight_GeSHi'
do
  echo "-- ${ext} --"

  git clone --branch="${branch}" "${url_wikimedia}/extensions/${ext}.git"

  cd "${ext}"

  composer update --no-dev

  cd '..'

  echo
done

# From GitLab
for ext in 'Universal-Omega/DynamicPageList3'
do
  echo "-- ${ext} --"

  git clone --branch="${branch}" "${url_gitlab}/${ext}.git"

  cd "${ext##*/}"

  composer update --no-dev

  cd '..'

  echo
done

Upgrade

Set some variables:

branch='REL1_39'
path='<HTDOCS>/w'

Update Composer itself:

composer self-update --stable --clean-backups

Get MediaWiki core from a defined branch and its PHP libraries dependencies:

cd "${path}"

git pull
git checkout "${branch}"

[[ -d 'tests' ]] && rm -r 'tests'

composer update --no-dev

Get a skin from a defined branch:

cd "${path}/skins/Vector"

git pull
git checkout "${branch}"

Get some extensions from a defined branch and all their PHP libraries dependencies:

cd "${path}/extensions"

for ext in 'Cite' 'DynamicPageList3' 'OATHAuth' 'ParserFunctions' 'ReplaceText' \
           'SyntaxHighlight_GeSHi'
do
  echo "-- ${ext} --"

  cd "${ext}"

  git pull
  git checkout "${branch}"

  composer update --no-dev

  cd '..'

  echo
done

Run the update script:

cd "${path}"

php 'maintenance/update.php' --quick

Update

Set some variables:

path='<HTDOCS>/w'

Update Composer itself:

composer self-update --stable --clean-backups

Update core files and its PHP libraries dependencies:

cd "${path}"

git pull

composer update --no-dev

Update skin files:

cd "${path}/skins/Vector"

git pull

Update extension files and all their PHP libraries dependencies:

cd "${path}/extensions"

for ext in 'Cite' 'DynamicPageList3' 'OATHAuth' 'ParserFunctions' 'ReplaceText' \
           'SyntaxHighlight_GeSHi'
do
  echo "-- ${ext} --"

  cd "${ext}"

  git pull

  composer update --no-dev

  cd '..'

  echo
done

Run the update script:

cd "${path}"

php 'maintenance/update.php' --quick

Configuration

MySQL

mysql --user='root' --password --batch <<EOS
  CREATE DATABASE raysoft;

  GRANT index, create, select, insert, update, delete, drop, alter,
        lock tables 
  ON raysoft.* TO 'raysoft'@'localhost' IDENTIFIED BY '**********';

  GRANT select, lock tables 
  ON raysoft.* TO 'backup'@'localhost' IDENTIFIED BY '**********';
   
  FLUSH PRIVILEGES;
EOS

MediaWiki

Run the configuration script:

Edit the configuration file:

Maintenance

mkdir '<HTDOCS>/w/sitemap'
crontab -e
0  1  *  *  *  /usr/bin/php <HTDOCS>/w/maintenance/runJobs.php >/dev/null
10 1  *  *  *  /usr/bin/php <HTDOCS>/w/maintenance/generateSitemap.php \
                            --fspath <HTDOCS>/w/sitemap --server https://www.raysoft.ch \
                            --urlpath http://www.raysoft.ch/sitemap >/dev/null
0  2  1  *  *  /usr/bin/php <HTDOCS>/w/maintenance/purgeOldText.php
10 2  1  *  *  /usr/bin/php <HTDOCS>/w/maintenance/storage/compressOld.php -t concat
20 2  1  *  *  /usr/bin/php <HTDOCS>/w/maintenance/refreshLinks.php