Difference between revisions of "Mediawiki maintenance"

From Biowikifarm Metawiki
Jump to: navigation, search
(Core and wikimedia-base extensions {{anchor|mw core and base extensions}})
m (Refresh SemanticMW data: +refresh category)
 
(9 intermediate revisions by 3 users not shown)
Line 51: Line 51:
  
 
  # 1. Update the git clone on biowikifarm:
 
  # 1. Update the git clone on biowikifarm:
  cd /usr/share/mw-wmf-clone/core; sudo git fetch; cd ../extensions; sudo git pull; sudo git submodule update --init --recursive;
+
  cd /usr/share/mw-wmf-clone/core; sudo git fetch;  
 +
cd ../extensions; sudo git pull; sudo git submodule update --init --recursive;
 +
cd ../skins; sudo git pull; sudo git submodule update --init --recursive;
  
 
----  
 
----  
Line 324: Line 326:
 
  ### None yet.
 
  ### None yet.
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
=== Skins ===
 +
Since Mediawiki V1.25 the default skins are in a separate Git respository, copied separately
 +
 +
<source lang="bash">
 +
# variables
 +
git_mw_basedir="/usr/share/mediawiki25"
 +
git_mw_skins_source_dir="${git_mw_basedir}/skins"
 +
cd $git_mw_skins_source_dir
 +
# get default skins from separate skin git
 +
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
 +
</source>
  
 
===Additional tasks===
 
===Additional tasks===
Line 345: Line 361:
 
-->
 
-->
 
</syntaxhighlight>
 
</syntaxhighlight>
 
  
 
=== Restart web services ===
 
=== Restart web services ===
Line 599: Line 614:
  
 
OR RUN SCRIPTS like:
 
OR RUN SCRIPTS like:
 +
* for some maintenance scripts temporary tables are created that need <code>--dbuser=wikiadmin</code>
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
  cd /var/www/testwiki;  
 
  cd /var/www/testwiki;  
 
  sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php  
 
  sudo -u www-data php ./maintenance/update.php  --quick --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 -u www-data php ./extensions/SemanticMediaWiki/maintenance/SMW_refreshData.php -ftpv --conf ./LocalSettings.php
+
  # rebuildData.php --help
  sudo -u www-data php ./extensions/SemanticMediaWiki/maintenance/SMW_refreshData.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 all data completely from scratch
 +
# sudo -u www-data php ./extensions/SemanticMediaWiki/maintenance/rebuildData.php --dbuser=wikiadmin -fv --conf=./LocalSettings.php  
 +
# just update all 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
Line 616: Line 640:
 
* valid path? e.g. /extensions/CommonsMediaCaching/runJobs.sh. See /etc/cron…
 
* valid path? e.g. /extensions/CommonsMediaCaching/runJobs.sh. See /etc/cron…
  
==Moving Cache and Media folders to different partition ==
+
==Cache and Media folders==
 +
 
 +
Cache is the file cache, to reduce server load when used by not-logged-in users.
 +
 
 +
===Cleaning corrupt Cache===
 +
 
 +
for f in /mnt/dump/var/www/*cache/*/*/*.html; do sudo rm "$f"; done
 +
for f in /mnt/dump/var/www/*cache/*.cdb; do sudo rm "$f"; done
 +
for f in /mnt/dump/var/www/*cache/*; do sudo rm "$f" -r; done
 +
sudo /usr/sbin/apache2ctl -k graceful && sudo service nginx restart && sudo service php5-fpm restart
 +
 
 +
 
 +
===Moving Cache and Media folders to different partition ===
  
 
Only limited space exists on the root partition itself. Larger Wiki have their Media and Cache folders relocated to the the /mnt/storage and /mnt/dump partitions, respectively. The cache of the following Wikis is presently in /mnt/dump/var/www/: testwiki-cache; v-ispi-w-cache; v-k2n-w-cache; v-lias-w-cache; v-nnvm-w-cache; v-on-w-cache; v-orowiki-w-cache; v-species-o-cache; v-species-w-cache. Move like:
 
Only limited space exists on the root partition itself. Larger Wiki have their Media and Cache folders relocated to the the /mnt/storage and /mnt/dump partitions, respectively. The cache of the following Wikis is presently in /mnt/dump/var/www/: testwiki-cache; v-ispi-w-cache; v-k2n-w-cache; v-lias-w-cache; v-nnvm-w-cache; v-on-w-cache; v-orowiki-w-cache; v-species-o-cache; v-species-w-cache. Move like:
Line 746: Line 782:
 
  cd /var/www/WIKINAME;  # (replace path with actual wiki path!)
 
  cd /var/www/WIKINAME;  # (replace path with actual wiki path!)
 
  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 # may work only with --conf=./LocalSettings.php
+
  # rebuildData.php
  sudo -u www-data php ./extensions/SemanticMediaWiki/maintenance/rebuildData.php -v --conf ./LocalSettings.php # may work only with --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  
 +
# # may work only with equal sign = in --conf=./LocalSettings.php
 +
 
 +
### just update relevant data (a category) or all data
 +
# # may work only with equal sign = in --conf=./LocalSettings.php
 +
  sudo -u www-data php ./extensions/SemanticMediaWiki/maintenance/rebuildData.php --dbuser=wikiadmin --query='[[Category:ThisandThat]]' --conf=./LocalSettings.php
 +
 
 +
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
 
</source>
 
</source>
Line 770: Line 820:
 
[[Category:Semantic Mediawiki]]
 
[[Category:Semantic Mediawiki]]
 
[[Category:Maintenance]]
 
[[Category:Maintenance]]
[[Category:Extensions]]
+
[[Category: MediaWiki Extensions]]
 
[[Category:Upgrade]]
 
[[Category:Upgrade]]
 
[[Category:MediaWiki]]
 
[[Category:MediaWiki]]

Latest revision as of 15:38, 16 April 2019

(See also Mediawiki on biowikifarm (quick introduction/overview of setup) and the Mediawiki installation page (first time installation details).)

NOTE: the instructions below are fully valid for the 1.18/SVN setup. Some steps may differ in the current 1.20/git setup!

Mediawiki maintenance scripts

(See http://www.mediawiki.org/wiki/Manual:Maintenance_scripts)

In /usr/share/mediawiki/phase3/ copy AdminSettings.sample to AdminSettings.php, create a new user wikiadmin for mysql with localhost only, and edit AdminSettings.php accordingly. Then, for each wiki, in /var/www/wikifolder/, a symlink must be created linking to /usr/share/mediawiki/phase3/AdminSettings.php. Since we have a symlinked installation, installations scripts must run like:

 php /var/www/wikifolder/maintenance/rebuildall.php   --conf /var/www/wikifolder/LocalSettings.php
 php /var/www/wikifolder/maintenance/importImages.php --conf /var/www/wikifolder/LocalSettings.php /var/www/wikifolder/media/newimages .jpg .png .svg

Rebuild all is necessary after external text, sql, or xml imports.

Table corruption: rebuildall.php may report that a table, especially searchindex (which is MyISAM even if other tables are InnoDB) is corrupt and needs to be repaired. In phpmyadmin (http://biowikifarm.net/phpmyadmin_v3-3-7), open a sql window for the affected database, and issue: truncate table searchindex;. Running rebuildall.php afterwards concluded the repair in a case we had.

After erroneously localizing commons images not to openmedia but to local wikis, extension Nuke was used to deleted the caching-bot imports, and deleteArchivedFiles to actually delete all archived files, e.g.:

 cd /var/www/v-on/w; php ./maintenance/deleteArchivedFiles.php  --conf ./LocalSettings.php --delete

Fix problems with unparsable image names (see [1]). Needs NOT be run on regular basis, usually no problems:

 cd /var/www/v-k2n/w; php ./maintenance/cleanupImages.php --fix  --conf ./LocalSettings.php
 cd /var/www/v-on/w; php ./maintenance/cleanupImages.php --fix  --conf ./LocalSettings.php
 cd /var/www/v-species/w; php ./maintenance/cleanupImages.php --fix  --conf ./LocalSettings.php
 cd /var/www/v-species/o; php ./maintenance/cleanupImages.php --fix  --conf ./LocalSettings.php
 cd /var/www/v-species/s; php ./maintenance/cleanupImages.php --fix  --conf ./LocalSettings.php

Extension maintenance scripts

Some extensions provide their own maintenance scripts in their own extension folder. On a wiki farm, the execution of these scripts may fail due to the linked directory structure. They need an additional link (needs to be created only once):

 cd /usr/share/mediawiki/; ln -s /usr/share/mediawikistaging/phase3/maintenance
 cd /usr/share/mediawikistaging/; ln -s /usr/share/mediawikistaging/phase3/maintenance

TitleKey now installed (here only example, full set of update commands available further down!):

 cd /var/www/testwiki; php ./extensions/TitleKey/rebuildTitleKeys.php --conf ./LocalSettings.php

MediaWiki version upgrading

Core and wikimedia-base extensions

# 1. Update the git clone on biowikifarm:
cd /usr/share/mw-wmf-clone/core; sudo git fetch; 
cd ../extensions; sudo git pull; sudo git submodule update --init --recursive;
cd ../skins; sudo git pull; sudo git submodule update --init --recursive;

Core and extensions are exported by a tar archive export out of a git clone. This works for creating the first version as well as updating. (Suggestion: before starting the script do a sudo command, e.g. sudo ls so the bash prompt knows your password and you don't have to give your password over and over again). DO NOT RUN THIS SCRIPT ENTIRELY and be fully AWARE OF WHAT YOU EXACTLY DO.

How the structure is intended:

 mw-wmf-clone
 ├ core (Git) ─────────git-archive-export───┐
 └ extensions (Git) ───git-archive-export─→ ) ─┐
                                            │  │
   wiki-source-LTS (e.g. REL1_23)           │  │
   ┌ core-files (local git archive-export) ←┘  │
   ├ extensions (mixed:                        │
   │   svn biowikifarm, (repo: as svn-post-commit)
   │   git-archive-export)  ←──────────────────┘
   │ 
   ↓   
   │ web-wiki (as LTS web Wiki)
   ├─→ core-files (linked)
   └─→ extensions (linked)
# variables
  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_tag_wikiversion="1.20.7"
  git_branch="origin/REL1_20" # if nothin gis specified this will be the default to extract
  mw_LTS_version_source_path="/usr/share/mediawiki20"
# 1. Update biowikifarm clone:
  # UPGRADE step may not be necessary: upgrade changes from remote git source: fetch & merge
  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

# 2. Export (git archive) a specific MediaWiki versions into other folders:
 # First Update Core only, create path if not yet present:
 if ! [ -d "${mw_LTS_version_source_path}" ]; then sudo mkdir "${mw_LTS_version_source_path}"; fi
 # note that git archive does not extract mw-config directory for install (?gitignored something?)
 cd "${git_mw_core_source_dir}"; sudo git archive $git_tag_wikiversion | sudo tar --extract --overwrite --directory="${mw_LTS_version_source_path}"
  # Note: tar provides a "--recursive-unlink" option for extract, which removes the content of the target folder
  #  However, our mediawiki installations require many additional files (svn, widget-right changes, smarty, commons-bot)
  #  which would have to be manually restored. Therefore, DO NOT use --recursive-unlink !

 # 3. Export (git archive) the extensions:
 # In list of extensions desired version is specified like the following examples:
 #  "SemanticMediaWiki"           → version HEAD + extension SemanticMediaWiki
 #  "SemanticMediaWiki, 1.8" → version  1.8 + extension SemanticMediaWiki
 ## NOTE: DO NOT use SemanticCalendar - this is obsolete!!!
 EXTENSIONS="AccessControl
AdminLinks
APC
Arrays
ArticleFeedback
ArticleFeedbackv5
AssertEdit
CategoryTree
CentralAuth
CentralNotice
CharInsert
CheckUser
Cite
cldr
ClickTracking
CodeEditor
Collection
ConditionalShowSection
Configure
ConfirmAccount
ConfirmEdit
ContactPage
Contest
ContributionReporting
DataTransfer
DiscussionThreading
DismissableSiteNotice
DoubleWiki
DumpHTML
DynamicPageList
EmailCapture
ExpandTemplates
ExternalData
FlaggedRevs
FormPreloadPostCache
Gadgets
GlobalBlocking
GlobalUsage
GlobalUserGroups
GraphViz
HeaderTabs
ImageMap
InputBox
Interlanguage
intersection
Interwiki
LabeledSectionTransclusion
LiquidThreads
Lockdown
Loops
Maintenance
Maps, 2.0.1
Math
MediaFunctions
MobileFrontend
MoodBar
MwEmbedSupport
MWSearch
Nuke
OAI
OggHandler
OpenID
OpenSearchXml
PagedTiffHandler
ParserFunctions
PdfHandler
Persona
Poem
PrefSwitch
ProofreadPage
Quiz
Renameuser
ReplaceText
RSS
Scribunto
SemanticCompoundQueries, 0.3.4
SemanticDrilldown, 1.2.4
SemanticForms, 2.5.1
SemanticFormsInputs
SemanticImageInput
SemanticInternalObjects, 0.7
SemanticMaps, 2.0
SemanticMediaWiki, 1.8
SemanticResultFormats, 1.8
SemanticSignup
SemanticWatchlist
SimpleSurvey
SocialProfile
SpamBlacklist
Sudo
Suhosin
SwiftCloudFiles
SyntaxHighlight_GeSHi
TimedMediaHandler
TitleKey
UploadLocal
UploadWizard
Validator, 0.5.1
Variables
Vector
VipsScaler
VisualEditor
WebFonts
Widgets
WikiEditor
WikiLove
WikimediaMessages
Wikibase
WikibaseLib
WikibaseSolr
WikibaseQuery
WikibaseDataModel
WikibaseDatabase
WikibaseQueryEngine
Diff
Ask
DataValues
DataTypes
Serialization
Push
DeleteBatch"
## Note: as of 2013-10, the extensions ValueParsers ValueFormatters ValueValidators 
##   mentioned in Wikibase install do not exist. Not checked any further -gh

  # --------------------------------------
  # split line on ", ". If only one value, export HEAD, else first value is branch/tag. Example:
  #   "SemanticMediaWiki, 1.8"
  #      ↓                 ↓
  #   $this_extension  $this_clone_version
  #   will export tag 1.8  otherwise $git_branch
  # --------------------------------------
  # 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 or $git_branch" else (||) version-string
  # ${ext%,*}    from back  of $ext → delete shortest (%) or (%%) longest match 
  # ${ext#*,* }  from front of $ext → delete shortest (#) or (##) longest match
  # --------------------------------------
mw_LTS_version_source_extension_path="${mw_LTS_version_source_path}/extensions"
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, check the extension's name or path!! (extension was skipped)"
    else
      if [ ! -d "${mw_LTS_version_source_extension_path}/${this_extension}" ]; then
        sudo mkdir --parents "${mw_LTS_version_source_extension_path}/${this_extension}"; this_ext_update_status="+"
        sudo chown www-data:www-data "${mw_LTS_version_source_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
      # EXAMPLE: sudo git archive --prefix=AdminLinks/ origin/REL1_20 | sudo -u www-data tar --extract --overwrite --directory=/usr/share/mediawiki20/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}"
      # EXAMPLE: sudo git archive --prefix=AdminLinks/ HEAD | sudo -u www-data tar --extract --overwrite --directory=/usr/share/mediawiki20/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}"
    fi
  fi
done
IFS=$' \t\n';

Upgrading individual Wikimedia-based extensions

The above upgrade all extensions. If an error is detected in a single extension, it is often better to upgrade only this, since updates to other extensions may introduce new errors.

Note: in many cases it is possible to delete an extension first before updating. HOWEVER SOME EXTENSIONS need special additions or configurations beyond git and will NOT WORK if deleted and checked out. Similarly, use the dangerous "delete-all-option" "tar --recursive-unlink" only if 100% certain that this is not the case for a given extension!

Following are some examples from recent updates:

# (1) upgade all extensions managed by git
cd /usr/share/mw-wmf-clone/extensions; sudo git pull; sudo git submodule update --init --recursive;
# check for tags of a specific extension
# cd /usr/share/mw-wmf-clone/extensions/Maps; git tag -l | sort --version-sort

# (2) overwrite extension
cd /usr/share/mw-wmf-clone/extensions/MwEmbedSupport && sudo git archive --prefix=MwEmbedSupport/ HEAD | \
  sudo -u www-data tar --extract --overwrite --directory=/usr/share/mediawiki20/extensions
cd /usr/share/mw-wmf-clone/extensions/Maps && sudo git archive --prefix=Maps/   tags/2.0.1 | \
  sudo -u www-data tar --extract --overwrite --directory=/usr/share/mediawiki20/extensions
cd /usr/share/mw-wmf-clone/extensions/ConfirmAccount && sudo git archive --prefix=ConfirmAccount/   HEAD | \
  sudo -u www-data tar --extract --overwrite --directory=/usr/share/mediawiki20/extensions
# OR, TO GO TO SPECIFIC RELEASE BRANCH, DO:
cd /usr/share/mw-wmf-clone/extensions/ConfirmAccount && sudo git archive --prefix=ConfirmAccount/   origin/REL1_20 | \
  sudo -u www-data tar --extract --overwrite --directory=/usr/share/mediawiki20/extensions
cd /usr/share/mw-wmf-clone/extensions/PrefSwitch && sudo git archive --prefix=PrefSwitch/   HEAD | \
  sudo -u www-data tar --extract --overwrite --directory=/usr/share/mediawiki20/extensions
cd /usr/share/mw-wmf-clone/extensions/Vector && sudo git archive --prefix=Vector/   HEAD | \
  sudo -u www-data tar --extract --overwrite --directory=/usr/share/mediawiki20/extensions
cd /usr/share/mw-wmf-clone/extensions/SemanticDrilldown && sudo git archive  --prefix=SemanticDrilldown/  HEAD | \
  sudo -u www-data tar --extract --overwrite --directory=/usr/share/mediawiki20/extensions

# DELETE manually an extension directory before extracting it using bash variables
# do delete only if it is save to the extension upgrading it by deleting it first
extensionName="LiquidThreads"; versionOrTag="HEAD"; directoryFrom="/usr/share/mw-wmf-clone/extensions"; directoryTo="/usr/share/mediawiki20/extensions";
sudo ls ; # make sure sudo does not prompt for password on subsequent commands
cd "${directoryFrom}/${extensionName}" && if [ -d "${directoryTo}" ]; then rm -r "${directoryTo}/${extensionName}/"; fi && \
  sudo git archive  --prefix="${extensionName}/"  ${versionOrTag} | \
  sudo -u www-data tar --extract --overwrite --directory="${directoryTo}"

Updating extensions based in local subversion repo

 # 4. SVN-Extension UPDATING
 # If necessary: make sure www-data can update!!
 # cd /usr/share/mediawiki20/extensions && sudo chown -R  www-data:www-data ./.svn/
 # Update from LOCAL-svn with:
 cd ${wikipath}extensions; sudo -u www-data /usr/bin/svn update;

Updating additional extensions from other sources

 # 5. Additional extensions from other sources
 ### None yet.

Skins

Since Mediawiki V1.25 the default skins are in a separate Git respository, copied separately

 # variables
 git_mw_basedir="/usr/share/mediawiki25"
 git_mw_skins_source_dir="${git_mw_basedir}/skins"
 cd $git_mw_skins_source_dir
 # get default skins from separate skin git
 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

Additional tasks

 # 6. Finishing touches. Widgets needs a writable folder:
 cd ${wikipath}
 sudo chown -R  www-data:www-data ./extensions/Widgets/compiled_templates;
 sudo chmod g+w -R  ./extensions/Widgets/compiled_templates;
 # eg. sudo chown -R  www-data:www-data /usr/share/mediawiki20/extensions/Widgets/compiled_templates; sudo chmod g+w -R  /usr/share/mediawiki20/extensions/Widgets/compiled_templates
 # Widgets does not contain all necessary code (-> Warning: require_once(/usr/share/mediawiki20/phase3/extensions/Widgets/smarty/Smarty.class.php): failed to open stream: No such file or directory...)
 # In the absence of installation instructions, using previously saved code:
 sudo cp -r /usr/share/mw-missing-code/Widgets/smarty ./extensions/Widgets
 sudo cp -r /usr/share/mw-missing-code/Widgets/googlecode ./extensions/Widgets
<!--
 # NOTE: in Dec. 2012 the parts were originally copied as seen below:
 sudo mkdir /usr/share/mw-missing-code
 sudo mkdir /usr/share/mw-missing-code/Widgets
 sudo cp -r /usr/share/mediawikistaging/ext-tagged-release/Widgets/smarty /usr/share/mw-missing-code/Widgets
 sudo cp -r /usr/share/mediawikistaging/ext-tagged-release/Widgets/googlecode /usr/share/mw-missing-code/Widgets
-->

Restart web services

sudo /usr/sbin/apache2ctl -k graceful && sudo service nginx restart && sudo service php5-fpm restart
# Optionally do other updates:
sudo apt-get update; sudo apt-get upgrade 


Update, runJobs, rebuildFileCache, refreshMetadata scripts

NOTE: Add gbif-kos, check all wikis

Occasionally version upgrades of Mediawiki require an upgrade of the database structures. Again, the update.php must be called with symlink-compatible syntax. Examples for mediawiki core and titlekey extension:

 cd /var/www/metawiki;          sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/studienstiftungswiki; sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/testwiki;          sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/testwiki2;         sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/testwikiEDIT;      sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/goldengate;        sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/dataqualitywiki;   sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-botknow-test/w;  sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-binhum/w;        sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-bayernflora/w;   sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-mfn/w;           sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-mfn/dig;         sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-mfn/intra;       sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-filteredpush/w;  sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-floramalesiana/w;sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-fotoflorabb/w;   sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-gbif-d/w;        sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-hypergarden/w;   sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-ibiosphere/w;    sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-ides/w;   sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-ispi/w;   sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-k2n/w;    sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-k2n/h;    sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-k2n/it;   sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-k2n/sl;   sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-lias/w;   sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-naturgucker/r;   sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-nnvm/w;   sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-on/w;     sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-on/bfl;   sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-orowiki/w;        sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-phytomed/w;       sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-phytopathology/w; sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-plantnet/terms/e; sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-plantnet/terms/f; sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-plantnet/uses/e;  sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-plantnet/uses/f;  sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-rosaceae/w;  sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-species/f;   sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-species/o;   sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-species/s;   sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-species/w;   sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-tdwg-terms/w;    sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-tdwg-groups/w;   sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-tdwg-groups/sig; sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-ukcounty/w;  sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-workbench/w; sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-zsm/w;       sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php

 # START OF TITLEKEY UPDATES:
 cd /var/www/metawiki;          sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/studienstiftungswiki; sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/testwiki;          sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/testwiki2;         sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/testwikiEDIT;      sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/goldengate;        sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/dataqualitywiki;   sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-botknow-test/w;  sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-binhum/w;        sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-bayernflora/w;   sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-mfn/w;           sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-mfn/dig;         sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-mfn/intra;       sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-filteredpush/w;  sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-floramalesiana/w;sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-fotoflorabb/w;   sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-gbif-d/w;        sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-hypergarden/w;   sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-ibiosphere/w;    sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-ides/w;   sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-ispi/w;   sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-k2n/h;    sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-k2n/it;   sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-k2n/sl;   sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-k2n/w;    sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-lias/w;   sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-naturgucker/r; sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-nnvm/w;   sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-on/w;     sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-on/bfl;   sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-orowiki/w;sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-phytomed/w;       sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-phytopathology/w; sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-plantnet/terms/e; sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-plantnet/terms/f; sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-plantnet/uses/e;  sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-plantnet/uses/f;  sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-rosaceae/w;  sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-species/f;   sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-species/o;   sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-species/s;   sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-species/w;   sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-tdwg-terms/w;   sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-tdwg-groups/w;  sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-tdwg-groups/sig;sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-ukcounty/w;     sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-workbench/w;    sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php
 cd /var/www/v-zsm/w;          sudo -u www-data php ./extensions/TitleKey/rebuildTitleKeys.php  --quick --conf ./LocalSettings.php

 # '''runJobs''' in all wikis //WIKI LIST NEEDS UPDATING!
 cd /var/www/metawiki;          sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/studienstiftungswiki; sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/testwiki;          sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/testwiki2;         sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/testwikiEDIT;      sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/goldengate;        sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/dataqualitywiki;   sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-botknow-test/w;  sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-binhum/w;        sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-bayernflora/w;   sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-mfn/w;           sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-mfn/dig;         sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-mfn/intra;       sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-filteredpush/w;  sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-floramalesiana/w;sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-fotoflorabb/w;   sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-gbif-d/w;        sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-hypergarden/w;   sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-ibiosphere/w;    sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-ides/w;   sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-ispi/w;   sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-k2n/w;    sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-k2n/h;    sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-k2n/it;   sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-k2n/sl;   sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-lias/w;   sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-naturgucker/w; sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-nnvm/w;   sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-on/w;     sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-on/bfl;   sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-orowiki/w;sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-phytomed/w;      sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-phytopathology/w;sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-plantnet/terms/e;sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-plantnet/terms/f;sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-plantnet/uses/e; sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-plantnet/uses/f; sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-rosaceae/w;  sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-species/f;   sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-species/o;   sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-species/s;   sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-species/w;   sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-tdwg-terms/w;   sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-tdwg-groups/w;  sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-tdwg-groups/sig;sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-ukcounty/w;  sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-workbench/w; sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 cd /var/www/v-zsm/w;       sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php

 # '''Rebuilding the file cache''' (watch permissions, simulate the www-data user as if written by apache):
 cd /var/www/metawiki;             sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/studienstiftungswiki; sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/testwiki;             sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/testwiki2;            sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/testwikiEDIT;         sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php




 cd /var/www/v-bayernflora/w;   sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-mfn/w;           sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-mfn/dig;         sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-mfn/intra;       sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-filteredpush/w;  sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-floramalesiana/w;sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-fotoflorabb/w;   sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-gbif-d/w;        sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-hypergarden/w;   sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-ispi/w;   sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-k2n/w;    sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-k2n/h;    sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-k2n/it;   sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-k2n/sl;   sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-lias/w;   sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-nnvm/w;   sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-on/w;     sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-orowiki/w;sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-phytomed/w;       sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-phytopathology/w; sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-plantnet/terms/e; sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-plantnet/terms/f; sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-plantnet/uses/e;  sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-plantnet/uses/f;  sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-rosaceae/w;  sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-species/f;   sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-species/o;   sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-species/s;   sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-species/w;   sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-tdwg-terms/w;    sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-tdwg-groups/w;   sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-tdwg-groups/sig; sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-workbench/w; sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php
 cd /var/www/v-zsm/w;       sudo -u www-data php ./maintenance/rebuildFileCache.php 0 overwrite --conf ./LocalSettings.php

 # refreshImageMetadata.php
 cd /var/www/metawiki;             sudo -u www-data php ./maintenance/refreshImageMetadata.php --force --conf ./LocalSettings.php
 cd /var/www/studienstiftungswiki; sudo -u www-data php ./maintenance/refreshImageMetadata.php --force --conf ./LocalSettings.php
 cd /var/www/testwiki;             sudo -u www-data php ./maintenance/refreshImageMetadata.php --force --conf ./LocalSettings.php
 cd /var/www/testwiki2;            sudo -u www-data php ./maintenance/refreshImageMetadata.php --force --conf ./LocalSettings.php
 cd /var/www/v-floramalesiana/w;   sudo -u www-data php ./maintenance/refreshImageMetadata.php --force --conf ./LocalSettings.php
 cd /var/www/v-gbif-d/w;           sudo -u www-data php ./maintenance/refreshImageMetadata.php --force --conf ./LocalSettings.php
 cd /var/www/v-ispi/w;   sudo -u www-data php ./maintenance/refreshImageMetadata.php --force --conf ./LocalSettings.php
 cd /var/www/v-k2n/w;    sudo -u www-data php ./maintenance/refreshImageMetadata.php --force --conf ./LocalSettings.php
 cd /var/www/v-k2n/h;    sudo -u www-data php ./maintenance/refreshImageMetadata.php --force --conf ./LocalSettings.php
 cd /var/www/v-k2n/sl;   sudo -u www-data php ./maintenance/refreshImageMetadata.php --force --conf ./LocalSettings.php
 cd /var/www/v-lias/w;   sudo -u www-data php ./maintenance/refreshImageMetadata.php --force --conf ./LocalSettings.php
 cd /var/www/v-nnvm/w;   sudo -u www-data php ./maintenance/refreshImageMetadata.php --force --conf ./LocalSettings.php
 cd /var/www/v-on/w;     sudo -u www-data php ./maintenance/refreshImageMetadata.php --force --conf ./LocalSettings.php
 cd /var/www/v-orowiki/w;sudo -u www-data php ./maintenance/refreshImageMetadata.php --force --conf ./LocalSettings.php
 cd /var/www/v-phytomed/w;       sudo -u www-data php ./maintenance/refreshImageMetadata.php --force --conf ./LocalSettings.php
 cd /var/www/v-phytopathology/w; sudo -u www-data php ./maintenance/refreshImageMetadata.php --force --conf ./LocalSettings.php
 cd /var/www/v-plantnet/terms/e; sudo -u www-data php ./maintenance/refreshImageMetadata.php --force --conf ./LocalSettings.php
 cd /var/www/v-plantnet/terms/f; sudo -u www-data php ./maintenance/refreshImageMetadata.php --force --conf ./LocalSettings.php
 cd /var/www/v-plantnet/uses/e;  sudo -u www-data php ./maintenance/refreshImageMetadata.php --force --conf ./LocalSettings.php
 cd /var/www/v-plantnet/uses/f;  sudo -u www-data php ./maintenance/refreshImageMetadata.php --force --conf ./LocalSettings.php
 cd /var/www/v-rosaceae/w;  sudo -u www-data php ./maintenance/refreshImageMetadata.php --force --conf ./LocalSettings.php
 cd /var/www/v-species/f;   sudo -u www-data php ./maintenance/refreshImageMetadata.php --force --conf ./LocalSettings.php
 cd /var/www/v-species/o;   sudo -u www-data php ./maintenance/refreshImageMetadata.php --force --conf ./LocalSettings.php
 cd /var/www/v-species/s;   sudo -u www-data php ./maintenance/refreshImageMetadata.php --force --conf ./LocalSettings.php
 cd /var/www/v-species/w;   sudo -u www-data php ./maintenance/refreshImageMetadata.php --force --conf ./LocalSettings.php
 cd /var/www/v-workbench/w; sudo -u www-data php ./maintenance/refreshImageMetadata.php --force --conf ./LocalSettings.php
 cd /var/www/v-zsm/w;       sudo -u www-data php ./maintenance/refreshImageMetadata.php --force --conf ./LocalSettings.php


Note: do not try to update /var/www/zzz...templates.... It won't work, LocalSettings is missing.

For semantic mediawiki extension (SMW) click on "Initialise or upgrade tables" on SpecialPage Semantic Admin:

OR RUN SCRIPTS like:

  • for some maintenance scripts temporary tables are created that need --dbuser=wikiadmin
 cd /var/www/testwiki; 
 sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php 
 sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 # rebuildData.php --help
 #   -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 all data completely from scratch
 # sudo -u www-data php ./extensions/SemanticMediaWiki/maintenance/rebuildData.php --dbuser=wikiadmin -fv --conf=./LocalSettings.php 
 # just update all 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

See also Maintenance scripts above for further scripts.

Upgrade-Checklist of issues and task

When upgrading to a new wiki core check the following issues

Cron jobs

  • valid path? e.g. /extensions/CommonsMediaCaching/runJobs.sh. See /etc/cron…

Cache and Media folders

Cache is the file cache, to reduce server load when used by not-logged-in users.

Cleaning corrupt Cache

for f in /mnt/dump/var/www/*cache/*/*/*.html; do sudo rm "$f"; done
for f in /mnt/dump/var/www/*cache/*.cdb; do sudo rm "$f"; done
for f in /mnt/dump/var/www/*cache/*; do sudo rm "$f" -r; done
sudo /usr/sbin/apache2ctl -k graceful && sudo service nginx restart && sudo service php5-fpm restart


Moving Cache and Media folders to different partition

Only limited space exists on the root partition itself. Larger Wiki have their Media and Cache folders relocated to the the /mnt/storage and /mnt/dump partitions, respectively. The cache of the following Wikis is presently in /mnt/dump/var/www/: testwiki-cache; v-ispi-w-cache; v-k2n-w-cache; v-lias-w-cache; v-nnvm-w-cache; v-on-w-cache; v-orowiki-w-cache; v-species-o-cache; v-species-w-cache. Move like:

### manual version
# create folders on dump, then change owner and group:
 cd /mnt/dump/var/www; sudo mkdir v-lias-w-cache; sudo chown www-data *; sudo chgrp www-data *;
# remove current cache, create link to new folder:
 cd /var/www/v-lias/w;     sudo rm cache -r; sudo ln -s /mnt/dump/var/www/v-lias-w-cache  cache

### script version 
# create folders on dump, then change owner and group:
var_dump_path="/mnt/dump/var/www";
var_dump_folder="v-lias-w-cache";
web_wiki_base_path="/var/www/v-lias/w",
sudo mkdir --parent "${var_dump_path}/${var_dump_folder}"; 
sudo chown www-data "${var_dump_path}/${var_dump_folder}"; 
sudo chgrp www-data "${var_dump_path}/${var_dump_folder}";
# remove current cache, create link to new folder:
sudo rm "${web_wiki_base_path}/cache" -r;
# make a symlink
cd "${web_wiki_base_path}" && sudo ln -s "${var_dump_path}/${var_dump_folder}" "cache"

For linking media folder (to Storage, not Dump!):

cd /mnt/storage/; sudo mkdir var-www-v-species-w-media;
sudo chown www-data var-www-v-species-w-media; sudo chgrp www-data var-www-v-species-w-media;
sudo cp /var/www/v-species/w/media /mnt/storage/var-www-v-species-w-media
## check and manually delete old media folder! Then create link:
cd /var/www/v-species/w; sudo ln -s /mnt/storage/var-www-v-species-w-media media

General topics

MediaWiki configuration tips

Configuring MediaWiki:Sidebar: New options July 2008, see [2]

It may be useful to copy the contents of http://en.wikipedia.org/wiki/MediaWiki:Common.css and http://en.wikipedia.org/wiki/MediaWiki:Monobook.css into the Mediawiki:Common.css and MediaWiki:Monobook.css pages of each Wiki where you may want to use copied things e.g. templates from wikipedia.

File uploading and Mime types

Uploading files with extensions and Content types (MIME types) usually not allowed on wikis: The default of normally allowed extensions is listed $wgFileExtensions in /includes/DefaultSettings.php (which should never be edited). To allow additional extensions override $wgFileExtensions in LocalSettings.php.

There are also $wgMimeTypeBlacklist and $wgFileBlacklist for file extensions and MIME types that are never allowed for security reasons, even if added to $wgFileExtensions. If needed for special purposes and considered safe, they can be commented out in these blacklists in LocalSettings.php.

If there is still the error message "The file is corrupt or has an incorrect extension. Please check the file and upload again", the reason can be that the file you want to upload has a MIME type for which only certain file extensions are allowed in /includes/mime.types and has an extension not listed there. If considered safe, the extension can be added in that file. The mime type can be determined with the command file -i filename. Note: Files that are changed manually are then excluded from svn update. To drop own changes and get back to the svn version delete the file and then run svn update (see above).

Logging/Debugging

For debugging, you may enable logging of debug and error messages:

# create a log-file somewhere
  sudo touch /var/www/v-k2n/w/log.txt
  sudo chmod 777 /var/www/v-k2n/w/log.txt
# edit LocalSettings.php and add the following line after the line including the DefaultSettings.php:
  $wgDebugLogFile = "/var/www/v-k2n/w/log.txt";

Note, that the logfile will grow fast, so one should switch on the logging only for short periods of time, and delete the logfile after done.

PHP debugging can be done with xdebug. Details see Mediawiki debugging.

Apply a Patch Manually to a File (LTS Version)

Some branches of a MediaWiki Long Term Support (LTS) version seem not to be “back”-integrated in an older branch, e.g. origin/REL1_23. So one has to apply bug-fixes manually by applying a patch to a file for a LTS version:

  1. download and extract the file reported as being fixed (example: ApiQueryImageInfo.php)
  2. move it to the folder of the LTS version
  3. check differences, create a patch
  4. apply the patch

(TODO: There is possibly also a way to integrate a git pull to a specific branch)

# set variables
mw_LTS_version_source_path="/usr/share/mediawiki20"
mw_LTS_version_source_extension_path="${mw_LTS_version_source_path}/extensions"
# go to the source folder to apply the patch
cd "${mw_LTS_version_source_path}/includes/api"
# have the downloaded and extracted file already in place
# use wget and tar -x
### check differences ##
# vimdiff ApiQueryImageInfo.php ApiQueryImageInfo_new-64d8aeda6305b64974731c4408b85e92225f1752.php
#   move left-down-top-right by h←, j↓, k↑, l→ 
#   quit and type ":q" to quit split vimdiff window one by one (i.e. twice ":q")
### create patch ###
# diff --unified oldfile newfile > file.diffpatch
sudo diff --unified  ApiQueryImageInfo.php ApiQueryImageInfo_new-64d8aeda6305b64974731c4408b85e92225f1752.php > 'ApiQueryImageInfo_Internal_error_in_ApiResult::setElement:Bad_parameter.diffpatch'
# apply the patch
sudo patch < "ApiQueryImageInfo_Internal_error_in_ApiResult::setElement:Bad_parameter.diffpatch"
# reverse the patch
# sudo patch --reverse < "ApiQueryImageInfo_Internal_error_in_ApiResult::setElement:Bad_parameter.diffpatch"

Backup/Restore in general

Backing up the database alone is documented here: http://www.mediawiki.org/wiki/Manual:Backing_up_a_wiki. A more complete script can be found here: http://www.mediawiki.org/wiki/User:Flominator/Backup_MW - this also backups the folder with uploads (media). Based on that source, adapted scripts were created, execute as:

 cd /var/backups/scripts/; ./backup-mw.sh

The additional backup-mw.php script can potentially be used within www to directly create and download a copy of the mediawiki. We are considering this as a measure to build trust.

In addition, to create an xml dump, make sure a link to AdminSettings.php exists in the current wiki folder and the maintenance folder is temporarily copied, then run, e.g.:

 cd /var/www/v-on/w;   sudo -u www-data php ./maintenance/dumpBackup.php  --full --conf ./LocalSettings.php > /var/www/v-orowiki/w/media/full.xml

To restore such a xml-dump, remove tables and create new tables with default values in mysql, then:

 cd /var/www/WIKINAME;  # (replace path with actual wiki path!)
 php ./maintenance/importDump.php /var/backups/wikis/k2n-full.xml --conf ./LocalSettings.php
 php ./maintenance/rebuildrecentchanges.php --conf ./LocalSettings.php    # absolutely necessary
 ## If backlinks etc. do not work, or extensions had to be disabled, use (Very slow!!!!):
 php ./maintenance/rebuildall.php  --quick --conf ./LocalSettings.php

Notes: In our experience, some extensions may create problems during reimport. We found GoogleMaps and DynamicPageList to cause importDump to abort. After disabling these two extensions, the import worked correctly. However, all DPL pages are then still cached without proper DPL rendering even after re-enabling both extensions. Running rebuildall.php fixed this.

Example restore for testing of the wikimediafoundation commons xml-dump:

 cd /var/www/wmf-commons; php ./maintenance/importDump.php  /mnt/wpTest/commonswiki-pages-articles.xml  --conf ./LocalSettings.php

Refresh SemanticMW data

If it becomes necessary to delete all SMW data in a particular wiki and regenerate the data again from the individual pages the following command lines can be used:

 cd /var/www/WIKINAME;  # (replace path with actual wiki path!)
 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 
 # # may work only with equal sign = in --conf=./LocalSettings.php

 ### just update relevant data (a category) or all data
 # # may work only with equal sign = in --conf=./LocalSettings.php
 sudo -u www-data php ./extensions/SemanticMediaWiki/maintenance/rebuildData.php --dbuser=wikiadmin --query='[[Category:ThisandThat]]' --conf=./LocalSettings.php

 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

Notes:

  1. change to the local directory of the wiki to be refreshed,
  2. make sure all outstanding jobs are completed,
  3. delete all SMW data,
  4. regenerate the data from the individual pages.

The last step can take some time (e.g. about 10 minutes to refresh about 4000 IDs). The wiki seems to work normally during that time but queries may be effected. For that reason it is recommended to implement this operation during a maintenance window.

During step 4 the procedure slows down after about 5 min. and can be sped up by:

  1. interrupting the procedure by using Crtl-C
  2. restarting the last command by specifying the next ID to be processed, e.g.
php ./extensions/SemanticMediaWiki/maintenance/rebuildData.php -v -s 2062 --conf ./LocalSettings.php # may work only with --conf=./LocalSettings.php

if 2061 IDs had been already processed at the time of the interruption.



See also: Mediawiki installation