Difference between revisions of "Mediawiki installation/Version 1.23.8"

From Biowikifarm Metawiki
Jump to: navigation, search
m (Installation Issues: Semantic MediaWiki)
Line 703: Line 703:
 
[[Category:MediaWiki]]
 
[[Category:MediaWiki]]
 
[[Category:MediaWiki Extensions]]
 
[[Category:MediaWiki Extensions]]
 +
[[Category:Semantic Mediawiki]]

Revision as of 13:32, 26 January 2015

MediaWiki version 1.23.8 is a long term support version.

Architecture

See also http://biowikifarm.net/meta/Mediawiki_installation#Cloning_a_new_wiki Approach:

  • have a Long Term Support (LTS) Version of a MediaWiki Git clone
  • install extensions for a wiki version
  • install WEB_WIKI by web interface or Database template

Schema:

 MW_WMF_CLONE                                        /usr/share/mw-wmf-clone
 ├ core (Git) ─────────git-archive-export───┐        /usr/share/mw-wmf-clone/core
 └ extensions (Git) ───git-archive-export─→ ) ─┐     /usr/share/mw-wmf-clone/extensions
                                            │  │
   WIKI_SOURCE_LTS (e.g. REL1_23)           │  │
   ┌ core-files (local git archive-export) ←┘  │     /usr/share/mediawiki23
   ├ extensions (mixed:                        │     /usr/share/mediawiki23/extensions
   │   svn biowikifarm, (repo: as svn-post-commit)
   │   git-archive-export)  ←──────────────────┘
   │   some svn extensions from MediaWiki            Extension:StringFunctions
   ↓   
   │ WEB_WIKI (as LTS web Wiki)
   ├─→ core-files (linked)                           /var/www/v-infoflora/d/
   └─→ extensions (linked)                           /var/www/v-infoflora/d/extensions
         composer-extensions must be dealt with      /var/www/v-infoflora/d/composer.json
         on level WEB_WIKI individually

Git short help

 #↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
 git checkout <branch>
 git checkout <tag-name>
 git checkout -b <create-new-branch>
 git branch -r|--remotes       # list all branches
 git tag -l|--list             # list all tags
 git tag -l|--list <pattern>   # list tags matching the pattern
 git archive <tag-or-branch-or-tree-ish>   # extract an archive
 #↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑


Script(ed) installation

Try to install it from scratch and using no template (for the first time)

“Global Variables”

##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# set global variables
do_not_install_but_show_dry_run="" # "" or "anything-but-non-empty"
if [ "$do_not_install_but_show_dry_run" != "" ]; then 
  install_notice="DRY RUN (nothing is done)";
else
  install_notice="INSTALL";
fi

git_mw_basedir="/usr/share/mw-wmf-clone"
git_mw_core_source_dir="${git_mw_basedir}/core"
git_mw_extension_source_dir="${git_mw_basedir}/extensions"
git_branch="origin/REL1_23"
git_tag="1.23.8"

v_wiki_folder="./v-infoflora"
v_wiki_sub_folder="" # default ""
web_wiki_script_folder="./d" # default ./w for wiki or web or what ever
web_wiki_config_folder="./mw-config" # default ./mw-config
web_base_dir="/var/www"

if [ "${v_wiki_sub_folder}" == "" ];then
  web_wiki_base_dir="${web_base_dir}/${v_wiki_folder}/${web_wiki_script_folder}"
else
  web_wiki_base_dir="${web_base_dir}/${v_wiki_folder}/${v_wiki_sub_folder}/${web_wiki_script_folder}"
fi

mw_LTS_version_source_path="/usr/share/mediawiki23"
mw_LTS_version_source_extension_path="${mw_LTS_version_source_path}/extensions"
# echo "$mw_LTS_version_source_extension_path"

if [ "`command -v realpath`" ]; then web_wiki_base_dir=`realpath "$web_wiki_base_dir"`; fi
printf "\e[47mBase directory of the Wiki will be: \e[42m'%s'\e[0m\n" "${web_wiki_base_dir}"
echo -e "\e[31m$install_notice\e[0m"
# end of global variables
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

MW_WMF_CLONE Upgrade

Possible approaches after upgrading the MW_WMF_CLONE

  • checkout a LTS-branch and copy these sources to WIKI_SOURCE_LTS
  • export by git archive <tag-or-branch-or-tree-ish> to WIKI_SOURCE_LTS

Upgrade wmf-git-clone

##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
cd "${git_mw_core_source_dir}"; 
  sudo git pull;
  git branch -r | sort --version-sort # list branches
  git tag -l | sort --version-sort # list tags
cd "${git_mw_extension_source_dir}";
  sudo git pull; sudo git submodule update --init --recursive;
  git branch -r | sort --version-sort # list branches
  git tag -l | sort --version-sort # list tags
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

Checkout a branch

  • may be skipped, because later a branched or tagged archive will be exported and no copy-and-paste of a checkout
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# STEP checkout git clone to git_branch for the subsequent export?
#
cd "${git_mw_core_source_dir}"
  # git branch -r | sort --version-sort # list branches
  # git tag -l | sort --version-sort # list tags
  if [ "$do_not_install_but_show_dry_run" == "" ]; then
    sudo -u root -g mwadmin git checkout -b $git_branch $git_tag
  fi
  printf "\e[47mgit clone in '\e[42m%s\e[47m' is checkout to branch: '%s' tag: '%s'\e[0m\n"  "${git_mw_core_source_dir}" "$git_branch" "$git_tag"
cd "${git_mw_extension_source_dir}" 
  # git branch -r | sort --version-sort # list branches
  # git tag -l | sort --version-sort # list tags
  # extensions seem to have no tags
  if [ "$do_not_install_but_show_dry_run" == "" ]; then
    sudo -u root -g mwadmin git checkout -b $git_branch
  fi
  printf "\e[47mgit clone in '\e[42m%s\e[47m' is checkout to branch: '%s' (extensions seem to have no global tags)\e[0m\n" "${git_mw_extension_source_dir}" "$git_branch"
# end checkout of git clone in git_mw_basedir
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

MW_WMF_CLONE → WIKI_SOURCE_LTS

  • Create a MediaWiki versioned source (the source of a LTS-version)
  • Create extension sources, extract Git extensions to WIKI_SOURCE_LTS
    • biowikifarm extensions
    • no further developed extension still necessary fro biowikifarm
    • Git extensions from MW_WMF_CLONE

WIKI_SOURCE_LTS Core Files

##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# create MediaWiki versioned source (the source of a LTS-version)
if ! [ -d "${mw_LTS_version_source_path}" ]; then 
  if [ "$do_not_install_but_show_dry_run" == "" ]; then
    sudo -u root -g mwadmin mkdir --parent "${mw_LTS_version_source_path}"
  fi
  echo -e "\e[47mCreate wiki source directory ($git_branch): \e[42m'${mw_LTS_version_source_path}'\e[0m"
else
  echo -e "\e[47mWiki wiki source directory ($git_branch) exits already: \e[42m'${mw_LTS_version_source_path}'\e[0m"
fi

echo -e "\e[47mCheck also release notes, e.g. \e[42m'${mw_LTS_version_source_path}/RELEASE-NOTES-X.XX'\e[0m"
  
# cd "${git_mw_core_source_dir}"
# sudo -u root -g mwadmin git checkout -b origin/REL1_23 1.23.8 only from repo clone directly

###
# MediaWiki core files and directories
if [ "$do_not_install_but_show_dry_run" == "" ]; then
  # EXAMPLE: sudo git archive origin/REL1_23 | sudo -u root -g mwadmin tar --extract --overwrite --directory=/usr/share/mediawiki23
  cd "${git_mw_core_source_dir}" && sudo git archive $git_tag | sudo -u root -g mwadmin tar --extract --overwrite --directory="${mw_LTS_version_source_path}"
  if [ -d "${mw_LTS_version_source_extension_path}" ]; then
    sudo chown root:www-data -R "${mw_LTS_version_source_extension_path}"
  fi
else
  echo "cd \"${git_mw_core_source_dir}\" && sudo git archive $git_tag | sudo -u root -g mwadmin tar --extract --overwrite --directory=\"${mw_LTS_version_source_path}\""
fi
# cd "${git_mw_extension_source_dir}"
# ls -l
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

WIKI_SOURCE_LTS Extensions

Check status of extensions, either git tags or git branch numbers needed later for installation of a LTS-version

#######################################
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# check extensions: find all extensions and print tags
IFS=$'\n'; # Internal Field Separator: printf %q "$IFS" # default $' \t\n'
for ext in `find "${git_mw_extension_source_dir}" -maxdepth 1 -type d -printf "%f\n" | sort`; do 
  printf "%s" "$ext"; 
  cd "${git_mw_extension_source_dir}/$ext";
  tags=""; tags=`git tag -l | sed ':anchor;N;$!banchor;s@\n@, @g; s@ \{2,\}@ @g;'` ; 
  if [ "$tags" != "" ]; then printf "\n  tags: %s" "$tags"; else printf "\n";  fi
done;
  cd "${git_mw_extension_source_dir}"
IFS=$' \t\n';
# end check extensions' tags
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# check extensions: find all extensions and print branches
IFS=$'\n'; # Internal Field Separator: printf %q "$IFS" # default $' \t\n'
for ext in `find "${git_mw_extension_source_dir}" -maxdepth 1 -type d -printf "%f\n" | sort`; do 
  printf "%s" "$ext"; 
  cd "${git_mw_extension_source_dir}/$ext";
  branches=""; branches=`git branch --remotes | sed ':anchor;N;$!banchor;s@\n@, @g; s@ \{2,\}@ @g;'`
  if [ "$branches" != "" ]; then printf "\n  branches: %s" "$branches"; else printf "\n"; fi
done;
  cd "${git_mw_extension_source_dir}"
IFS=$' \t\n';
# end check extensions' branches
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
#######################################

Extract the right branch or tag of an extension from MW_WMF_CLONE for this WIKI_SOURCE_LTS. Note, the list of EXTENSIONS may not be complete but it seems unnecessary to extract all 663 extensions shipped with the wmf git clone.

#######################################
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# create sources for LTS-MediaWiki extensions
# IMPORTANT: extensions managed by PHP script composer.phar
# must be dealt with individually on the level WEB_WIKI
#
# basic extensions from a v1.23.8 tar.gz download are:
#   Cite, ConfirmEdit, Gadgets, ImageMap, InputBox, Interwiki, LocalisationUpdate, 
#   Nuke, ParserFunctions, Poem, Renameuser, SpamBlacklist, SyntaxHighlight_GeSHi, 
#   TitleBlacklist, WikiEditor
EXTENSIONS="
Arrays
BetaFeatures
CategoryTree
CharInsert
Cite
Collection
ConfirmAccount
ConfirmEdit
ContactPage
DataTransfer, 0.6
DismissableSiteNotice
ExternalData, 1.8
Gadgets
HeaderTabs, 1.0.1
ImageMap
InputBox
Interwiki
LiquidThreads
LocalisationUpdate
Lockdown
MassEditRegex
Math
MediaFunctions
MwEmbedSupport
MultimediaViewer
Nuke
OpenID
PageTools, REL_2_0
ParserFunctions
Poem
PdfExport
PdfHandler
Quiz
Renameuser
ReplaceText
SemanticCompoundQueries
SemanticDrilldown
SemanticForms
SemanticFormsInputs
SemanticInternalObjects, 0.8.1
SpamBlacklist
SyntaxHighlight_GeSHi
TimedMediaHandler
TitleBlacklist
TitleKey
UploadWizard
Variables
Widgets
WikiEditor
WikimediaMessages
"

# --------------------------------------
# split line on ", ". If only one value, export HEAD, else first value is branch/tag. Example:
#   SemanticMediaWiki, 1.8
#      ↓                   ↓
#   $extension, $this_clone_version
#   will export tag 1.8
# NOTE: check the line (similar to ternary operator: if condition ? dothis : dootherthings)
# $( … ) substitutes/returns the command's output
# → if ext-check-with-comma == ext then (&&) "HEAD" else (||) version-string-from-above-list-of-EXTENSIONS
# ${ext%,*}    from back  of $ext → delete shortest (%) or (%%) longest match 
# ${ext#*,* }  from front of $ext → delete shortest (#) or (##) longest match
# --------------------------------------

this_ext_update_status=""
 IFS=$'\n'; # Internal Field Separator: printf %q "$IFS" # default $' \t\n'
 for ext in $EXTENSIONS; do
  if [ "${ext}" ];then
    this_extension=$([ "${ext%,*}" == "$ext" ] && echo "$ext" || echo "${ext%*,* *}");
    this_clone_version=$([ "${ext%,*}" == "$ext" ] && echo "$git_branch" || echo "${ext#*,* *}");
    if ! [ -d "${git_mw_extension_source_dir}/${this_extension}" ]; then
      echo "${git_mw_extension_source_dir}/${this_extension} DOES NOT EXIST AS GIT SOURCE, check the extension's name or path!! (extension was skipped)";
    else
      if [ ! -d "${mw_LTS_version_source_extension_path}/${this_extension}" ]; then
        this_ext_update_status="+";
        if [ "$do_not_install_but_show_dry_run" == "" ]; then
          sudo mkdir --parents "${mw_LTS_version_source_extension_path}/${this_extension}";
          sudo chown www-data:www-data "${mw_LTS_version_source_extension_path}/${this_extension}";
        else
          echo "sudo mkdir --parents \"${mw_LTS_version_source_extension_path}/${this_extension}\"; # add $this_ext_update_status;"
          echo "sudo chown www-data:www-data \"${mw_LTS_version_source_extension_path}/${this_extension}\";"
        fi;
      else
        this_ext_update_status="u";
      fi;
      printf "git archive export: %1s %-30s %s\n" $this_ext_update_status $this_extension $this_clone_version;
      if [ "$do_not_install_but_show_dry_run" == "" ]; then
        # EXAMPLE: sudo git archive --prefix=AdminLinks/ HEAD | sudo -u www-data tar --extract --overwrite --directory=/usr/share/mediawiki23/extensions
        cd "${git_mw_extension_source_dir}/${this_extension}" && sudo git archive --prefix="${this_extension}/" $this_clone_version | \
        sudo -u www-data tar --extract --overwrite --directory="${mw_LTS_version_source_extension_path}";
      else
        echo "cd \"${git_mw_extension_source_dir}/${this_extension}\" && sudo git archive --prefix=\"${this_extension}/\" $this_clone_version | sudo -u www-data tar --extract --overwrite --directory=\"${mw_LTS_version_source_extension_path}\";"
      fi;
    fi;
  fi;
 done;
 IFS=$' \t\n';
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
#######################################"
Unsupported extensions (svn)
## Problem unsupported extensions ##
# https://www.mediawiki.org/wiki/Extension:StringFunctions
cd "${mw_LTS_version_source_extension_path}"
sudo svn co http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/StringFunctions/
# link StringFunctions to infoflora manually
sudo ln -s "${mw_LTS_version_source_extension_path}/StringFunctions" "${web_wiki_base_dir}/extensions/StringFunctions"
Biowikifarm extensions (svn)
#######################################
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# subversion step 1: biowikifarm extensions to ${mw_LTS_version_source_extension_path} 
cd "${mw_LTS_version_source_extension_path}"
sudo -u www-data -g www-data svn checkout file:///var/lib/svn/LocalSVNextensions "${mw_LTS_version_source_extension_path}"

# subversion step 2
# create post hook commit to the MediaWiki LTS source
# file sudo vi /var/lib/svn/hooks/post-commit
#!/bin/bash
if [ -d "/usr/share/mediawiki23/extensions" ]; then
  echo -en "\n\npost-commit mediawiki23/extensions (r${REV})\n" >> "${LOGFILE}"
  cd /usr/share/mediawiki23/extensions
  echo "try to get /usr/bin/svn update >> \"${LOGFILE}\"" >> "${LOGFILE}";
  /usr/bin/svn update >> "${LOGFILE}"
  echo -ne " (done)\n" >> "${LOGFILE}"
fi
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
#######################################

WIKI_SOURCE_LTS → WEB_WIKI

##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# STEP create web wiki directory
if ! [ -d "${web_wiki_base_dir}" ]; then 
  echo -e "\e[47mCreate wiki web base directory (sudo): \e[42m'${web_wiki_base_dir}'\e[0m"
  if [ "$do_not_install_but_show_dry_run" == "" ]; then
    sudo -u root -g mwadmin mkdir --parent "${web_wiki_base_dir}"
    # sudo chown root:mwadmin "${web_wiki_base_dir}" -R
  else
    echo "sudo -u root -g mwadmin mkdir --parent \"${web_wiki_base_dir}\""
  fi
else
  echo -e "\e[47mWiki web base directory exits already: \e[42m'${web_wiki_base_dir}'\e[0m"
fi
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

OpenMedia Symlink

##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# STEP create symlink to openmedia
if ! [ -d "${web_base_dir}/${v_wiki_folder}/o" ]; then 
  echo -e "\e[47mCreate Openmedia-symlink \e[42m'${web_base_dir}/${v_wiki_folder}/o'\e[47m → \e[42m'../v-species/o'\e[0m"
  if [ "$do_not_install_but_show_dry_run" == "" ]; then
    sudo ln -s "../v-species/o" "${web_base_dir}/${v_wiki_folder}/o"
    sudo mkdir "${web_base_dir}/${v_wiki_folder}/o = Openmedia-symlink"
    # sudo chown root:mwadmin "${web_wiki_base_dir}" -R
  else
    echo "sudo ln -s \"../v-species/o\" \"${web_base_dir}/${v_wiki_folder}/o\";"
  fi
else
  echo -e "\e[47mOpenmedia-symlink exits already \e[42m'${web_base_dir}/${v_wiki_folder}/o'\e[0m"
fi
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

Link Folders and Files from WIKI_SOURCE_LTS to WEB_WIKI

##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# symbolic links of folders of LTS version
# for $web_wiki_base_dir to $mw_LTS_version_source_path
cd "${mw_LTS_version_source_path}"
# \( ! -name '.*' \) avoids finding hidden directories
for mw_LTS_version_wiki_folder in `find . -maxdepth 1 \( ! -name '.*' \) -type d -printf "%f\n"`; do
  if ! [ -e "${web_wiki_base_dir}/${mw_LTS_version_wiki_folder}" ]; then
    echo "symbolic link to ${web_wiki_base_dir}/${mw_LTS_version_wiki_folder}"
    sudo ln -s "${mw_LTS_version_source_path}/${mw_LTS_version_wiki_folder}" "${web_wiki_base_dir}/${mw_LTS_version_wiki_folder}"
  fi
done
# symbolic links of files of LTS version
cd "${mw_LTS_version_source_path}"
# \( ! -name '.*' \) avoids finding hidden directories
for mw_LTS_version_wiki_file in `find . -maxdepth 1 \( ! -name '.*' \) -type f -printf "%f\n"`; do
  if ! [ -e "${web_wiki_base_dir}/${mw_LTS_version_wiki_file}" ]; then
    echo "symbolic link to ${web_wiki_base_dir}/${mw_LTS_version_wiki_file}"
    sudo ln -s "${mw_LTS_version_source_path}/${mw_LTS_version_wiki_file}" "${web_wiki_base_dir}/${mw_LTS_version_wiki_file}"
  fi
done
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

Fix Links of Folders (Cache, Media, Extensions …)

Cache & media is on a separate partition. Folder extension cannot be a symbolic link because of composer’s management on level WEB_WIKI.

##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# extension: remove symbolic link to folder extensions
  # no symbolic link to mw_LTS_version_source_extension_path
  # because composer.phar handles extension on level WEB_WIKI
  sudo rm -i "${web_wiki_base_dir}/extensions" # remove interactively
  echo "create ${web_wiki_base_dir}/extensions"
  sudo -u root -g www-data mkdir "${web_wiki_base_dir}/extensions"
  
# cache: reroute cache folder to a dump partition
  var_dump_dir_for_wiki="/mnt/dump/var/www/v-infoflora-d-cache";
  web_wiki_base_dir="/var/www/v-infoflora/d";
  echo "create ${var_dump_dir_for_wiki}";
  sudo mkdir --parent "${var_dump_dir_for_wiki}"; 
  sudo chown www-data:www-data "${var_dump_dir_for_wiki}";
  sudo chmod 775 -R "${var_dump_dir_for_wiki}";
  echo "remove current ${web_wiki_base_dir}/cache";
  sudo rm "${web_wiki_base_dir}/cache" -r;
  echo "make symbolic link ${web_wiki_base_dir}/cache → ${var_dump_dir_for_wiki}";
  sudo ln -s "${var_dump_dir_for_wiki}" "${web_wiki_base_dir}/cache";
  
# images: use media instead, reroute to dump partition
  var_dump_dir_for_wiki="/mnt/storage/var-www-v-inflora-d-media";
  web_wiki_base_dir="/var/www/v-infoflora/d";
  echo "remove current ${web_wiki_base_dir}/images";
  sudo rm -i "${web_wiki_base_dir}/images"  # remove it interactively
  echo "create ${var_dump_dir_for_wiki}";
  sudo mkdir --parent "${var_dump_dir_for_wiki}"; 
  sudo chown www-data:www-data "${var_dump_dir_for_wiki}"; 
  sudo chmod 775 -R "${var_dump_dir_for_wiki}";
  echo "make symbolic link ${web_wiki_base_dir}/media → ${var_dump_dir_for_wiki}";
  sudo ln -s "${var_dump_dir_for_wiki}" "${web_wiki_base_dir}/media";
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

Link Extensions from WIKI_SOURCE_LTS to WEB_WIKI

##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# create symlinks to extensions individually
# reason: composer-extensions must be dealt with
# on level WEB_WIKI individually
# @dependency $EXTENSIONS
# @dependency global variables

SVN_BIOWIKIFARM_EXTENSIONS="
CommonsMediaCaching
ContributorList
IdentificationTool
ListAllExternalLinks
MobileKeyV1
MobileKeyV2
TemplateParameterIndex
"
LTS_EXTENSIONS=`echo "${EXTENSIONS}\n${SVN_BIOWIKIFARM_EXTENSIONS}" | sed 's@ *, .*@@g;/^$/d;' | sort --unique`

 this_ext_update_status=""
 IFS=$'\n'; # Internal Field Separator: printf %q "$IFS" # default $' \t\n'
 for ext in $LTS_EXTENSIONS; do
  if [ "${ext}" ];then
  # ${ext%,*}    from back  of $ext → delete shortest (%) or (%%) longest match 
  # ${ext#*,* }  from front of $ext → delete shortest (#) or (##) longest match
  this_extension=$([ "${ext%,*}" == "$ext" ] && echo "$ext" || echo "${ext%*,* *}");
  if ! [ -d "${mw_LTS_version_source_extension_path}/${this_extension}" ]; then
    echo "${mw_LTS_version_source_extension_path}/${this_extension} DOES NOT EXIST as LTS source, check '${mw_LTS_version_source_extension_path}' (extension was skipped)";
  else
    if ! [ -e "${web_wiki_base_dir}/extensions/${this_extension}" ]; then
      this_ext_update_status="+";
      if [ "$do_not_install_but_show_dry_run" == "" ]; then
        sudo ln -s "${mw_LTS_version_source_extension_path}/${this_extension}" "${web_wiki_base_dir}/extensions/${this_extension}";
      else
        echo "sudo ln -s \"${mw_LTS_version_source_extension_path}/${this_extension}\" \"${web_wiki_base_dir}/extensions/${this_extension}\";";
      fi
    else
      this_ext_update_status=".";
    fi;
    printf "symlink: %1s %-30s\n" $this_ext_update_status $this_extension;
  fi;
  fi;
 done;
 IFS=$' \t\n';
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

Install composer extensions

These extensions must be dealt with at level WEB_WIKI. Documentation

Extensions you want to remove you must do it with composer

##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# get, install PHP composer tool
cd ~ # go to personal home directory
sudo curl -sS https://getcomposer.org/installer | php
sudo chown root:mwadmin composer.phar
sudo mv composer.phar /usr/local/bin/

# create ${web_wiki_base_dir}/composer.json
# see ${web_wiki_base_dir}/composer-example.json
sudo cp "${web_wiki_base_dir}/composer-example.json" "${web_wiki_base_dir}/composer.json"
sudo chown root:mwadmin  "${web_wiki_base_dir}/composer.json"
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
(Re)Move old Git extensions

The problem is, that extensions managed by git must be removed in favour of composer management. Composer installs also dependencies so take care also of dependent extensions documented by extension developers, e.g. SemanticMaps in composer will also install extension Maps. The following script just renames old extension folders to make room for the composer managed extensions. In case of SemanticMaps it’s only necessary to do …

sudo php /usr/local/bin/composer.phar require mediawiki/semantic-maps '3.1.3'

… but you must take care of the extension folder Maps (if present) manually.

##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# rename e.g. extension SemanticForms folder → SemanticForms_2015-01-15
# create a file containing all composer commands to be installed manually later on
cd "${web_wiki_base_dir}"
composer_command_file="composer_extensions_to_be_manually_installed.sh"
# ExtensionName, composer-require-command
COMPOSER_EXTENSIONS="
GraphViz, require mediawiki/graph-viz '*'
ImageMap, require mediawiki/image-map '@dev'
SemanticMediaWiki, require mediawiki/semantic-media-wiki '~2.0'
SemanticForms, require mediawiki/semantic-forms '3.1'
SemanticResultFormats, require mediawiki/semantic-result-formats '2.0'
SemanticMaps, require mediawiki/semantic-maps '3.1.3'
PHPExcel, require phpoffice/phpexcel '1.8.0'
"
echo "Install extensions manually, see '${web_wiki_base_dir}/$composer_command_file'";
echo "You may check also dependencies manually and rename those extension folders manually too, e.g. SemanticMaps is dependent on Maps";
if [ "$do_not_install_but_show_dry_run" == "" ]; then
  sudo /bin/su -c "echo '' > \"${web_wiki_base_dir}/$composer_command_file\""
else
  echo "sudo /bin/su -c \"echo '' > \\\"${web_wiki_base_dir}/$composer_command_file\\\"\" "
fi
IFS=$'\n'; # Internal Field Separator: printf %q "$IFS" # default $' \t\n'
 for ext in $COMPOSER_EXTENSIONS; do
  if [ "${ext}" ];then
  # ${ext%,*}    from back  of $ext → delete shortest (%) or (%%) longest match 
  # ${ext#*,* }  from front of $ext → delete shortest (#) or (##) longest match
  this_composer_command=$([ "${ext%,*}" == "$ext" ] && echo "$ext" || echo "${ext#*,* }");
  this_extension=$([ "${ext%,*}" == "$ext" ] && echo "$ext" || echo "${ext%*,*}");
  if [ -h "${web_wiki_base_dir}/extensions/${this_extension}" ]; then
    old_extension_date=`stat --format="%y" "${web_wiki_base_dir}/extensions/${this_extension}" | awk  '{ print $1 }'` # e.g 2015-01-15
    echo "There is already an extension: rename '${this_extension}' to '${this_extension}_${old_extension_date}' "
    if [ "$do_not_install_but_show_dry_run" == "" ]; then
      sudo mv "${web_wiki_base_dir}/extensions/${this_extension}" "${web_wiki_base_dir}/extensions/${this_extension}_${old_extension_date}"
    else
      echo "sudo mv \"${web_wiki_base_dir}/extensions/${this_extension}\" \"${web_wiki_base_dir}/extensions/${this_extension}_${old_extension_date}\""
    fi
  fi
  printf "\e[0mFor \e[47m$this_extension\e[0m you may need to remove in \e[47mLocalSettings.php\e[0m the entry \e[42m%s\e[0m\n" "require_once '\$IP/extensions/$this_extension/$this_extension.php'; "
  printf "Append composer command to \e[42m%s\e[0m\n" "'${web_wiki_base_dir}/$composer_command_file'"
  if [ "$do_not_install_but_show_dry_run" == "" ]; then
    sudo /bin/su -c "echo \"sudo php /usr/local/bin/composer.phar $this_composer_command\" >> \"${web_wiki_base_dir}/$composer_command_file\""
  else
    echo "sudo /bin/su -c \"echo \\\"sudo php /usr/local/bin/composer.phar $this_composer_command\\\" >> \\\"${web_wiki_base_dir}/$composer_command_file\\\"\""
  fi;
  fi;
 done
IFS=$' \t\n';
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# commands from manually created file in '${web_wiki_base_dir}/$composer_command_file'
cd "${web_wiki_base_dir}"
sudo php /usr/local/bin/composer.phar require mediawiki/graph-viz '*'
sudo php /usr/local/bin/composer.phar require mediawiki/image-map '@dev'
sudo php /usr/local/bin/composer.phar require mediawiki/semantic-media-wiki '~2.0'
sudo php /usr/local/bin/composer.phar require mediawiki/semantic-forms '3.1'
sudo php /usr/local/bin/composer.phar require mediawiki/semantic-result-formats '2.0'
sudo php /usr/local/bin/composer.phar require mediawiki/semantic-maps '3.1.3'
sudo php /usr/local/bin/composer.phar require phpoffice/phpexcel '1.8.0'
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
#######################################

Settings for LocalSettings.php

Set correct rights

sudo chmod 664 "${web_wiki_base_dir}/LocalSettings.php" # rw-rw-r--
sudo chown root:mwadmin "${web_wiki_base_dir}/LocalSettings.php"

There are alternative approaches:

  1. use web installer of the new Wiki
  2. use command line installer in maintenance/install.php
    •  ?does it try to override a LocalSettings.php?
    • it seems to need an Admin User to be defined (problem with shared user tables?)
    • see Manual:Shared database → Upgrading. ?make use of command line option --doshared?
  3. copy old database template (database z_en_template in https://biowikifarm.net/phpmyadmin_v3-3-7/) and adjust it as well as settings for LocalSettings.php
    • see in MediaWikiCommonSettings.php (some settings there might interfere with MW 1.23 due to software changes)
    • see other files of LocalSettings.php

To get it work with composer add the following somewhere in LocalSettings.php:

if (is_readable("$IP/vendor/autoload.php")) require( "$IP/vendor/autoload.php");

Nginx Configuration

See also Nginx Installation and Configuration. Tips:

General architecture

/etc/nginx/nginx.conf - basic settings
└→ include /etc/nginx/sites-enabled/* - actual sites configured ready for production
   * default file - for common settings of that server the no-URL-resolving redirects back to
┌→ * configuration files for each server
│ (linked)
/etc/nginx/sites-available/* - potentially available sites files for each server

Installation Issues, Problems, Transition form Older Wikis

  • RELEASE-NOTES: read/check file mw-source/RELEASE-NOTES-X.XX, changes are described there, class changes, core changes and deprecated functions
  • composer management: problem is that composer extensions are handled on the level WEB_WIKI by composer not by require_once("…")
  • Extension:Cite becomes extension CiteThisPage (MW 1.24+)
  • Extension:ContacPage has special installation (MW1.23+) https://www.mediawiki.org/wiki/Extension:ContactPage#Installation
  • Extension:ExpandTemplates is now in MW1.23+ core, separate installation is no longer necessary (require_once("…"))
  • Extension:GlobalUsage has no more class names with underscore. Adjust configuration of $wgLBFactoryConf in LocalSettings.php see also http://noc.wikimedia.org/conf/highlight.php?file=db.php
  • Extension:Vector is in core MW 1.22+, separate installation is no longer necessary (require_once("…"))

Dependencies:

  • Extension:TimedMediaHandler dependent on Extension:MwEmbedSupport
  • biowikifarm Extension:MobileKeyV1, Extension:MobileKeyV2 are dependent on Extension:TemplateParameterIndex
  • Extension:BetaFeatures is a light dependency of Extension:MultimediaViewer

Composer extensions see above

No further development

Installation Problems

  • A user_password_expires column has been added to the user table
/usr/share/mediawiki23/maintenance/archives/patch-user_password_expire.sql
# MYSQL-patch see release notes: ALTER TABLE user ADD COLUMN user_password_expires varbinary(14) DEFAULT NULL; -- done so far for biowikifarm
  • location in nginx path must match $wgScriptPath $wgArticlePath
  • load.php gave internal server error 500
    debug on: nothing conclusive
    nginx logs: PHP message: PHP Fatal error: Cannot override final method SMW\ResultPrinter::getResult() in /var/www/v-infoflora/d/extensions/SemanticResultFormats/formats/Exhibit/SRF_Exhibit.php on line 468
    $srfgFormats[] = 'exhibit'. in SemanticResultFormats v2.0 causes fatal error, see https://phabricator.wikimedia.org/T59760
  • Google Maps API Key neccessary?
  • <gallery> needs a new setting in $wgGalleryOptions for 'mode' otherwise MWException
    'mode' => 'traditional', // One of "traditional", "nolines", "packed", "packed-hover", "packed-overlay"
  • if Extension:TitleKey is active you should run for the first time
sudo -u www-data php /var/www/v-mywiki/w/extensions/TitleKey/rebuildTitleKeys.php --conf LocalSettings.php

Installation Issues: Semantic MediaWiki

  • Extension:SemanticForms 3.0+ (edit with form) the implementation of forms has changed to {{#default_form:form}}
  • #set_internal saves differently on a property page "Property:property-name" not just "property-name", has consequences for querying. You could use a count check for the query to see if a property prefix is neccessary:
{{#ifexr: {{#ask: [[internal object::{{{property|}}}]]|format=count}}|<!-- no prefix: older SMW -->PAGENAME|<!-- prefix property -->FULLPAGENAME}}
  • Extension:Semantic Drilldown 2.0+ sets up drill down by #drilldowninfo and #drilldownlink. Deprecated things:
    • namespace Filter
    • Constants for special properties