Difference between revisions of "Mediawiki installation/Version 1.25"

From Biowikifarm Metawiki
Jump to: navigation, search
m (Update local wmf git clone)
 
(19 intermediate revisions by 2 users not shown)
Line 40: Line 40:
 
  git archive <tag-or-branch-or-tree-ish>  # extract an archive
 
  git archive <tag-or-branch-or-tree-ish>  # extract an archive
 
  #↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
 
  #↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
</syntaxhighlight>
 
 
 
== “Global Variables” ==
 
 
<syntaxhighlight lang="bash">
 
# Set global variables
 
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
 
git_path="/usr/share/mw-wmf-clone"
 
git_extension_path="/usr/share/mw-wmf-clone/extensions"
 
# UPDATE THE FOLLOWING:
 
usr_share_wiki_path="/usr/share/mediawiki25"
 
usr_share_extension_path="${usr_share_wiki_path}/extensions"
 
git_branch="origin/master" ## OR "origin/wmf/1.25wmf19" for wmf version, OR REL1_25
 
git_tag="origin/master" ## OR "1.25.9"
 
vhost_path="/var/www/zzz-temp-overwrite4mw25template" # in web base dir
 
vhost_wiki_path="${vhost_path}/w"
 
# Note: if wiki is not directly in the vhost path, add the necessary subfolder, e.g. .../en/w
 
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
 
# End of global variables
 
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Line 66: Line 46:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
 
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# Update the git clone on biowikifarm:
+
# Update the git clone on biowikifarm:
cd /usr/share/mw-wmf-clone/core; sudo git fetch;  
+
if [ `ls /usr/share/mw-wmf-clone/core | wc --lines` -gt 0 ]; then
  cd ../extensions; sudo git pull; sudo git submodule update --init --recursive;
+
  echo "# Update git /usr/share/mw-wmf-clone/core … ";
  cd ../skins; sudo git pull; sudo git submodule update --init --recursive;
+
  cd /usr/share/mw-wmf-clone/core; sudo git pull; # subsequent times
 +
else
 +
  echo "# Get git for the first time /usr/share/mw-wmf-clone/core … ";
 +
  cd /usr/share/mw-wmf-clone/core; sudo git fetch; # first time
 +
fi
 +
  cd /usr/share/mw-wmf-clone/extensions; sudo git pull; sudo git submodule update --init --recursive;
 +
  sudo ./quick-update
 +
  cd /usr/share/mw-wmf-clone/skins; sudo git pull; sudo git submodule update --init --recursive;
  
  # OPTIONAL: information on tags etc:
+
  # OPTIONAL: list information on tags etc:
 
  cd /usr/share/mw-wmf-clone/core;  
 
  cd /usr/share/mw-wmf-clone/core;  
 
  git branch -r | sort --version-sort # list branches
 
  git branch -r | sort --version-sort # list branches
Line 81: Line 68:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
+
== “Global Variables” and installing/updating core ==
== MW_WMF_CLONE → usr-share-wiki ==
+
 
+
* Create a MediaWiki versioned source in usr/share
+
* Create extension sources, extract Git extensions to usr-share-wiki
+
** biowikifarm extensions
+
** no further developed extension still necessary fro biowikifarm
+
** Git extensions from MW_WMF_CLONE
+
 
+
=== usr-share-wiki core ===
+
  
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
# create MediaWiki core for specific version
+
# Set global variables (UPDATE this for diff. versions!)
 
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
 
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
 +
usr_share_wiki_path="/usr/share/mediawiki25"
 +
git_branch="origin/master" ## OR "origin/wmf/1.25wmf19" for wmf version, OR REL1_25
 +
git_tag="origin/master" ## OR "1.25.9"
 +
vhost_path="/var/www/zzz-temp-overwrite4mw25template" # in web base dir
 +
# version independent:
 +
usr_share_extension_path="${usr_share_wiki_path}/extensions"
 +
vhost_wiki_path="${vhost_path}/w"
 +
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
 +
# Note: if wiki is not directly in the vhost path, add the necessary subfolder, e.g. .../en/w
 +
# End of global variables
 +
 +
# Create MediaWiki core for specific version
 
if ! [ -d "${usr_share_wiki_path}" ]; then  
 
if ! [ -d "${usr_share_wiki_path}" ]; then  
 
   sudo -u root -g mwadmin mkdir --parent "${usr_share_wiki_path}"
 
   sudo -u root -g mwadmin mkdir --parent "${usr_share_wiki_path}"
Line 103: Line 93:
  
 
# Extract MediaWiki core files from git to usr-share-folder
 
# Extract MediaWiki core files from git to usr-share-folder
  # EXAMPLE: sudo git archive origin/REL1_23 | sudo -u root -g mwadmin tar --extract --overwrite --directory=/usr/share/mediawiki23
+
### EXAMPLE without vars:
cd "${git_path}/core" && sudo git archive $git_tag | sudo -u root -g mwadmin tar --extract --overwrite --directory="${usr_share_wiki_path}"
+
### cd /usr/share/mw-wmf-clone/core; sudo git archive origin/REL1_23 | sudo -u root -g mwadmin tar --extract --overwrite --directory=/usr/share/mediawiki23
 +
cd /usr/share/mw-wmf-clone/core && sudo git archive $git_tag | sudo -u root -g mwadmin tar --extract --overwrite --directory="${usr_share_wiki_path}"
 
sudo chown root:www-data -R "${usr_share_extension_path}"
 
sudo chown root:www-data -R "${usr_share_extension_path}"
 
# for composer on wikifarm: create a vendor folder in usr-share-wiki
 
# for composer on wikifarm: create a vendor folder in usr-share-wiki
 
sudo mkdir "${usr_share_wiki_path}"/vendor
 
sudo mkdir "${usr_share_wiki_path}"/vendor
 +
 +
# TO UPDATE JUST USE:
 +
cd /usr/share/mw-wmf-clone/core && sudo git archive $git_tag | sudo -u root -g mwadmin tar --extract --overwrite --directory="${usr_share_wiki_path}"
 
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
 
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
 
</syntaxhighlight>
 
</syntaxhighlight>
  
==== usr-share-wiki extensions ====
+
== Install wiki extensions ==
  
Check status of extensions, either git tags or git branch numbers needed later for installation
 
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
#######################################
 
 
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
 
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# List all extensions with their tags, write into file in the user's home folder
+
# 1. INFORMATION ONLY:
# (Ignore error about /mw-wmf-clone/extensions/extensions)
+
# LIST (and write to file) git tags / git branches of all extensions  
 +
# Write into file in the user's home folder
 +
# (Note: Ignore error about /mw-wmf-clone/extensions/extensions)
 
sudo printf "\n"  > ~/"ext_tags_and_branches.txt";  
 
sudo printf "\n"  > ~/"ext_tags_and_branches.txt";  
 
IFS=$'\n'; # change internal Field Separator to newline only; test: printf %q "$IFS"; default $' \t\n'
 
IFS=$'\n'; # change internal Field Separator to newline only; test: printf %q "$IFS"; default $' \t\n'
for ext in `find "${git_extension_path}" -maxdepth 1 -type d -printf "%f\n" | sort`; do  
+
for ext in `find /usr/share/mw-wmf-clone/extensions -maxdepth 1 -type d -printf "%f\n" | sort`; do  
 
   printf "\n%s" "$ext" >> ~/"ext_tags_and_branches.txt";  
 
   printf "\n%s" "$ext" >> ~/"ext_tags_and_branches.txt";  
   cd "${git_extension_path}/$ext";
+
   cd "/usr/share/mw-wmf-clone/extensions/$ext";
 
   tags=""; tags=`git tag -l | sed ':anchor;N;$!banchor;s@\n@, @g; s@ \{2,\}@ @g;'` ;  
 
   tags=""; tags=`git tag -l | sed ':anchor;N;$!banchor;s@\n@, @g; s@ \{2,\}@ @g;'` ;  
 
   if [ "$tags" != "" ]; then  
 
   if [ "$tags" != "" ]; then  
Line 132: Line 126:
 
done;
 
done;
 
# List all extensions with their branches, write into same file
 
# List all extensions with their branches, write into same file
for ext in `find "${git_extension_path}" -maxdepth 1 -type d -printf "%f\n" | sort`; do  
+
for ext in `find /usr/share/mw-wmf-clone/extensions -maxdepth 1 -type d -printf "%f\n" | sort`; do  
 
   printf "\n%s" "$ext" >> ~/"ext_tags_and_branches.txt";  
 
   printf "\n%s" "$ext" >> ~/"ext_tags_and_branches.txt";  
   cd "${git_extension_path}/$ext";
+
   cd "/usr/share/mw-wmf-clone/extensions/$ext";
 
   branches=""; branches=`git branch --remotes | sed ':anchor;N;$!banchor;s@\n@, @g; s@ \{2,\}@ @g;'`
 
   branches=""; branches=`git branch --remotes | sed ':anchor;N;$!banchor;s@\n@, @g; s@ \{2,\}@ @g;'`
 
   if [ "$branches" != "" ]; then printf "\n  branches: %s" "$branches"  >> ~/"ext_tags_and_branches.txt"; else printf "\n" >> ~/"ext_tags_and_branches.txt"; fi
 
   if [ "$branches" != "" ]; then printf "\n  branches: %s" "$branches"  >> ~/"ext_tags_and_branches.txt"; else printf "\n" >> ~/"ext_tags_and_branches.txt"; fi
 
done;
 
done;
cd "${git_extension_path}"
+
cd /usr/share/mw-wmf-clone/extensions
 
IFS=$' \t\n';
 
IFS=$' \t\n';
 
# end list extensions' tags and branches
 
# end list extensions' tags and branches
Line 145: Line 139:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Extract the correct branch or tag of an extension from MW_WMF_CLONE for this usr-share-wiki. Note, the list of EXTENSIONS is incomplete but it seems unnecessary to extract all 663 extensions shipped with the wmf git clone.
+
NOTE: If git_branch is set to something like REL1_24, code below is broken, QUICKFIX: Put a version after EVERY extension!
 
+
NOTE: Code below is broken, if git_branch is set to REL1_24. QUICKFIX: Put a version after EVERY extension!
+
  
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
#######################################
 
#######################################
 +
# 2. Create MediaWiki extensions in usr/share
 +
# Extract correct branch or tag of an extension for this usr-share-wiki.
 +
# IMPORTANT: extensions managed by PHP script composer.phar and
 +
# their dependencies must not be included here, presently these are:
 +
# "mediawiki/graph-viz": "*",
 +
# "mediawiki/image-map": "@dev",
 +
# "mediawiki/semantic-media-wiki": "~2.1",
 +
# "mediawiki/semantic-breadcrumb-links": "1.0.0",
 +
# "mediawiki/semantic-result-formats": "2.0",
 +
# "mediawiki/semantic-forms": "3.1",
 +
# "mediawiki/semantic-maps": "3.1.3",
 +
# "mediawiki/vector-skin": "*"
 
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
 
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# create MediaWiki extensions in usr share
+
sudo chown www-data:www-data "${usr_share_extension_path}" -R
# IMPORTANT: extensions managed by PHP script composer.phar
+
# and their dependencies must not be included here
+
 
EXTENSIONS="
 
EXTENSIONS="
 
Arrays, origin/master
 
Arrays, origin/master
Line 170: Line 172:
 
Gadgets, origin/master
 
Gadgets, origin/master
 
HeaderTabs, 1.0.1
 
HeaderTabs, 1.0.1
ImageMap, origin/master
 
 
InputBox, origin/master
 
InputBox, origin/master
 
Interwiki, origin/master
 
Interwiki, origin/master
Line 193: Line 194:
 
SemanticCompoundQueries, origin/master
 
SemanticCompoundQueries, origin/master
 
SemanticDrilldown, origin/master
 
SemanticDrilldown, origin/master
SemanticForms, origin/master
 
 
SemanticFormsInputs, origin/master
 
SemanticFormsInputs, origin/master
 
SemanticInternalObjects, 0.8.1
 
SemanticInternalObjects, 0.8.1
Line 207: Line 207:
 
WikimediaMessages, origin/master
 
WikimediaMessages, origin/master
 
"
 
"
# --------------------------------------
+
# --
 
# split line on ", ". If only one value, export HEAD, else first value is branch/tag. Example:
 
# split line on ", ". If only one value, export HEAD, else first value is branch/tag. Example:
 
#  SemanticMediaWiki, 1.8
 
#  SemanticMediaWiki, 1.8
Line 225: Line 225:
 
     this_extension=$([ "${ext%,*}" == "$ext" ] && echo "$ext" || echo "${ext%%,*}");
 
     this_extension=$([ "${ext%,*}" == "$ext" ] && echo "$ext" || echo "${ext%%,*}");
 
     this_clone_version=$([ "${ext%,*}" == "$ext" ] && echo "$git_branch" || echo "${ext#*, *}");
 
     this_clone_version=$([ "${ext%,*}" == "$ext" ] && echo "$git_branch" || echo "${ext#*, *}");
     if ! [ -d "${git_extension_path}/${this_extension}" ]; then
+
     if ! [ -d "/usr/share/mw-wmf-clone/extensions/${this_extension}" ]; then
       echo "${git_extension_path}/${this_extension} DOES NOT EXIST AS GIT SOURCE, check the extension's name or path!! (extension was skipped)";
+
       echo "/usr/share/mw-wmf-clone/extensions/${this_extension} DOES NOT EXIST AS GIT SOURCE, check the extension's name or path!! (extension was skipped)";
 
     else
 
     else
 
       if [ ! -d "${usr_share_extension_path}/${this_extension}" ]; then
 
       if [ ! -d "${usr_share_extension_path}/${this_extension}" ]; then
Line 236: Line 236:
 
       fi;
 
       fi;
 
       printf "git archive export: %1s %-30s %s\n" $this_ext_update_status $this_extension $this_clone_version;
 
       printf "git archive export: %1s %-30s %s\n" $this_ext_update_status $this_extension $this_clone_version;
       if [ -d "${git_extension_path}/${this_extension}" ]; then
+
       if [ -d "/usr/share/mw-wmf-clone/extensions/${this_extension}" ]; then
         cd "${git_extension_path}/${this_extension}";
+
         cd "/usr/share/mw-wmf-clone/extensions/${this_extension}";
 
         AVAILABLE_CLONE_VERSIONS=`git branch -r | sort --version-sort`;
 
         AVAILABLE_CLONE_VERSIONS=`git branch -r | sort --version-sort`;
##### FOLLOWING LINES CAUSE ERROR -> CHECKING TEMPORARILY DISABLED
+
##### FOLLOWING LINES CAUSE ERROR -> CHECKING code temporarily DISABLED
 
         ##if [ "`echo "$AVAILABLE_CLONE_VERSIONS" | grep --count "$this_clone_version"`" == "0" ]; then
 
         ##if [ "`echo "$AVAILABLE_CLONE_VERSIONS" | grep --count "$this_clone_version"`" == "0" ]; then
 
         ##  echo "Clone version $this_clone_version not available!! Check these (git branch -r  | sort --version-sort):";
 
         ##  echo "Clone version $this_clone_version not available!! Check these (git branch -r  | sort --version-sort):";
Line 250: Line 250:
 
         sudo git archive --prefix="${this_extension}/" "$this_clone_version" | sudo -u www-data tar --extract --overwrite --directory="${usr_share_extension_path}";
 
         sudo git archive --prefix="${this_extension}/" "$this_clone_version" | sudo -u www-data tar --extract --overwrite --directory="${usr_share_extension_path}";
 
       else
 
       else
         echo  "Source not found: \"${git_extension_path}/${this_extension}\" ";
+
         echo  "Source not found: \"/usr/share/mw-wmf-clone/extensions/${this_extension}\" ";
 
       fi;
 
       fi;
 
     fi;
 
     fi;
Line 261: Line 261:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
===== Subversion extensions (svn) =====
+
==== Subversion extensions (svn) ====
  
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
Line 277: Line 277:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
# Subversion step 3 (manual, not scripted):
+
Subversion step 3 (manual, not scripted):
# create post hook commit to the current MediaWiki version
+
<syntaxhighlight lang="bash">
# Open file:  sudo vi /var/lib/svn/hooks/post-commit
+
# Subversion step 3 (manual, not scripted):
# and insert following text:
+
# UPDATE THE PATH, e.g. mediawiki25!
if [ -d "/usr/share/mediawiki25/extensions" ]; then
+
# create post hook commit to the current MediaWiki version
 +
# Open file:  sudo vi /var/lib/svn/hooks/post-commit
 +
# and insert following text:
 +
if [ -d "/usr/share/mediawiki25/extensions" ]; then
 
   echo -en "\n\npost-commit mediawiki25/extensions (r${REV})\n" >> "${LOGFILE}"
 
   echo -en "\n\npost-commit mediawiki25/extensions (r${REV})\n" >> "${LOGFILE}"
 
   cd /usr/share/mediawiki25/extensions
 
   cd /usr/share/mediawiki25/extensions
Line 287: Line 290:
 
   /usr/bin/svn update >> "${LOGFILE}"
 
   /usr/bin/svn update >> "${LOGFILE}"
 
   echo -ne " (done)\n" >> "${LOGFILE}"
 
   echo -ne " (done)\n" >> "${LOGFILE}"
fi
+
fi
 +
</syntaxhighlight>
  
 
===== Skins =====
 
===== Skins =====
  
Since Mediawiki V1.25 the default skins are in separate Git respositories, copied separately
+
Since Mediawiki V1.25 the default skins are in separate Git respositories.
 
+
To be installed manually, OR via composer (Vector).
Note: this code presently directly checks out a git for each version, not (as in core and extensions) creates an archive export. Could be changed in the future for consistency.
+
  
 +
Note: Vector uses COMPOSER! BUT STILL RUN FOR mwSkinNaturkunde.git
 
<source lang="bash">
 
<source lang="bash">
 
  # variables
 
  # variables
 
  cd ${usr_share_wiki_path}/skins
 
  cd ${usr_share_wiki_path}/skins
 
  # get default skins from separate skin git
 
  # get default skins from separate skin git
   ## NEXT TIME: extract (git archive) from "${git_path}/skins"!
+
   ## NEXT TIME: extract (git archive) from /usr/share/mw-wmf-clone/skins!
sudo git clone https://git.wikimedia.org/git/mediawiki/skins/Vector.git
+
  ##DISABLED, IS IN COMPOSER## sudo git clone https://git.wikimedia.org/git/mediawiki/skins/Vector.git
# optionally get special skins from separate git(s)
+
  # optionally get special skins from separate git(s)
 
  sudo git clone https://github.com/MfN-Berlin/mwSkinNaturkunde.git
 
  sudo git clone https://github.com/MfN-Berlin/mwSkinNaturkunde.git
 
</source>
 
</source>
  
 
 
=== USR_SHARE_MW → var/www-folder ===
 
=== USR_SHARE_MW → var/www-folder ===
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
Line 362: Line 365:
 
   fi
 
   fi
 
done
 
done
 +
# remove links no longer present in 1.25:
 +
sudo rm /var/www/v-on/w25/bin
 +
sudo rm /var/www/v-on/w25/redirect.php
 +
sudo rm /var/www/v-on/w25/redirect.php5
 +
sudo rm /var/www/v-on/w25/redirect.phtml
 +
## it may be that a profiler was defined, delete!
 +
sudo rm /var/www/v-on/w25/StartProfiler.php
 
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
 
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 389: Line 399:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
NOTES: Normally composer creates a "vendor" folder in the /var/www/.../w/ folder
+
# NOTES: Normally composer creates a "vendor" folder in the /var/www/.../w/ folder
On biowikifarm we create a vendor folder in /usr/share/mediawikixx and already linked to this.
+
# On biowikifarm we create a vendor folder in /usr/share/mediawikiXX (linked into /var/www/.../w/).
Problem: originally the composer.json and composer.lock (created on first install) were left in the var-www-wikis (with the possibilites to have different ones, e.g. with/without SMW). However, the update maintenance script (cd /var/www/v-on/w25;    sudo -u www-data php ./maintenance/update.php --quick --conf=./LocalSettings.php) fails to run. Adding back-symlinks:
+
# Problem: we also need composer.json and composer.lock files (created on first compopser install in the var-www-wikis).
# rename composer.json to composer.distrib.json if updating from existing installs:
+
# However, /maintenance/update.php ... fails to run. Thus we need, from an earlier install, copy the files and add symlinks:
sudo mv /usr/share/mediawiki25/composer.json /usr/share/mediawiki25/composer.distrib.json
+
sudo ln -s /var/www/v-on/w25/composer.json /usr/share/mediawiki25/composer.json
+
sudo ln -s /var/www/v-on/w25/composer.lock /usr/share/mediawiki25/composer.lock
+
did fix this. (Note: the "normal" direction, file in usr/share/... and symlink in var/www/... would probably work as well, the hope is that this still allows differentiation. To be tested!
+
  
 +
'''TODO: use global vars AND put it into the template rather than into the example wiki v-on/w25!!!'''
 +
 +
<syntaxhighlight lang="bash">
 +
# NOTE: 1. DO NOT RERUN THIS SCRIPT! 2. This uses an EXAMPLE wiki path, not the template path. TODO: test with a template wiki next time!
 +
# rename composer.json to composer.distrib.json if updating from existing installs:
 +
# sudo mv ${usr_share_wiki_path}/composer.json ${usr_share_wiki_path}/composer.distrib.json
 +
## TODO: cp composer.* to ${usr_share_wiki_path}/composer.json
 +
sudo rm /var/www/v-on/w25/composer.*
 +
sudo ln -s ${usr_share_wiki_path}/composer.json /var/www/v-on/w25/composer.json
 +
sudo ln -s ${usr_share_wiki_path}/composer.lock /var/www/v-on/w25/composer.lock
 +
</syntaxhighlight>
 
Notes:  
 
Notes:  
 
* Update the /usr/share/mediawikiXX/composer.json file with the desired composer-installed extensions
 
* Update the /usr/share/mediawikiXX/composer.json file with the desired composer-installed extensions
Line 403: Line 420:
 
* Not for this fresh install, but for later changes within a version: remove folder located in usr-share-extensions
 
* Not for this fresh install, but for later changes within a version: remove folder located in usr-share-extensions
  
Run composer:
+
Run composer (EXAMPLE WIKI!):
cd /var/www/v-on/w25 ## EXAMPLE
+
<syntaxhighlight lang="bash">
 
  # First time (writing both into vendor and extension folders):  
 
  # First time (writing both into vendor and extension folders):  
  sudo php /usr/local/bin/composer.phar install
+
  # cd /var/www/v-on/w25; sudo php /usr/local/bin/composer.phar install
 
  # Later (harmless to re-run):
 
  # Later (harmless to re-run):
  sudo php /usr/local/bin/composer.phar update
+
  cd /var/www/v-on/w25; sudo php /usr/local/bin/composer.phar update
 +
sudo chown www-data:www-data -R "${usr_share_extension_path}"
 +
</syntaxhighlight>
  
 
OTHER WORK
 
OTHER WORK
Line 418: Line 437:
 
** remove shared tables before updating DB: $wgSharedTables    = array("xxx");
 
** remove shared tables before updating DB: $wgSharedTables    = array("xxx");
 
** verify that a temporary, version-specific wiki-db is used for testing
 
** verify that a temporary, version-specific wiki-db is used for testing
 +
** update $wgScriptPath and $wgArticlePath
 
* Update MediaWikiCommonSettingsVXX
 
* Update MediaWikiCommonSettingsVXX
 
** Remove the Composer-based extension calls from
 
** Remove the Composer-based extension calls from
Line 424: Line 444:
 
  cd /var/www/v-on/w25; sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf=./LocalSettings.php
 
  cd /var/www/v-on/w25; sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf=./LocalSettings.php
 
   
 
   
* SMW-updates partly work with new rebuildData script and conf= syntax:  
+
* SMW-updates partly work with new rebuildData.php script and conf= syntax and use option --dbuser=wikiadmin (because certain tables may need to be created anew):
 +
<syntaxhighlight lang="bash">
 
  cd /var/www/v-on/w25;   
 
  cd /var/www/v-on/w25;   
 
  sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf=./LocalSettings.php
 
  sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf=./LocalSettings.php
  sudo -u www-data php ./extensions/SemanticMediaWiki/maintenance/rebuildData.php -ftpv --conf=./LocalSettings.php  
+
  # rebuildData.php
  sudo -u www-data php ./extensions/SemanticMediaWiki/maintenance/rebuildData.php -v --conf=./LocalSettings.php  
+
# -f Fully delete all content instead of just refreshing
 +
# -t refresh only type pages
 +
# -c refresh only category pages
 +
# -p refresh only property pages
 +
# -v be verbose about the progress
 +
# rebuild data completely from scratch
 +
# sudo -u www-data php ./extensions/SemanticMediaWiki/maintenance/rebuildData.php --dbuser=wikiadmin -fv --conf=./LocalSettings.php  
 +
# just update relevant data
 +
  sudo -u www-data php ./extensions/SemanticMediaWiki/maintenance/rebuildData.php --dbuser=wikiadmin -v --conf=./LocalSettings.php  
 
  sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf=./LocalSettings.php
 
  sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf=./LocalSettings.php
 
  sudo /usr/sbin/apache2ctl -k graceful && sudo service nginx restart && sudo service php5-fpm restart
 
  sudo /usr/sbin/apache2ctl -k graceful && sudo service nginx restart && sudo service php5-fpm restart
 
+
</syntaxhighlight>
'''STATUS:'''
+
Most problematic: Page 1 not rendered in browser,,
+
same error with rebuildData script and with rebuildFileCache:
+
cd /var/www/v-on/w25;    sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf=./LocalSettings.php
+
results in error:
+
Notice: Array to string conversion in /usr/share/mediawiki25/includes/db/Database.php on line 1093 [b31fec11] [no req] 
+
MWException from line 6357 of /usr/share/mediawiki25/includes/parser/Parser.php: Parser state cleared while parsing. Did you call Parser::parse recursively?
+
Backtrace:
+
#0 /usr/share/mediawiki25/includes/parser/Parser.php(4773): Parser->lock()
+
#etc.#
+
  
 
== Installation Issues, Problems, Transition from older Wikis ==
 
== Installation Issues, Problems, Transition from older Wikis ==
Line 460: Line 479:
  
  
=== Installation Problems ===
+
=== Installation Problems/Issues ===
 +
 
 +
==== Issues Semantic MediaWiki ====
 +
 
 +
* new SMW edit help can be disabled: <code>$smwgEnabledEditPageHelp=false; # default true</code>
 +
* since Semantic Forms 3.0+ form definition work only for  <nowiki>[[property:Has default form]]</nowiki> or {{#default_form: }}
 +
* all semantic date may need a rebuild:
 +
<syntaxhighlight lang="bash">
 +
# just update data
 +
sudo -u www-data php ./extensions/SemanticMediaWiki/maintenance/rebuildData.php --dbuser=wikiadmin -v --conf=./LocalSettings.php
 +
# -f fully delete all data and rebuid them from scratch
 +
# sudo -u www-data php ./extensions/SemanticMediaWiki/maintenance/rebuildData.php --dbuser=wikiadmin -fv --conf=./LocalSettings.php
 +
</syntaxhighlight>
 +
 
 +
Semantic Forms:
 +
* some message keys, if modified previously, may need to be updated: look on <code>Special:AllMessages</code> for prefix “sf_”
 +
 
 +
==== Issues Gallery ====
 +
 
 +
MW 1.22+ 'mode' => 'traditional' needs to be defined:
 +
<syntaxhighlight lang="php" line="true" highlight="8">
 +
$wgGalleryOptions = array (
 +
  'imagesPerRow' => 4, // Default number of images per-row in the gallery
 +
  'imageWidth' => 200, // Width of the cells containing images in galleries (in "px")
 +
  'imageHeight' => 200, // Height of the cells containing images in galleries (in "px")
 +
  'captionLength' => 40, // Length of caption to truncate (in characters)
 +
  'showBytes' => true, // Show the filesize in bytes in categories
 +
  // MW 1.22+ mode' => 'traditional' needs to be defined
 +
  'mode' => 'traditional', // One of "traditional", "nolines", "packed", "packed-hover", "packed-overlay"
 +
);
 +
</syntaxhighlight>
  
 
[[Category:MediaWiki]]
 
[[Category:MediaWiki]]
 
[[Category:MediaWiki Extensions]]
 
[[Category:MediaWiki Extensions]]
 
[[Category:Semantic Mediawiki]]
 
[[Category:Semantic Mediawiki]]
 +
[[Category:Upgrade]]

Latest revision as of 14:02, 21 April 2016

MediaWiki version 1.25 installation notes (On 2015-02-26 installed as alpha version)

General note: the present code may NOT allow updating. On trial it failed on updating the extensions. Instead, an update was created in a new folder, and then the existing folder overwritten.

Architecture

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

Schema:

 MW_WMF_CLONE                                        /usr/share/mw-wmf-clone
 ├ core (Git) ─────────git-archive-export───┐        /usr/share/mw-wmf-clone/core
 └ skins (Git)      ───git-archive-export─→ ) ─┐     /usr/share/mw-wmf-clone/skins
 └ extensions (Git) ───git-archive-export─→ ) ─┐     /usr/share/mw-wmf-clone/extensions
                                            │  │
   Active installation (e.g. REL1_25)       │  │
   ┌ core-files (local git archive-export) ←┘  │     /usr/share/mediawiki25
   ├ skins                                     │     /usr/share/mediawiki25/skins
   ├ extensions (mixed:                        │     /usr/share/mediawiki25/extensions
   │   svn biowikifarm, (repo: as svn-post-commit)
   │   git-archive-export)  ←──────────────────┘
   │   some svn extensions from MediaWiki            esp. Extension:StringFunctions
   ↓   
   │ var-www-Wiki
   ├─→ core-files (linked)                           /var/www/v-xxx/w/
   └─→ extensions (linked)                           /var/www/v-xxx/w/extensions
         composer-extensions                         /var/www/v-xxx/w/composer.json

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
 #↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

Update local wmf git clone

##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# Update the git clone on biowikifarm:
if [ `ls /usr/share/mw-wmf-clone/core | wc --lines` -gt 0 ]; then 
  echo "# Update git /usr/share/mw-wmf-clone/core … ";
  cd /usr/share/mw-wmf-clone/core; sudo git pull; # subsequent times
else 
  echo "# Get git for the first time /usr/share/mw-wmf-clone/core … ";
  cd /usr/share/mw-wmf-clone/core; sudo git fetch; # first time
fi
 cd /usr/share/mw-wmf-clone/extensions; sudo git pull; sudo git submodule update --init --recursive;
   sudo ./quick-update
 cd /usr/share/mw-wmf-clone/skins; sudo git pull; sudo git submodule update --init --recursive;

 # OPTIONAL: list information on tags etc:
 cd /usr/share/mw-wmf-clone/core; 
 git branch -r | sort --version-sort # list branches
 git tag -l | sort --version-sort # list tags
 cd /usr/share/mw-wmf-clone/extensions; 
 git branch -r | sort --version-sort # list branches
 git tag -l | sort --version-sort # list tags
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

“Global Variables” and installing/updating core

# Set global variables (UPDATE this for diff. versions!)
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
usr_share_wiki_path="/usr/share/mediawiki25"
git_branch="origin/master" ## OR "origin/wmf/1.25wmf19" for wmf version, OR REL1_25
git_tag="origin/master" ## OR "1.25.9"
vhost_path="/var/www/zzz-temp-overwrite4mw25template" # in web base dir
# version independent:
usr_share_extension_path="${usr_share_wiki_path}/extensions"
vhost_wiki_path="${vhost_path}/w"
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
# Note: if wiki is not directly in the vhost path, add the necessary subfolder, e.g. .../en/w
# End of global variables

# Create MediaWiki core for specific version
if ! [ -d "${usr_share_wiki_path}" ]; then 
  sudo -u root -g mwadmin mkdir --parent "${usr_share_wiki_path}"
  echo -e "Create wiki directory ($git_branch): '${usr_share_wiki_path}'"
else
  echo -e "Wiki wiki directory ($git_branch) exits already: '${usr_share_wiki_path}'"
fi

# Extract MediaWiki core files from git to usr-share-folder
### EXAMPLE without vars:
### cd /usr/share/mw-wmf-clone/core; sudo git archive origin/REL1_23 | sudo -u root -g mwadmin tar --extract --overwrite --directory=/usr/share/mediawiki23
cd /usr/share/mw-wmf-clone/core && sudo git archive $git_tag | sudo -u root -g mwadmin tar --extract --overwrite --directory="${usr_share_wiki_path}"
sudo chown root:www-data -R "${usr_share_extension_path}"
# for composer on wikifarm: create a vendor folder in usr-share-wiki
sudo mkdir "${usr_share_wiki_path}"/vendor

# TO UPDATE JUST USE:
cd /usr/share/mw-wmf-clone/core && sudo git archive $git_tag | sudo -u root -g mwadmin tar --extract --overwrite --directory="${usr_share_wiki_path}"
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

Install wiki extensions

##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# 1. INFORMATION ONLY:
# LIST (and write to file) git tags / git branches of all extensions 
# Write into file in the user's home folder
# (Note: Ignore error about /mw-wmf-clone/extensions/extensions)
sudo printf "\n"  > ~/"ext_tags_and_branches.txt"; 
IFS=$'\n'; # change internal Field Separator to newline only; test: printf %q "$IFS"; default $' \t\n'
for ext in `find /usr/share/mw-wmf-clone/extensions -maxdepth 1 -type d -printf "%f\n" | sort`; do 
  printf "\n%s" "$ext" >> ~/"ext_tags_and_branches.txt"; 
  cd "/usr/share/mw-wmf-clone/extensions/$ext";
  tags=""; tags=`git tag -l | sed ':anchor;N;$!banchor;s@\n@, @g; s@ \{2,\}@ @g;'` ; 
  if [ "$tags" != "" ]; then 
    printf "\n  tags: %s" "$tags" >> ~/"ext_tags_and_branches.txt"; 
  else 
    printf "\n"  >> ~/"ext_tags_and_branches.txt"; 
  fi
done;
# List all extensions with their branches, write into same file
for ext in `find /usr/share/mw-wmf-clone/extensions -maxdepth 1 -type d -printf "%f\n" | sort`; do 
  printf "\n%s" "$ext" >> ~/"ext_tags_and_branches.txt"; 
  cd "/usr/share/mw-wmf-clone/extensions/$ext";
  branches=""; branches=`git branch --remotes | sed ':anchor;N;$!banchor;s@\n@, @g; s@ \{2,\}@ @g;'`
  if [ "$branches" != "" ]; then printf "\n  branches: %s" "$branches"  >> ~/"ext_tags_and_branches.txt"; else printf "\n" >> ~/"ext_tags_and_branches.txt"; fi
done;
cd /usr/share/mw-wmf-clone/extensions
IFS=$' \t\n';
# end list extensions' tags and branches
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
#######################################

NOTE: If git_branch is set to something like REL1_24, code below is broken, QUICKFIX: Put a version after EVERY extension!

#######################################
# 2. Create MediaWiki extensions in usr/share
# Extract correct branch or tag of an extension for this usr-share-wiki. 
# IMPORTANT: extensions managed by PHP script composer.phar and
# their dependencies must not be included here, presently these are:
# "mediawiki/graph-viz": "*",
# "mediawiki/image-map": "@dev",
# "mediawiki/semantic-media-wiki": "~2.1",
# "mediawiki/semantic-breadcrumb-links": "1.0.0",
# "mediawiki/semantic-result-formats": "2.0",
# "mediawiki/semantic-forms": "3.1",
# "mediawiki/semantic-maps": "3.1.3",
# "mediawiki/vector-skin": "*"
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
sudo chown www-data:www-data "${usr_share_extension_path}" -R
EXTENSIONS="
Arrays, origin/master
BetaFeatures, origin/master
CategoryTree, origin/master
CharInsert, origin/master
Cite, origin/master
Collection, origin/master
ConfirmAccount, origin/master
ConfirmEdit, origin/master
ContactPage, origin/master
DataTransfer, 0.6
DismissableSiteNotice, origin/master
ExternalData, 1.8
Gadgets, origin/master
HeaderTabs, 1.0.1
InputBox, origin/master
Interwiki, origin/master
LiquidThreads, origin/master
LocalisationUpdate, origin/master
Lockdown, origin/master
MassEditRegex, origin/master
Math, origin/master
MediaFunctions, origin/master
MwEmbedSupport, origin/master
MultimediaViewer, origin/master
Nuke, origin/master
OpenID, origin/master
PageTools, REL_2_0
ParserFunctions, origin/master
Poem, origin/master
PdfExport, origin/master
PdfHandler, origin/master
Quiz, origin/master
Renameuser, origin/master
ReplaceText, origin/master
SemanticCompoundQueries, origin/master
SemanticDrilldown, origin/master
SemanticFormsInputs, origin/master
SemanticInternalObjects, 0.8.1
SpamBlacklist, origin/master
SyntaxHighlight_GeSHi, origin/master
TimedMediaHandler, origin/master
TitleBlacklist, origin/master
TitleKey, origin/master
UploadWizard, origin/master
Variables, origin/master
Widgets, origin/master
WikiEditor, origin/master
WikimediaMessages, origin/master
"
# --
# 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'; 
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 "/usr/share/mw-wmf-clone/extensions/${this_extension}" ]; then
      echo "/usr/share/mw-wmf-clone/extensions/${this_extension} DOES NOT EXIST AS GIT SOURCE, check the extension's name or path!! (extension was skipped)";
    else
      if [ ! -d "${usr_share_extension_path}/${this_extension}" ]; then
        this_ext_update_status="+";
        sudo mkdir --parents "${usr_share_extension_path}/${this_extension}";
        sudo chown www-data:www-data "${usr_share_extension_path}/${this_extension}";
      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 [ -d "/usr/share/mw-wmf-clone/extensions/${this_extension}" ]; then
        cd "/usr/share/mw-wmf-clone/extensions/${this_extension}";
        AVAILABLE_CLONE_VERSIONS=`git branch -r | sort --version-sort`;
		##### FOLLOWING LINES CAUSE ERROR -> CHECKING code temporarily DISABLED
        ##if [ "`echo "$AVAILABLE_CLONE_VERSIONS" | grep --count "$this_clone_version"`" == "0" ]; then
        ##  echo "Clone version $this_clone_version not available!! Check these (git branch -r  | sort --version-sort):";
        ##  echo "$AVAILABLE_CLONE_VERSIONS";
        ##else
        ##  echo "OK";
        ##fi;
        # EXAMPLE: sudo git archive --prefix=AdminLinks/ HEAD | sudo -u www-data tar --extract --overwrite --directory=/usr/share/mediawiki25/extensions
        echo "sudo git archive --prefix=\"${this_extension}/\" \"$this_clone_version\"" 
        sudo git archive --prefix="${this_extension}/" "$this_clone_version" | sudo -u www-data tar --extract --overwrite --directory="${usr_share_extension_path}";
      else
        echo  "Source not found: \"/usr/share/mw-wmf-clone/extensions/${this_extension}\" ";
      fi;
    fi;
  fi;
done;
cd ..
IFS=$' \t\n';
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
#######################################

Subversion extensions (svn)

## Subversion step 1: some string functions still needed (Check?) ##
# https://www.mediawiki.org/wiki/Extension:StringFunctions
cd "${usr_share_extension_path}"
sudo -u www-data -g www-data svn co http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/StringFunctions/

# subversion step 2: biowikifarm extensions 
cd "${usr_share_extension_path}"
sudo -u www-data -g www-data svn checkout file:///var/lib/svn/LocalSVNextensions "${usr_share_extension_path}"

##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
#######################################

Subversion step 3 (manual, not scripted):

# Subversion step 3 (manual, not scripted):
# UPDATE THE PATH, e.g. mediawiki25!
# create post hook commit to the current MediaWiki version
# Open file:  sudo vi /var/lib/svn/hooks/post-commit
# and insert following text:
if [ -d "/usr/share/mediawiki25/extensions" ]; then
  echo -en "\n\npost-commit mediawiki25/extensions (r${REV})\n" >> "${LOGFILE}"
  cd /usr/share/mediawiki25/extensions
  echo "try to get /usr/bin/svn update >> \"${LOGFILE}\"" >> "${LOGFILE}";
  /usr/bin/svn update >> "${LOGFILE}"
  echo -ne " (done)\n" >> "${LOGFILE}"
fi
Skins

Since Mediawiki V1.25 the default skins are in separate Git respositories. To be installed manually, OR via composer (Vector).

Note: Vector uses COMPOSER! BUT STILL RUN FOR mwSkinNaturkunde.git

 # variables
 cd ${usr_share_wiki_path}/skins
 # get default skins from separate skin git
  ## NEXT TIME: extract (git archive) from /usr/share/mw-wmf-clone/skins!
  ##DISABLED, IS IN COMPOSER## sudo git clone https://git.wikimedia.org/git/mediawiki/skins/Vector.git
  # optionally get special skins from separate git(s)
 sudo git clone https://github.com/MfN-Berlin/mwSkinNaturkunde.git

USR_SHARE_MW → var/www-folder

##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# STEP 1 create web wiki folder
if ! [ -d "${vhost_wiki_path}" ]; then 
  sudo -u root -g mwadmin mkdir --parent "${vhost_wiki_path}"
else
  echo -e "folder already exits: '${vhost_wiki_path}'"
fi
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

OpenMedia Symlink

##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# STEP create symlink to openmedia
if ! [ -d "${vhost_path}/o" ]; then 
  echo -e "Create Openmedia-symlink '${vhost_path}/o' → '../v-species/o'"
  sudo ln -s "../v-species/o" "${vhost_path}/o"
  sudo mkdir "${vhost_path}/o = Openmedia-symlink"
else
  echo -e "Openmedia-symlink already exits"
fi
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑


Link Folders and Files from usr-share-wiki to var-www-wiki

##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# symbolic links of folders
# for $vhost_wiki_path to $usr_share_wiki_path
cd "${usr_share_wiki_path}"
# \( ! -name '.*' \) avoids finding hidden directories
for current_folder in `find . -maxdepth 1 \( ! -name '.*' \) -type d -printf "%f\n"`; do
  if ! [ -e "${vhost_wiki_path}/${current_folder}" ]; then
    echo "symbolic link to ${vhost_wiki_path}/${current_folder}"
    sudo ln -s "${usr_share_wiki_path}/${current_folder}" "${vhost_wiki_path}/${current_folder}"
  fi
done
# Remove some symlinks, which should not be overwritten in existing wikis
sudo rm ${vhost_wiki_path}/cache
sudo rm ${vhost_wiki_path}/images
sudo rm ${vhost_wiki_path}/mw-config

# symbolic links of files
cd "${usr_share_wiki_path}"
# \( ! -name '.*' \) avoids finding hidden directories
for mw_wiki_file in `find . -maxdepth 1 \( ! -name '.*' \) -type f -printf "%f\n"`; do
  if ! [ -e "${vhost_wiki_path}/${mw_wiki_file}" ]; then
    echo "symbolic link to ${vhost_wiki_path}/${mw_wiki_file}"
    sudo ln -s "${usr_share_wiki_path}/${mw_wiki_file}" "${vhost_wiki_path}/${mw_wiki_file}"
  fi
done
# remove links no longer present in 1.25:
sudo rm /var/www/v-on/w25/bin
sudo rm /var/www/v-on/w25/redirect.php
sudo rm /var/www/v-on/w25/redirect.php5
sudo rm /var/www/v-on/w25/redirect.phtml
## it may be that a profiler was defined, delete!
sudo rm /var/www/v-on/w25/StartProfiler.php
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑


  1. COPY over existing installation. EXAMPLE:
sudo mkdir /var/www/v-on/w25
sudo chown root:mwadmin /var/www/v-on/w25
sudo cp /var/www/zzz-temp-overwrite4mw25template/w/* /var/www/v-on/w25 -pr


Install composer extensions

Newer extensions must be dealt with at level of /var/www-wiki. Documentation

##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# Get PHP composer tool / Rerun for UPDATING
cd ~ # personal home directory
sudo curl -sS https://getcomposer.org/installer | php
sudo chown root:mwadmin composer.phar
sudo mv composer.phar /usr/local/bin/
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
# NOTES: Normally composer creates a "vendor" folder in the /var/www/.../w/ folder
# On biowikifarm we create a vendor folder in /usr/share/mediawikiXX (linked into /var/www/.../w/).
# Problem: we also need composer.json and composer.lock files (created on first compopser install in the var-www-wikis).
# However, /maintenance/update.php ... fails to run. Thus we need, from an earlier install, copy the files and add symlinks:

TODO: use global vars AND put it into the template rather than into the example wiki v-on/w25!!!

 # NOTE: 1. DO NOT RERUN THIS SCRIPT! 2. This uses an EXAMPLE wiki path, not the template path. TODO: test with a template wiki next time!
 # rename composer.json to composer.distrib.json if updating from existing installs:
 # sudo mv ${usr_share_wiki_path}/composer.json ${usr_share_wiki_path}/composer.distrib.json 
 ## TODO: cp composer.* to ${usr_share_wiki_path}/composer.json
 sudo rm /var/www/v-on/w25/composer.*
 sudo ln -s ${usr_share_wiki_path}/composer.json /var/www/v-on/w25/composer.json 
 sudo ln -s ${usr_share_wiki_path}/composer.lock /var/www/v-on/w25/composer.lock

Notes:

  • Update the /usr/share/mediawikiXX/composer.json file with the desired composer-installed extensions
  • For all these extensions, remove the include statements you have in your LocalSettings.php file.
  • Not for this fresh install, but for later changes within a version: remove folder located in usr-share-extensions

Run composer (EXAMPLE WIKI!):

 # First time (writing both into vendor and extension folders): 
 # cd /var/www/v-on/w25; sudo php /usr/local/bin/composer.phar install
 # Later (harmless to re-run):
 cd /var/www/v-on/w25; sudo php /usr/local/bin/composer.phar update
 sudo chown www-data:www-data -R "${usr_share_extension_path}"

OTHER WORK

  • Versioned MediaWikiCommonSettings.php needed:
    • sudo cp /var/www/MediaWikiCommonSettings.php /var/www/MediaWikiCommonSettingsV25.php -pr
  • To be safe, create a copy of the metawiki database!
  • Update LocalSettings
    • use MediaWikiCommonSettingsVXX
    • remove shared tables before updating DB: $wgSharedTables = array("xxx");
    • verify that a temporary, version-specific wiki-db is used for testing
    • update $wgScriptPath and $wgArticlePath
  • Update MediaWikiCommonSettingsVXX
    • Remove the Composer-based extension calls from
  • Run update (EXAMPLE)
cd /var/www/v-on/w25; sudo -u www-data php ./maintenance/update.php  --quick --conf=./LocalSettings.php
cd /var/www/v-on/w25; sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf=./LocalSettings.php

  • SMW-updates partly work with new rebuildData.php script and conf= syntax and use option --dbuser=wikiadmin (because certain tables may need to be created anew):
 cd /var/www/v-on/w25;  
 sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf=./LocalSettings.php
 # rebuildData.php
 # -f Fully delete all content instead of just refreshing
 # -t refresh only type pages
 # -c refresh only category pages
 # -p refresh only property pages
 # -v be verbose about the progress
 # rebuild data completely from scratch
 # sudo -u www-data php ./extensions/SemanticMediaWiki/maintenance/rebuildData.php --dbuser=wikiadmin -fv --conf=./LocalSettings.php 
 # just update relevant data
 sudo -u www-data php ./extensions/SemanticMediaWiki/maintenance/rebuildData.php --dbuser=wikiadmin -v --conf=./LocalSettings.php 
 sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf=./LocalSettings.php
 sudo /usr/sbin/apache2ctl -k graceful && sudo service nginx restart && sudo service php5-fpm restart

Installation Issues, Problems, Transition from older Wikis

  • RELEASE-NOTES: read/check file mw-source/RELEASE-NOTES-X.XX, changes are described there, class changes, core changes and deprecated functions
  • CHECK, not sure relevant, seemed to work without problems: Extension:ContactPage has special installation (MW1.23+) https://www.mediawiki.org/wiki/Extension:ContactPage#Installation
  1. * 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

No further development


Installation Problems/Issues

Issues Semantic MediaWiki

  • new SMW edit help can be disabled: $smwgEnabledEditPageHelp=false; # default true
  • since Semantic Forms 3.0+ form definition work only for [[property:Has default form]] or
  • all semantic date may need a rebuild:
# just update data
sudo -u www-data php ./extensions/SemanticMediaWiki/maintenance/rebuildData.php --dbuser=wikiadmin -v --conf=./LocalSettings.php
# -f fully delete all data and rebuid them from scratch
# sudo -u www-data php ./extensions/SemanticMediaWiki/maintenance/rebuildData.php --dbuser=wikiadmin -fv --conf=./LocalSettings.php

Semantic Forms:

  • some message keys, if modified previously, may need to be updated: look on Special:AllMessages for prefix “sf_”

Issues Gallery

MW 1.22+ 'mode' => 'traditional' needs to be defined:

1 $wgGalleryOptions = array (
2   'imagesPerRow' => 4, // Default number of images per-row in the gallery
3   'imageWidth' => 200, // Width of the cells containing images in galleries (in "px")
4   'imageHeight' => 200, // Height of the cells containing images in galleries (in "px")
5   'captionLength' => 40, // Length of caption to truncate (in characters)
6   'showBytes' => true, // Show the filesize in bytes in categories
7   // MW 1.22+ mode' => 'traditional' needs to be defined
8   'mode' => 'traditional', // One of "traditional", "nolines", "packed", "packed-hover", "packed-overlay"
9 );